From: Usama Anjum <usama.anjum@arm.com>
To: Song Hu <husong@kylinos.cn>
Cc: usama.anjum@arm.com, shuah@kernel.org, david@kernel.org,
ljs@kernel.org, liam@infradead.org, vbabka@kernel.org,
rppt@kernel.org, surenb@google.com, mhocko@suse.com,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, akpm@linux-foundation.org
Subject: Re: [PATCH] selftests/mm: emit KTAP output from ksft_kmemleak_dedup
Date: Wed, 12 Aug 2026 17:35:22 +0100 [thread overview]
Message-ID: <4ef8b130-6c36-474e-904d-901c0d967c38@arm.com> (raw)
In-Reply-To: <20260812132142.582390-1-husong@kylinos.cn>
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"
prev parent reply other threads:[~2026-08-12 16:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 13:21 Song Hu
2026-08-12 13:46 ` Mike Rapoport
2026-08-12 16:34 ` Breno Leitao
2026-08-12 16:35 ` Usama Anjum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ef8b130-6c36-474e-904d-901c0d967c38@arm.com \
--to=usama.anjum@arm.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=husong@kylinos.cn \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®