Re: [PATCH 0/3] selftests: add option to print the time spent per test

From: Shuah Khan

Date: Wed Nov 18 2026 - 11:15:46 EST


On 11/18/26 06:40, Jori Koolstra (CIQ) wrote:
For CI/CD purposes it is useful to know how much time each selftest
took to complete, for instance, to know which suites to run for a
quick-fail diagnostic, or what percentage of tests you can expect to
complete on a paricular --override-timeout value.

Add a -T/--timed option to run_kselftest.sh. When it is set, run_one()
prints a KTAP diagnostic line with the elapsed wall-clock time just
before the result line of each test that is actually run, e.g.:

# selftests: timers: nanosleep
# time: 12.34s
ok 3 selftests: timers: nanosleep

The other two patches clean up the use of 'local' in runner.sh and fix a
bug when using --netns in run_kselftest.sh. Strictly these could be sent
as separate patches, but "selftests: add option to print the time spent
per test" builds on these, and it would otherwise require needless
rebasing for two small fixes.

Signed-off-by: Jori Koolstra (CIQ) <jkoolstra@xxxxxxxxx>
---
Jori Koolstra (CIQ) (3):
selftests: use local variables consistently in runner.sh

Please spilt the convention related changes and real changes.

selftests: pass the timeout override to tests run in a netns
selftests: add option to print the time spent per test

These two look good to me. I will pull them all as a series once you
fix the problem with patch 1/3


tools/testing/selftests/kselftest/runner.sh | 50 ++++++++++++++++++++++-------
tools/testing/selftests/run_kselftest.sh | 8 +++++
2 files changed, 47 insertions(+), 11 deletions(-)
---
base-commit: 666539eecdf4db623f5e3c3e55cf9f2dfad24aa4
change-id: 20261117-kselftest-run-timer-df3ac531652e

Best regards,

thanks,
-- Shuah