From: Hangbin Liu <liuhangbin@gmail.com>
To: Brendan Jackman <jackmanb@google.com>
Cc: linux-kselftest@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH selftests] selftests: Use ktap helpers for runner.sh
Date: Fri, 6 Feb 2026 14:36:38 +0000 [thread overview]
Message-ID: <aYX8dot4fTh3FJFI@fedora> (raw)
In-Reply-To: <DG7TJFKZNG1J.19BZF87IWD3UG@google.com>
Hi Brendan,
On Fri, Feb 06, 2026 at 10:48:59AM +0000, Brendan Jackman wrote:
> On Fri Feb 6, 2026 at 8:17 AM UTC, Hangbin Liu wrote:
> > This has been on my todo list for a long time. We should use ktap
> > helpers in runner.sh. I saw Brendan did some work in d9e6269e3303
> > ("selftests/run_kselftest.sh: exit with error if tests fail") to make
> > run_kselftest.sh exit with the correct return value. But we still use a
> > custom solution in runner.sh. Let's convert all the print messages to use
> > formal ktap helpers. Here’s what I changed:
> >
> > 1. Move TAP header from runner.sh to run_kselftest.sh, since run_kselftest.sh
> > is the only caller of run_many().
> > 2. In run_kselftest.sh, call run_many() in main process to count the
> > pass/fail numbers.
> > 3. In run_kselftest.sh, do not generate kselftest_failures_file; just
> > use ktap_print_totals to report the result.
> > 4. In runner.sh run_one(), get the return value and use ktap helpers for
> > all pass/fail reporting. This allows counting pass/fail numbers in the
> > main process.
> > 5. In runner.sh run_in_netns(), also return the correct rc, so we can
> > count results during wait.
> >
> > After the change, the printed result looks like:
> >
> > not ok 4 4 selftests: clone3: clone3_cap_checkpoint_restore # exit=1
> > # Totals: pass:3 fail:1 xfail:0 xpass:0 skip:0 error:0
> >
> > ]# echo $?
> > 1
>
> Sorry I'm being a bit lazy by not investigating this myself but the
> current intended behaviour is for runner.sh to output correct KTAP,
> right? Could you describe what behavioural changes this is expected to
For runner.sh, I just want to make it using the formal helper in
ktap_helpers.sh other than manually echo.
> bring - does it fix/change the KTAP output? (Or if it's just a cleanup
> with no intended change then please note that in the commit message).
It changes the run_kselftest.sh's output, with a total result. e.g.
# Totals: pass:3 fail:1 xfail:0 xpass:0 skip:0 error:0
>
> I have not reviewed the code properly yet (I just read enough to check
> that it still does the thing I care about i.e. return an error code when
> something fails). I can do a proper review next week if you add a bit
> more context re the question above though.
Yes, I also care about the return code. This patch doesn't break it.
>
> > - wait
> > + # Handle the return values when running in netns.
> > + for pid in "${pids[@]}"; do
> > + wait "$pid"
> > + rc=$?
> > + [ "$rc" -eq "$KSFT_PASS" ] && KTAP_CNT_PASS=$((KTAP_CNT_PASS+1))
> > + [ "$rc" -eq "$KSFT_FAIL" ] && KTAP_CNT_FAIL=$((KTAP_CNT_FAIL+1))
> > + [ "$rc" -eq "$KSFT_SKIP" ] && KTAP_CNT_SKIP=$((KTAP_CNT_SKIP+1))
> > + [ "$rc" -eq "$KSFT_XFAIL" ] && KTAP_CNT_XFAIL=$((KTAP_CNT_XFAIL+1))
>
> These variables don't seeem to have anything to do with KTAP so I think
> they should have a different name prefix. I guess KSFT_*? Or maybe
> RUNNER_* or something.
>
> Also I guess we should initialise them to 0 so they are still set if no
> tests actually get run?
>
> Also I think it's probably time to start documenting the
> interface of runner.sh - sorry I probably should have done this when I
> created kselftest_failures_file. Can you add a comment at the top to
> show that these variables are part of the "API"?
These variables are defined in ktap_helpers.sh and used by the ktap helpers.
Thanks
Hangbin
next prev parent reply other threads:[~2026-02-06 14:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 8:17 [PATCH selftests] selftests: Use ktap helpers for runner.sh Hangbin Liu
2026-02-06 10:48 ` Brendan Jackman
2026-02-06 14:36 ` Hangbin Liu [this message]
2026-02-23 12:40 ` Brendan Jackman
2026-02-24 3:42 ` Hangbin Liu
2026-02-23 1:57 ` Hangbin Liu
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=aYX8dot4fTh3FJFI@fedora \
--to=liuhangbin@gmail.com \
--cc=jackmanb@google.com \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shuah@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.