.../selftests/mm/ksft_kmemleak_dedup.sh | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
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.
skip() and fail() emit ktap_test_skip()/ktap_test_fail() instead of
ktap_skip_all()/ktap_exit_fail_msg(), and a single ktap_set_plan() at the
top covers every path; ktap_finished() then prints the totals line and
provides the exit code for skip/fail/pass alike.
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Song Hu <husong@kylinos.cn>
---
Changes in v2, per review feedback from Usama Anjum:
- use ktap_test_skip() instead of ktap_skip_all(), and ktap_test_fail()
instead of ktap_exit_fail_msg()
- move ktap_set_plan() to the very start so it covers all paths
- call ktap_finished() on the skip and fail paths as well
v1: https://lore.kernel.org/all/20260812132142.582390-1-husong@kylinos.cn/
.../selftests/mm/ksft_kmemleak_dedup.sh | 21 ++++++++++++-------
1 file changed, 14 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..fda6a9340e0e 100755
--- a/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
+++ b/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
@@ -19,24 +19,31 @@
#
# Author: Breno Leitao <leitao@debian.org>
-ksft_skip=4
+# KTAP output helpers (ktap_test_pass, ktap_test_skip, ktap_test_fail, ...).
+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
+ktap_set_plan 1
+
skip() {
- echo "SKIP: $*"
- exit $ksft_skip
+ ktap_test_skip "$*"
+ ktap_finished
}
fail() {
- echo "FAIL: $*"
- exit 1
+ ktap_test_fail "$*"
+ ktap_finished
}
pass() {
- echo "PASS: $*"
- exit 0
+ ktap_test_pass "$*"
+ ktap_finished
}
[ "$(id -u)" -eq 0 ] || skip "must run as root"
--
2.43.0
On Sat, Aug 15, 2026 at 04:42:31PM +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.
>
> skip() and fail() emit ktap_test_skip()/ktap_test_fail() instead of
> ktap_skip_all()/ktap_exit_fail_msg(), and a single ktap_set_plan() at the
> top covers every path; ktap_finished() then prints the totals line and
> provides the exit code for skip/fail/pass alike.
>
> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> Reviewed-by: Breno Leitao <leitao@debian.org>
> Signed-off-by: Song Hu <husong@kylinos.cn>
LGTM so:
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
>
> Changes in v2, per review feedback from Usama Anjum:
> - use ktap_test_skip() instead of ktap_skip_all(), and ktap_test_fail()
> instead of ktap_exit_fail_msg()
> - move ktap_set_plan() to the very start so it covers all paths
> - call ktap_finished() on the skip and fail paths as well
>
> v1: https://lore.kernel.org/all/20260812132142.582390-1-husong@kylinos.cn/
> .../selftests/mm/ksft_kmemleak_dedup.sh | 21 ++++++++++++-------
> 1 file changed, 14 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..fda6a9340e0e 100755
> --- a/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
> +++ b/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
> @@ -19,24 +19,31 @@
> #
> # Author: Breno Leitao <leitao@debian.org>
>
> -ksft_skip=4
> +# KTAP output helpers (ktap_test_pass, ktap_test_skip, ktap_test_fail, ...).
> +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
> +ktap_set_plan 1
> +
> skip() {
> - echo "SKIP: $*"
> - exit $ksft_skip
> + ktap_test_skip "$*"
> + ktap_finished
> }
>
> fail() {
> - echo "FAIL: $*"
> - exit 1
> + ktap_test_fail "$*"
> + ktap_finished
> }
>
> pass() {
> - echo "PASS: $*"
> - exit 0
> + ktap_test_pass "$*"
> + ktap_finished
> }
>
> [ "$(id -u)" -eq 0 ] || skip "must run as root"
> --
> 2.43.0
>
--
Cheers, Lorenzo
On 15/08/2026 9:42 am, 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.
>
> skip() and fail() emit ktap_test_skip()/ktap_test_fail() instead of
> ktap_skip_all()/ktap_exit_fail_msg(), and a single ktap_set_plan() at the
> top covers every path; ktap_finished() then prints the totals line and
> provides the exit code for skip/fail/pass alike.
>
> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> Reviewed-by: Breno Leitao <leitao@debian.org>
> Signed-off-by: Song Hu <husong@kylinos.cn>
> ---
>
> Changes in v2, per review feedback from Usama Anjum:
> - use ktap_test_skip() instead of ktap_skip_all(), and ktap_test_fail()
> instead of ktap_exit_fail_msg()
> - move ktap_set_plan() to the very start so it covers all paths
> - call ktap_finished() on the skip and fail paths as well
Thank you for updating the patch.
Tested-by: Muhammad Usama Anjum <usama.anjum@arm.com>
Reviewed-by: Muhammad Usma Anjum <usama.anjum@arm.com>
>
> v1: https://lore.kernel.org/all/20260812132142.582390-1-husong@kylinos.cn/
> .../selftests/mm/ksft_kmemleak_dedup.sh | 21 ++++++++++++-------
> 1 file changed, 14 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..fda6a9340e0e 100755
> --- a/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
> +++ b/tools/testing/selftests/mm/ksft_kmemleak_dedup.sh
> @@ -19,24 +19,31 @@
> #
> # Author: Breno Leitao <leitao@debian.org>
>
> -ksft_skip=4
> +# KTAP output helpers (ktap_test_pass, ktap_test_skip, ktap_test_fail, ...).
> +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
> +ktap_set_plan 1
> +
> skip() {
> - echo "SKIP: $*"
> - exit $ksft_skip
> + ktap_test_skip "$*"
> + ktap_finished
> }
>
> fail() {
> - echo "FAIL: $*"
> - exit 1
> + ktap_test_fail "$*"
> + ktap_finished
> }
>
> pass() {
> - echo "PASS: $*"
> - exit 0
> + ktap_test_pass "$*"
> + ktap_finished
> }
>
> [ "$(id -u)" -eq 0 ] || skip "must run as root"
--
Thanks,
Usama
On 8/15/26 10:42, 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. > > skip() and fail() emit ktap_test_skip()/ktap_test_fail() instead of > ktap_skip_all()/ktap_exit_fail_msg(), and a single ktap_set_plan() at the > top covers every path; ktap_finished() then prints the totals line and > provides the exit code for skip/fail/pass alike. > > Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> > Reviewed-by: Breno Leitao <leitao@debian.org> > Signed-off-by: Song Hu <husong@kylinos.cn> > --- Reviewed-by: David Hildenbrand (Arm) <david@kernel.org> -- Cheers, David
© 2016 - 2026 Red Hat, Inc.