Skip to content

Commit

Permalink
ufs/tpmi_ufs.sh: Fix sysfs_verify to really test the path
Browse files Browse the repository at this point in the history
The sysfs_verify function sets test type as "dir", "file" or "exist"
from the parameter, but there is no code that really does the check.
The test_print_trc function simply echoes a line no matter the path
exists or not. This may cause some false test results such as:

$ ls /sys/devices/system/cpu/intel_uncore_frequency/current_freq_khz
ls: cannot access '/sys/devices/system/cpu/intel_uncore_frequency/current_freq_khz': No such file or directory

$ sudo ./runtests -c "./ufs/tpmi_ufs.sh -t check_ufs_sysfs_attr"
<<<test start - './ufs/tpmi_ufs.sh -t check_ufs_sysfs_attr'>>
|0122_171944.874|TRACE|Check TPMI_UFS driver sysfs attribute:|
|0122_171944.876|TRACE|/sys/devices/system/cpu/intel_uncore_frequency/current_freq_khz does exist|
|0122_171944.879|TRACE|/sys/devices/system/cpu/intel_uncore_frequency/initial_max_freq_khz does exist|
|0122_171944.881|TRACE|/sys/devices/system/cpu/intel_uncore_frequency/domain_id does exist|
|0122_171944.883|TRACE|/sys/devices/system/cpu/intel_uncore_frequency/fabric_cluster_id does exist|
|0122_171944.886|TRACE|/sys/devices/system/cpu/intel_uncore_frequency/initial_min_freq_khz does exist|
|0122_171944.888|TRACE|/sys/devices/system/cpu/intel_uncore_frequency/max_freq_khz does exist|
|0122_171944.891|TRACE|/sys/devices/system/cpu/intel_uncore_frequency/min_freq_khz does exist|
|0122_171944.893|TRACE|/sys/devices/system/cpu/intel_uncore_frequency/package_id does exist|
|0122_171944.899|TRACE|package_00_die_00|
<<<test end, result: PASS, duration: 0.057>>

Test Start Time: 2024-01-22_17-19-44
--------------------------------------------------------
Testcase                                                                    Result     Exit Value  Duration
--------                                                                    ------     ----------  --------
[RESULT][./ufs/tpmi_ufs.sh -t check_ufs_sysfs_attr]                          [PASS]    [0]         [0.057s]
--------------------------------------------------------

Reported-by: kernel test robot <[email protected]>
Signed-off-by: Yujie Liu <[email protected]>
  • Loading branch information
Yujie-Liu committed Jan 23, 2024
1 parent d2e666a commit 3de3692
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ufs/tpmi_ufs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ sysfs_verify() {
if [[ "$TYPE" != "d" ]] && [[ "$TYPE" != "f" ]]; then
TYPE="e"
fi
test_print_trc "$path does exist"
return 0

test -$TYPE "$path" && test_print_trc "$path does exist"
}

ufs_unbind_bind() {
Expand Down

0 comments on commit 3de3692

Please sign in to comment.