From: Mark Brown <broonie@kernel.org>
To: Shuah Khan <shuah@kernel.org>, Hangbin Liu <liuhangbin@gmail.com>,
Brendan Jackman <jackmanb@google.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Mark Brown <broonie@kernel.org>
Subject: [PATCH] selftests: Fix duplicated test number reporting
Date: Fri, 17 Apr 2026 17:57:50 +0100 [thread overview]
Message-ID: <20260417-selftests-fix-double-number-v1-1-1be5d7c36b94@kernel.org> (raw)
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.
Fixes: 2964f6b816c2 ("selftests: Use ktap helpers for runner.sh")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/testing/selftests/kselftest/runner.sh | 23 ++++++++++-------------
1 file 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
---
base-commit: c7275b05bc428c7373d97aa2da02d3a7fa6b9f66
change-id: 20260417-selftests-fix-double-number-99322f012bb1
Best regards,
--
Mark Brown <broonie@kernel.org>
next reply other threads:[~2026-04-17 16:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 16:57 Mark Brown [this message]
2026-04-17 17:24 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260417-selftests-fix-double-number-v1-1-1be5d7c36b94@kernel.org \
--to=broonie@kernel.org \
--cc=jackmanb@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=liuhangbin@gmail.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®