From: Crystal Wood <crwood@redhat.com>
To: Tomas Glozar <tglozar@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
linux-trace-kernel@vger.kernel.org,
John Kacur <jkacur@redhat.com>,
Costa Shulyupin <costa.shul@redhat.com>,
Wander Lairson Costa <wander@redhat.com>,
Crystal Wood <crwood@redhat.com>
Subject: [PATCH 3/3] rtla/tests: Add $SUBTESTS and $STOPONFAIL
Date: Sat, 19 Sep 2026 01:27:56 -0500 [thread overview]
Message-ID: <20260919062756.819701-4-crwood@redhat.com> (raw)
In-Reply-To: <20260919062756.819701-1-crwood@redhat.com>
Give the user more control over the test execution when the test scripts
are run directly (not through prove), in order to do things like run a
particular test repeatedly to diagnose an intermittent failure.
If $SUBTESTS is provided, then only tests whose number is on the list will
run. For example:
# SUBTESTS="14 133 4 $(seq 98 103) 9" bash ./tests/timerlat.t
1..150
ok 4 - top verify -s/--stack
ok 9 - hist set the automatic trace mode
ok 14 - top disable auto-analysis
ok 98 - hist verify -H/--house-keeping
ok 99 - top verify -k/--kernel-threads
ok 100 - hist verify -k/--kernel-threads
ok 101 - top verify -u/--user-threads
ok 102 - hist verify -u/--user-threads
ok 103 - apply default timerlat_period_us
ok 133 - top trace output through --on-threshold trace
If $STOPONFAIL is set, then the script will exit with a non-zero exit code
on the first failure. If the output directory is non-empty, it will be
preserved, and the location shown.
Signed-off-by: Crystal Wood <crwood@redhat.com>
---
tools/tracing/rtla/tests/engine.sh | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/tools/tracing/rtla/tests/engine.sh b/tools/tracing/rtla/tests/engine.sh
index ab4fa0a8ded7..395b472921a7 100644
--- a/tools/tracing/rtla/tests/engine.sh
+++ b/tools/tracing/rtla/tests/engine.sh
@@ -9,6 +9,12 @@ test_begin() {
testdir=$(dirname "$scriptfile")
[ -z "$RTLA" ] && RTLA="$(pwd)/rtla"
[ -n "$TEST_COUNT" ] && echo "1..$TEST_COUNT"
+
+ # Convert newlines to spaces so that seq can be used
+ unset subtests
+ if [ -n "$SUBTESTS" ]; then
+ subtests=$(echo "$SUBTESTS"|tr '\n' ' ')
+ fi
}
reset_osnoise() {
@@ -50,8 +56,7 @@ check() {
# Simple check: run rtla with given arguments and test exit code.
# If TEST_COUNT is set, run the test. Otherwise, just count.
ctr=$(($ctr + 1))
- if [ -n "$TEST_COUNT" ]
- then
+ if [[ -n "$TEST_COUNT" && ( -z "$subtests" || " $subtests " == *" $ctr "* ) ]]; then
# Reset osnoise options before running test.
[ "$NO_RESET_OSNOISE" == 1 ] || reset_osnoise
@@ -62,6 +67,7 @@ check() {
# Run rtla; in case of failure, include its output as comment
# in the test results.
result=$(eval stdbuf -oL $TIMEOUT "$RTLA" $2 2>&1); exitcode=$?
+ popd >/dev/null
failbuf=''
fail=0
@@ -90,10 +96,18 @@ check() {
echo -n "$failbuf"
echo "$result" | col -b | while read line; do echo "# $line"; done
printf "#\n# exit code %s\n" $exitcode
+
+ if [ -n "$STOPONFAIL" ]; then
+ # If the directory is not empty, tell the user where
+ # to find the output
+ if ! rmdir $tmpdir; then
+ echo "# output dir: $tmpdir"
+ fi
+ exit 1
+ fi
fi
# Remove temporary directory
- popd >/dev/null
rm -r $tmpdir
fi
}
--
2.54.0
prev parent reply other threads:[~2026-09-19 6:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 6:27 [PATCH 0/3] rtla/tests: Debugging improvements Crystal Wood
2026-09-19 6:27 ` [PATCH 1/3] rtla/tests: Use absolute path for $RTLA Crystal Wood
2026-09-19 6:27 ` [PATCH 2/3] rtla/tests: Show the command line for failing tests Crystal Wood
2026-09-19 6:27 ` Crystal Wood [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=20260919062756.819701-4-crwood@redhat.com \
--to=crwood@redhat.com \
--cc=costa.shul@redhat.com \
--cc=jkacur@redhat.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglozar@redhat.com \
--cc=wander@redhat.com \
/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