From 3de369291d1c995fe5cbb471892c4fdb26d9de15 Mon Sep 17 00:00:00 2001 From: Yujie Liu Date: Mon, 22 Jan 2024 17:23:23 +0800 Subject: [PATCH] ufs/tpmi_ufs.sh: Fix sysfs_verify to really test the path 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" <<> |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 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 Signed-off-by: Yujie Liu --- ufs/tpmi_ufs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ufs/tpmi_ufs.sh b/ufs/tpmi_ufs.sh index 0349a7a..6fa278e 100755 --- a/ufs/tpmi_ufs.sh +++ b/ufs/tpmi_ufs.sh @@ -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() {