Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] selftests/mm: emit KTAP output from ksft_kmemleak_dedup
@ 2026-08-15  8:42 Song Hu
  2026-08-17  9:38 ` David Hildenbrand (Arm)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Song Hu @ 2026-08-15  8:42 UTC (permalink / raw)
  To: akpm, rppt, usama.anjum, leitao
  Cc: linux-mm, shuah, david, ljs, liam, vbabka, surenb, mhocko, peterx,
	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.

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] selftests/mm: emit KTAP output from ksft_kmemleak_dedup
  2026-08-15  8:42 [PATCH v2] selftests/mm: emit KTAP output from ksft_kmemleak_dedup Song Hu
@ 2026-08-17  9:38 ` David Hildenbrand (Arm)
  2026-08-17 10:23 ` Muhammad Usama Anjum
  2026-08-17 11:24 ` Lorenzo Stoakes (ARM)
  2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand (Arm) @ 2026-08-17  9:38 UTC (permalink / raw)
  To: Song Hu, akpm, rppt, usama.anjum, leitao
  Cc: linux-mm, shuah, ljs, liam, vbabka, surenb, mhocko, peterx,
	linux-kselftest, linux-kernel

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] selftests/mm: emit KTAP output from ksft_kmemleak_dedup
  2026-08-15  8:42 [PATCH v2] selftests/mm: emit KTAP output from ksft_kmemleak_dedup Song Hu
  2026-08-17  9:38 ` David Hildenbrand (Arm)
@ 2026-08-17 10:23 ` Muhammad Usama Anjum
  2026-08-17 11:24 ` Lorenzo Stoakes (ARM)
  2 siblings, 0 replies; 4+ messages in thread
From: Muhammad Usama Anjum @ 2026-08-17 10:23 UTC (permalink / raw)
  To: Song Hu, akpm, rppt, leitao
  Cc: usama.anjum, linux-mm, shuah, david, ljs, liam, vbabka, surenb,
	mhocko, peterx, linux-kselftest, linux-kernel

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] selftests/mm: emit KTAP output from ksft_kmemleak_dedup
  2026-08-15  8:42 [PATCH v2] selftests/mm: emit KTAP output from ksft_kmemleak_dedup Song Hu
  2026-08-17  9:38 ` David Hildenbrand (Arm)
  2026-08-17 10:23 ` Muhammad Usama Anjum
@ 2026-08-17 11:24 ` Lorenzo Stoakes (ARM)
  2 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-08-17 11:24 UTC (permalink / raw)
  To: Song Hu
  Cc: akpm, rppt, usama.anjum, leitao, linux-mm, shuah, david, liam,
	vbabka, surenb, mhocko, peterx, linux-kselftest, linux-kernel

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-17 11:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-15  8:42 [PATCH v2] selftests/mm: emit KTAP output from ksft_kmemleak_dedup Song Hu
2026-08-17  9:38 ` David Hildenbrand (Arm)
2026-08-17 10:23 ` Muhammad Usama Anjum
2026-08-17 11:24 ` Lorenzo Stoakes (ARM)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox