* [PATCH] selftests/mm: emit KTAP output from ksft_kmemleak_dedup
@ 2026-08-12 13:21 Song Hu
2026-08-12 13:46 ` Mike Rapoport
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Song Hu @ 2026-08-12 13:21 UTC (permalink / raw)
To: linux-mm, akpm
Cc: shuah, david, ljs, liam, vbabka, rppt, surenb, mhocko,
linux-kselftest, linux-kernel, Song Hu
ksft_kmemleak_dedup.sh reports its result with raw "SKIP:"/"FAIL":"PASS:"
echoes and bare exit codes instead of KTAP, so parse_kselftest.py cannot
read it. Convert it to the ktap_helpers.sh API, like its sibling
ksft_kmemleak_confirm.sh.
Signed-off-by: Song Hu <husong@kylinos.cn>
---
.../selftests/mm/ksft_kmemleak_dedup.sh | 20 ++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh b/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
index d01950244490..2db7f006808f 100755
--- a/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
+++ b/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
@@ -19,24 +19,30 @@
#
# Author: Breno Leitao <leitao@debian.org>
-ksft_skip=4
+# KTAP output helpers (ktap_skip_all, ktap_exit_fail_msg, ktap_test_pass, ...).
+DIR="$(dirname "$(readlink -f "$0")")"
+# shellcheck source=../kselftest/ktap_helpers.sh
+source "${DIR}"/../kselftest/ktap_helpers.sh
+
KMEMLEAK=/sys/kernel/debug/kmemleak
VERBOSE_PARAM=/sys/module/kmemleak/parameters/verbose
MODULE=kmemleak-test
+ktap_print_header
+
skip() {
- echo "SKIP: $*"
- exit $ksft_skip
+ ktap_skip_all "$*"
+ exit "$KSFT_SKIP"
}
fail() {
- echo "FAIL: $*"
- exit 1
+ ktap_exit_fail_msg "$*"
}
pass() {
- echo "PASS: $*"
- exit 0
+ ktap_set_plan 1
+ ktap_test_pass "$*"
+ ktap_finished
}
[ "$(id -u)" -eq 0 ] || skip "must run as root"
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/mm: emit KTAP output from ksft_kmemleak_dedup
2026-08-12 13:21 [PATCH] selftests/mm: emit KTAP output from ksft_kmemleak_dedup Song Hu
@ 2026-08-12 13:46 ` Mike Rapoport
2026-08-12 16:34 ` Breno Leitao
2026-08-12 16:35 ` Usama Anjum
2 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2026-08-12 13:46 UTC (permalink / raw)
To: Song Hu
Cc: linux-mm, akpm, shuah, david, ljs, liam, vbabka, surenb, mhocko,
linux-kselftest, linux-kernel
On Wed, Aug 12, 2026 at 09:21:41PM +0800, Song Hu wrote:
> ksft_kmemleak_dedup.sh reports its result with raw "SKIP:"/"FAIL":"PASS:"
> echoes and bare exit codes instead of KTAP, so parse_kselftest.py cannot
> read it. Convert it to the ktap_helpers.sh API, like its sibling
> ksft_kmemleak_confirm.sh.
>
> Signed-off-by: Song Hu <husong@kylinos.cn>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
> .../selftests/mm/ksft_kmemleak_dedup.sh | 20 ++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh b/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
> index d01950244490..2db7f006808f 100755
> --- a/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
> +++ b/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
> @@ -19,24 +19,30 @@
> #
> # Author: Breno Leitao <leitao@debian.org>
>
> -ksft_skip=4
> +# KTAP output helpers (ktap_skip_all, ktap_exit_fail_msg, ktap_test_pass, ...).
> +DIR="$(dirname "$(readlink -f "$0")")"
> +# shellcheck source=../kselftest/ktap_helpers.sh
> +source "${DIR}"/../kselftest/ktap_helpers.sh
> +
> KMEMLEAK=/sys/kernel/debug/kmemleak
> VERBOSE_PARAM=/sys/module/kmemleak/parameters/verbose
> MODULE=kmemleak-test
>
> +ktap_print_header
> +
> skip() {
> - echo "SKIP: $*"
> - exit $ksft_skip
> + ktap_skip_all "$*"
> + exit "$KSFT_SKIP"
> }
>
> fail() {
> - echo "FAIL: $*"
> - exit 1
> + ktap_exit_fail_msg "$*"
> }
>
> pass() {
> - echo "PASS: $*"
> - exit 0
> + ktap_set_plan 1
> + ktap_test_pass "$*"
> + ktap_finished
> }
>
> [ "$(id -u)" -eq 0 ] || skip "must run as root"
> --
> 2.43.0
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/mm: emit KTAP output from ksft_kmemleak_dedup
2026-08-12 13:21 [PATCH] selftests/mm: emit KTAP output from ksft_kmemleak_dedup Song Hu
2026-08-12 13:46 ` Mike Rapoport
@ 2026-08-12 16:34 ` Breno Leitao
2026-08-12 16:35 ` Usama Anjum
2 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2026-08-12 16:34 UTC (permalink / raw)
To: Song Hu
Cc: linux-mm, akpm, shuah, david, ljs, liam, vbabka, rppt, surenb,
mhocko, linux-kselftest, linux-kernel
On Wed, Aug 12, 2026 at 09:21:41PM +0800, Song Hu wrote:
> ksft_kmemleak_dedup.sh reports its result with raw "SKIP:"/"FAIL":"PASS:"
> echoes and bare exit codes instead of KTAP, so parse_kselftest.py cannot
> read it. Convert it to the ktap_helpers.sh API, like its sibling
> ksft_kmemleak_confirm.sh.
>
> Signed-off-by: Song Hu <husong@kylinos.cn>
Reviewed-by: Breno Leitao <leitao@debian.org>
Thanks for the patch!
--breno
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/mm: emit KTAP output from ksft_kmemleak_dedup
2026-08-12 13:21 [PATCH] selftests/mm: emit KTAP output from ksft_kmemleak_dedup Song Hu
2026-08-12 13:46 ` Mike Rapoport
2026-08-12 16:34 ` Breno Leitao
@ 2026-08-12 16:35 ` Usama Anjum
2 siblings, 0 replies; 4+ messages in thread
From: Usama Anjum @ 2026-08-12 16:35 UTC (permalink / raw)
To: Song Hu
Cc: usama.anjum, shuah, david, ljs, liam, vbabka, rppt, surenb,
mhocko, linux-kselftest, linux-kernel, linux-mm, akpm
On 12/08/2026 2:21 pm, Song Hu wrote:
> ksft_kmemleak_dedup.sh reports its result with raw "SKIP:"/"FAIL":"PASS:"
> echoes and bare exit codes instead of KTAP, so parse_kselftest.py cannot
> read it. Convert it to the ktap_helpers.sh API, like its sibling
> ksft_kmemleak_confirm.sh.
>
> Signed-off-by: Song Hu <husong@kylinos.cn>
> ---
> .../selftests/mm/ksft_kmemleak_dedup.sh | 20 ++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh b/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
> index d01950244490..2db7f006808f 100755
> --- a/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
> +++ b/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
> @@ -19,24 +19,30 @@
> #
> # Author: Breno Leitao <leitao@debian.org>
>
> -ksft_skip=4
> +# KTAP output helpers (ktap_skip_all, ktap_exit_fail_msg, ktap_test_pass, ...).
> +DIR="$(dirname "$(readlink -f "$0")")"
> +# shellcheck source=../kselftest/ktap_helpers.sh
> +source "${DIR}"/../kselftest/ktap_helpers.sh
> +
> KMEMLEAK=/sys/kernel/debug/kmemleak
> VERBOSE_PARAM=/sys/module/kmemleak/parameters/verbose
> MODULE=kmemleak-test
>
> +ktap_print_header
> +
> skip() {
> - echo "SKIP: $*"
> - exit $ksft_skip
> + ktap_skip_all "$*"
Please use ktap_test_skip to make it generic please.
> + exit "$KSFT_SKIP"
> }
>
> fail() {
> - echo "FAIL: $*"
> - exit 1
> + ktap_exit_fail_msg "$*"
Please call ktap_test_fail instead here to mark the failure.
ktap_exit_fail_msg is usually used in unrecoverable error case.
> }
>
> pass() {
> - echo "PASS: $*"
> - exit 0
> + ktap_set_plan 1
ktap_set_plan must be called for fail and skip cases as well. So please
move it to the very start of the test.
> + ktap_test_pass "$*"
> + ktap_finished
ktap_finished must be called for all the cases (skip/failure) as well it
prints the final line that how many tests got pass/failed or skipped.
Please look into how other tests work and then refactor this test
accordingly.
> }
>
> [ "$(id -u)" -eq 0 ] || skip "must run as root"
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-12 16:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12 13:21 [PATCH] selftests/mm: emit KTAP output from ksft_kmemleak_dedup Song Hu
2026-08-12 13:46 ` Mike Rapoport
2026-08-12 16:34 ` Breno Leitao
2026-08-12 16:35 ` Usama Anjum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox