From 3d114da118b160c29cd05d0eaf62044c5b826262 Mon Sep 17 00:00:00 2001 From: Yujie Liu Date: Tue, 23 Jan 2024 09:37:38 +0800 Subject: [PATCH] ufs/tpmi_ufs.sh: Fix possible false results when driver sysfs does not exist If the kernel is built without CONFIG_INTEL_UNCORE_FREQ_CONTROL enabled, the driver sysfs path won't exist, so the tests are expected to fail, but actually it gives PASS results: <<> ls: cannot access '/sys/devices/system/cpu/intel_uncore_frequency': No such file or directory |1214_133318.071|TRACE|Uncore number: 0| <<> <<> ls: cannot access '/sys/devices/system/cpu/intel_uncore_frequency': No such file or directory <<> <<> ls: cannot access '/sys/devices/system/cpu/intel_uncore_frequency': No such file or directory <<> <<> ls: cannot access '/sys/devices/system/cpu/intel_uncore_frequency': No such file or directory <<> After CONFIG_INTEL_UNCORE_FREQ_CONTROL being enabled in the kernel, if the uncore number is 0, the tests are not done, either, so it is expected to be shown as BLOCK instead of PASS. <<> |0122_044137.087|TRACE|Uncore number: 0| <<> <<> <<> <<> <<> <<> <<> Reported-by: kernel test robot Signed-off-by: Yujie Liu --- ufs/tpmi_ufs.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ufs/tpmi_ufs.sh b/ufs/tpmi_ufs.sh index 6fa278e..2292ced 100755 --- a/ufs/tpmi_ufs.sh +++ b/ufs/tpmi_ufs.sh @@ -104,8 +104,10 @@ ufs_sysfs_attr() { } ufs_init_min_max_value() { + [[ -d "$UFS_SYSFS_PATH" ]] || die "$UFS_SYSFS_PATH does not exist" per_die_num=$(ls "$UFS_SYSFS_PATH" | grep -c uncore) test_print_trc "Uncore number: $per_die_num" + [[ "$per_die_num" = 0 ]] && block_test "Uncore number is 0" for ((i = 1; i <= per_die_num; i++)); do per_die=$(ls "$UFS_SYSFS_PATH" | grep uncore | sed -n "$i,1p") init_min=$(cat $UFS_SYSFS_PATH/"$per_die"/initial_min_freq_khz) @@ -125,7 +127,10 @@ ufs_init_min_max_value() { min_equals_to_max() { # Test Uncore freq is based on per die, this function is to set # Min_freq_khz to the same value of initial_max_freq_khz + [[ -d "$UFS_SYSFS_PATH" ]] || die "$UFS_SYSFS_PATH does not exist" per_die_num=$(ls "$UFS_SYSFS_PATH" | grep -c uncore) + test_print_trc "Uncore number: $per_die_num" + [[ "$per_die_num" = 0 ]] && block_test "Uncore number is 0" for ((i = 1; i <= per_die_num; i++)); do per_die=$(ls "$UFS_SYSFS_PATH" | grep uncore | sed -n "$i,1p") @@ -173,7 +178,10 @@ the max test freq $init_max khz" max_equals_to_min() { # Test Uncore freq is based on per die, this function is to set # Max_freq_khz to the same value of initial_min_freq_khz + [[ -d "$UFS_SYSFS_PATH" ]] || die "$UFS_SYSFS_PATH does not exist" per_die_num=$(ls "$UFS_SYSFS_PATH" | grep -c uncore) + test_print_trc "Uncore number: $per_die_num" + [[ "$per_die_num" = 0 ]] && block_test "Uncore number is 0" for ((i = 1; i <= per_die_num; i++)); do per_die=$(ls "$UFS_SYSFS_PATH" | grep uncore | sed -n "$i,1p") @@ -223,7 +231,10 @@ min_max_dynamic() { # Test Uncore freq is based on per die, this function is to set test freq to # current_freq_khz value + 100000 khz + [[ -d "$UFS_SYSFS_PATH" ]] || die "$UFS_SYSFS_PATH does not exist" per_die_num=$(ls "$UFS_SYSFS_PATH" | grep -c uncore) + test_print_trc "Uncore number: $per_die_num" + [[ "$per_die_num" = 0 ]] && block_test "Uncore number is 0" for ((i = 1; i <= per_die_num; i++)); do per_die=$(ls "$UFS_SYSFS_PATH" | grep uncore | sed -n "$i,1p") @@ -276,7 +287,10 @@ min and max test freq $test_freq khz" } pkg_max_min_freq_change() { + [[ -d "$UFS_SYSFS_PATH" ]] || die "$UFS_SYSFS_PATH does not exist" pkg_num=$(ls "$UFS_SYSFS_PATH" | grep -c package) + test_print_trc "Package number: $pkg_num" + [[ "$pkg_num" = 0 ]] && block_test "Package number is 0" # All the packages initial_max_freq_khz and initial_min_freq_khz are same at boot # So set test_max_freq and test_min_freq by referring any package