On 4/27/26 05:24, Sarthak Sharma wrote:
ksft_exit_skip() increments ksft_xskip before printing the KTAP
result. As a result, ksft_test_num() already includes the skipped
test.

Adding 1 to ksft_test_num() increments the printed test number
again, producing an incorrect test number and wrong KTAP output.

Drop the extra increment and print ksft_test_num() directly.

I applied this patch to linux-kselftest fixes branch.

I ran a few tests and couldn't really see the problem this patch
fixes with and without the patch.

Can you send me before and after for mm or timers test runs?


Fixes: b85d387c9b09 ("kselftest: fix TAP output for skipped tests")
Signed-off-by: Sarthak Sharma <[email protected]>
---
  tools/testing/selftests/kselftest.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/kselftest.h 
b/tools/testing/selftests/kselftest.h
index afbcf8412ae5..827b47cf4df8 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -449,7 +449,7 @@ static inline __noreturn __printf(1, 2) void 
ksft_exit_skip(const char *msg, ...
         */
        if (ksft_plan || ksft_test_num()) {
                ksft_cnt.ksft_xskip++;
-               printf("ok %u # SKIP ", 1 + ksft_test_num());
+               printf("ok %u # SKIP ", ksft_test_num());
        } else {
                printf("1..0 # SKIP ");
        }

thanks,
-- Shuah

Reply via email to