selftests/mm: fix incorrect skip output in pkey_sighandler_tests
Subsystems (3)
PATCH 1/1 selftests/mm: fix incorrect skip output in pkey_sighandler_tests
From: "Zenghui Yu (Huawei)" <[email protected]>
When pkeys is not supported, ksft_exit_skip() runs with ksft_plan already set, which takes the "ok N # SKIP" branch intended for skipping a single test case. The result is a TAP plan of 5 but only one result line.
$ ./pkey_sighandler_tests TAP version 13 1..5 ok 1 # SKIP pkeys not supported # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage. # Planned tests != run tests (5 != 1) # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:1 error:0
Move ksft_set_plan() after the skip check so ksft_exit_skip() takes the "1..0 # SKIP" branch, the correct TAP representation for skipping an entire test file.
$ ./pkey_sighandler_tests TAP version 13 1..0 # SKIP pkeys not supported
--- tools/testing/selftests/mm/pkey_sighandler_tests.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/mm/pkey_sighandler_tests.c +2 -1
@@ -543,11 +543,12 @@ static void (*pkey_tests[])(void) = {int main (int argc,char *argv[]) {ksft_print_header (); -ksft_set_plan (ARRAY_SIZE (pkey_tests));if (!is_pkeys_supported ())ksft_exit_skip ("pkeys not supported\n" ); +ksft_set_plan (ARRAY_SIZE (pkey_tests)); +for (test_nr =0 ; test_nr <ARRAY_SIZE (pkey_tests); test_nr++) {tracing_on (); (*pkey_tests[test_nr])();
Signature · 1 line
2.53.0
Quoted 35 lines · Zenghui Yu
From: "Zenghui Yu (Huawei)" <[email protected]>
When pkeys is not supported,
ksft_exit_skip()runs withksft_planalready set, which takes the "ok N # SKIP" branch intended for skipping a single test case. The result is a TAP plan of 5 but only one result line.$ ./pkey_sighandler_tests TAP version 13 1..5 ok 1 # SKIP pkeys not supported # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage. # Planned tests != run tests (5 != 1) # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:1 error:0Move
ksft_set_plan()after the skip check soksft_exit_skip()takes the "1..0 # SKIP" branch, the correct TAP representation for skipping an entire test file.$ ./pkey_sighandler_tests TAP version 13 1..0 # SKIP pkeys not supportedSigned-off-by Zenghui Yu (Huawei) <[email protected]>--- tools/testing/selftests/mm/pkey_sighandler_tests.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/mm/pkey_sighandler_tests.c +0
-0@@ -543,11 +543,12 @@ static void (*pkey_tests[])(void) = {int main (int argc,char *argv[]) {ksft_print_header ();
tools/testing/selftests/mm/pkey_sighandler_tests.c static void (*pkey_tests[])(void) = { · line 554
Quoted 10 lines
tools/testing/selftests/mm/pkey_sighandler_tests.c +2
-1-ksft_set_plan (ARRAY_SIZE (pkey_tests));if (!is_pkeys_supported ())ksft_exit_skip ("pkeys not supported\n" ); +ksft_set_plan (ARRAY_SIZE (pkey_tests)); +for (test_nr =0 ; test_nr <ARRAY_SIZE (pkey_tests); test_nr++) {tracing_on (); (*pkey_tests[test_nr])();
We also handle it like that in soft-dirty.c, so why not
Signature · 3 lines
Cheers, David