diff options
| author | Mark Brown <broonie@kernel.org> | 2026-04-17 17:57:50 +0100 |
|---|---|---|
| committer | Shuah Khan <skhan@linuxfoundation.org> | 2026-04-17 11:29:03 -0600 |
| commit | 83ef26f911432d9c98b6d8b6ed0709a8b79cd834 (patch) | |
| tree | 4fbdf487a932905c681a8cae4c9831b4c14e5a68 /tools | |
| parent | df410ad40ca0a57c46c06de2b992de8baf3a7f5a (diff) | |
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>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/testing/selftests/kselftest/runner.sh | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh index 1115ee7e525c..311811dc55a0 100644 --- a/tools/testing/selftests/kselftest/runner.sh +++ b/tools/testing/selftests/kselftest/runner.sh @@ -51,7 +51,6 @@ run_one() { DIR="$1" TEST="$2" - local rc test_num="$3" BASENAME_TEST=$(basename $TEST) @@ -108,7 +107,7 @@ run_one() echo "# $TEST_HDR_MSG" if [ ! -e "$TEST" ]; then ktap_print_msg "Warning: file $TEST is missing!" - ktap_test_fail "$test_num $TEST_HDR_MSG" + ktap_test_fail "$TEST_HDR_MSG" rc=$KSFT_FAIL else if [ -x /usr/bin/stdbuf ]; then @@ -127,7 +126,7 @@ run_one() interpreter=$(head -n 1 "$TEST" | cut -c 3-) cmd="$stdbuf $interpreter ./$BASENAME_TEST" else - ktap_test_fail "$test_num $TEST_HDR_MSG" + ktap_test_fail "$TEST_HDR_MSG" return $KSFT_FAIL fi fi @@ -138,15 +137,15 @@ run_one() rc=$? case "$rc" in "$KSFT_PASS") - ktap_test_pass "$test_num $TEST_HDR_MSG";; + ktap_test_pass "$TEST_HDR_MSG";; "$KSFT_SKIP") - ktap_test_skip "$test_num $TEST_HDR_MSG";; + ktap_test_skip "$TEST_HDR_MSG";; "$KSFT_XFAIL") - ktap_test_xfail "$test_num $TEST_HDR_MSG";; + ktap_test_xfail "$TEST_HDR_MSG";; "$timeout_rc") - ktap_test_fail "$test_num $TEST_HDR_MSG # TIMEOUT $kselftest_timeout seconds";; + ktap_test_fail "$TEST_HDR_MSG # TIMEOUT $kselftest_timeout seconds";; *) - ktap_test_fail "$test_num $TEST_HDR_MSG # exit=$rc";; + ktap_test_fail "$TEST_HDR_MSG # exit=$rc";; esac cd - >/dev/null fi @@ -161,7 +160,7 @@ in_netns() BASE_DIR=$BASE_DIR source $BASE_DIR/kselftest/runner.sh logfile=$logfile - run_one $DIR $TEST $test_num + run_one $DIR $TEST EOF } @@ -174,7 +173,7 @@ run_in_netns() ip netns add $netns if [ $? -ne 0 ]; then ktap_print_msg "Warning: Create namespace failed for $BASENAME_TEST" - ktap_test_fail "$test_num selftests: $DIR: $BASENAME_TEST # Create NS failed" + ktap_test_fail "selftests: $DIR: $BASENAME_TEST # Create NS failed" fi ip -n $netns link set lo up @@ -191,13 +190,11 @@ run_in_netns() run_many() { DIR="${PWD#${BASE_DIR}/}" - test_num=0 local rc pids= for TEST in "$@"; do BASENAME_TEST=$(basename $TEST) - test_num=$(( test_num + 1 )) if [ -n "$per_test_logging" ]; then logfile="$per_test_log_dir/$BASENAME_TEST" cat /dev/null > "$logfile" @@ -206,7 +203,7 @@ run_many() run_in_netns & pids="$pids $!" else - run_one "$DIR" "$TEST" "$test_num" + run_one "$DIR" "$TEST" fi done |
