Re: [PATCH v2] selftests/mm: emit KTAP output from ksft_kmemleak_dedup

"Lorenzo Stoakes (ARM)" <[email protected]>
Newsgroups org.kernel.vger.linux-kselftest,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <aoLvf6jyaQaYDixW@lucifer>
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) <[email protected]>
> Reviewed-by: Breno Leitao <[email protected]>
> Signed-off-by: Song Hu <[email protected]>

LGTM so:

Reviewed-by: Lorenzo Stoakes (ARM) <[email protected]>

> ---
>
> 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/[email protected]/
>  .../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 <[email protected]>
>
> -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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.