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) <[email protected]>
> Reviewed-by: Breno Leitao <[email protected]>
> Signed-off-by: Song Hu <[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
Thank you for updating the patch.

Tested-by: Muhammad Usama Anjum <[email protected]>
Reviewed-by: Muhammad Usma Anjum <[email protected]>

> 
> 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"

-- 
Thanks,
Usama


Reply via email to