* [PATCH] selftests/mm: fix incorrect skip output in pkey_sighandler_tests
@ 2026-08-25 12:30 Zenghui Yu
2026-08-25 14:21 ` David Hildenbrand (Arm)
0 siblings, 1 reply; 2+ messages in thread
From: Zenghui Yu @ 2026-08-25 12:30 UTC (permalink / raw)
To: linux-mm, linux-kselftest, linux-kernel
Cc: akpm, david, ljs, liam, vbabka, rppt, surenb, mhocko, shuah,
Zenghui Yu (Huawei)
From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev>
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
Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
---
tools/testing/selftests/mm/pkey_sighandler_tests.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
index c218d0510a2a..74bf79a5399d 100644
--- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
+++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
@@ -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])();
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] selftests/mm: fix incorrect skip output in pkey_sighandler_tests
2026-08-25 12:30 [PATCH] selftests/mm: fix incorrect skip output in pkey_sighandler_tests Zenghui Yu
@ 2026-08-25 14:21 ` David Hildenbrand (Arm)
0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand (Arm) @ 2026-08-25 14:21 UTC (permalink / raw)
To: Zenghui Yu, linux-mm, linux-kselftest, linux-kernel
Cc: akpm, ljs, liam, vbabka, rppt, surenb, mhocko, shuah
On 8/25/26 14:30, Zenghui Yu wrote:
> From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev>
>
> 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
>
> Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
> ---
> tools/testing/selftests/mm/pkey_sighandler_tests.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
> index c218d0510a2a..74bf79a5399d 100644
> --- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
> +++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
> @@ -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])();
We also handle it like that in soft-dirty.c, so why not
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-25 14:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 12:30 [PATCH] selftests/mm: fix incorrect skip output in pkey_sighandler_tests Zenghui Yu
2026-08-25 14:21 ` David Hildenbrand (Arm)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox