Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: Fix duplicated test number reporting

Commit 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh") converted
the prints in runner.sh to use the relevant helpers from ktap_helpers.sh,
not modifying any of the strings printed in the process. This included
converting all the result reports to use the relevant ktap_test_ function.
Since the output was originally KTAP compliant the strings reported for
test names now include test numbers:

ok 59 59 selftests: arm64: syscall-abi

instead of the expected format:

ok 59 selftests: arm64: syscall-abi

which causes result parsers to interpret the second number as part of the
test name.

Given the use of the helpers the tracking of test numbers by runner.sh is
now redundant, remove it entirely to restore the expected output format.

Link: https://lore.kernel.org/r/20260417-selftests-fix-double-number-v1-1-1be5d7c36b94@kernel.org
Fixes: 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh")
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Mark Brown and committed by
Shuah Khan
83ef26f9 df410ad4

+10 -13
+10 -13
tools/testing/selftests/kselftest/runner.sh
··· 51 51 { 52 52 DIR="$1" 53 53 TEST="$2" 54 - local rc test_num="$3" 55 54 56 55 BASENAME_TEST=$(basename $TEST) 57 56 ··· 107 108 echo "# $TEST_HDR_MSG" 108 109 if [ ! -e "$TEST" ]; then 109 110 ktap_print_msg "Warning: file $TEST is missing!" 110 - ktap_test_fail "$test_num $TEST_HDR_MSG" 111 + ktap_test_fail "$TEST_HDR_MSG" 111 112 rc=$KSFT_FAIL 112 113 else 113 114 if [ -x /usr/bin/stdbuf ]; then ··· 126 127 interpreter=$(head -n 1 "$TEST" | cut -c 3-) 127 128 cmd="$stdbuf $interpreter ./$BASENAME_TEST" 128 129 else 129 - ktap_test_fail "$test_num $TEST_HDR_MSG" 130 + ktap_test_fail "$TEST_HDR_MSG" 130 131 return $KSFT_FAIL 131 132 fi 132 133 fi ··· 137 138 rc=$? 138 139 case "$rc" in 139 140 "$KSFT_PASS") 140 - ktap_test_pass "$test_num $TEST_HDR_MSG";; 141 + ktap_test_pass "$TEST_HDR_MSG";; 141 142 "$KSFT_SKIP") 142 - ktap_test_skip "$test_num $TEST_HDR_MSG";; 143 + ktap_test_skip "$TEST_HDR_MSG";; 143 144 "$KSFT_XFAIL") 144 - ktap_test_xfail "$test_num $TEST_HDR_MSG";; 145 + ktap_test_xfail "$TEST_HDR_MSG";; 145 146 "$timeout_rc") 146 - ktap_test_fail "$test_num $TEST_HDR_MSG # TIMEOUT $kselftest_timeout seconds";; 147 + ktap_test_fail "$TEST_HDR_MSG # TIMEOUT $kselftest_timeout seconds";; 147 148 *) 148 - ktap_test_fail "$test_num $TEST_HDR_MSG # exit=$rc";; 149 + ktap_test_fail "$TEST_HDR_MSG # exit=$rc";; 149 150 esac 150 151 cd - >/dev/null 151 152 fi ··· 160 161 BASE_DIR=$BASE_DIR 161 162 source $BASE_DIR/kselftest/runner.sh 162 163 logfile=$logfile 163 - run_one $DIR $TEST $test_num 164 + run_one $DIR $TEST 164 165 EOF 165 166 } 166 167 ··· 173 174 ip netns add $netns 174 175 if [ $? -ne 0 ]; then 175 176 ktap_print_msg "Warning: Create namespace failed for $BASENAME_TEST" 176 - ktap_test_fail "$test_num selftests: $DIR: $BASENAME_TEST # Create NS failed" 177 + ktap_test_fail "selftests: $DIR: $BASENAME_TEST # Create NS failed" 177 178 fi 178 179 ip -n $netns link set lo up 179 180 ··· 190 191 run_many() 191 192 { 192 193 DIR="${PWD#${BASE_DIR}/}" 193 - test_num=0 194 194 local rc 195 195 pids= 196 196 197 197 for TEST in "$@"; do 198 198 BASENAME_TEST=$(basename $TEST) 199 - test_num=$(( test_num + 1 )) 200 199 if [ -n "$per_test_logging" ]; then 201 200 logfile="$per_test_log_dir/$BASENAME_TEST" 202 201 cat /dev/null > "$logfile" ··· 203 206 run_in_netns & 204 207 pids="$pids $!" 205 208 else 206 - run_one "$DIR" "$TEST" "$test_num" 209 + run_one "$DIR" "$TEST" 207 210 fi 208 211 done 209 212