summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTomas Glozar <tglozar@redhat.com>2025-03-20 10:24:59 +0100
committerSteven Rostedt (Google) <rostedt@goodmis.org>2025-03-26 10:36:39 -0400
commit6c6182728a9bb02b0a973775869c9a0ceddd9658 (patch)
tree06dcec4016295dd660fb0ff150637ce3f97c56d4 /tools
parent0122938a7ab49b531b71602584da524ffebdd2f9 (diff)
downloadlinux-6c6182728a9bb02b0a973775869c9a0ceddd9658.tar.gz
linux-6c6182728a9bb02b0a973775869c9a0ceddd9658.tar.bz2
linux-6c6182728a9bb02b0a973775869c9a0ceddd9658.zip
rtla/tests: Reset osnoise options before check
Remove any dangling tracing instances from previous improperly exited runs of rtla, and reset osnoise options to default before running a test case. This ensures that the test results are deterministic. Specific test cases checked that rtla behaves correctly even when the tracer state is not clean will be added later. Cc: John Kacur <jkacur@redhat.com> Cc: Luis Goncalves <lgoncalv@redhat.com> Link: https://lore.kernel.org/20250320092500.101385-6-tglozar@redhat.com Signed-off-by: Tomas Glozar <tglozar@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/tracing/rtla/tests/engine.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/tracing/rtla/tests/engine.sh b/tools/tracing/rtla/tests/engine.sh
index 64d0446dc28e..5db8aa4bc031 100644
--- a/tools/tracing/rtla/tests/engine.sh
+++ b/tools/tracing/rtla/tests/engine.sh
@@ -8,12 +8,44 @@ test_begin() {
[ -n "$TEST_COUNT" ] && echo "1..$TEST_COUNT"
}
+reset_osnoise() {
+ # Reset osnoise options to default and remove any dangling instances created
+ # by improperly exited rtla runs.
+ pushd /sys/kernel/tracing || return 1
+
+ # Remove dangling instances created by previous rtla run
+ echo 0 > tracing_thresh
+ cd instances
+ for i in osnoise_top osnoise_hist timerlat_top timerlat_hist
+ do
+ [ ! -d "$i" ] && continue
+ rmdir "$i"
+ done
+
+ # Reset options to default
+ # Note: those are copied from the default values of osnoise_data
+ # in kernel/trace/trace_osnoise.c
+ cd ../osnoise
+ echo all > cpus
+ echo DEFAULTS > options
+ echo 1000000 > period_us
+ echo 0 > print_stack
+ echo 1000000 > runtime_us
+ echo 0 > stop_tracing_total_us
+ echo 0 > stop_tracing_us
+ echo 1000 > timerlat_period_us
+
+ popd
+}
+
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
+ # Reset osnoise options before running test.
+ [ "$NO_RESET_OSNOISE" == 1 ] || reset_osnoise
# Run rtla; in case of failure, include its output as comment
# in the test results.
result=$(stdbuf -oL $TIMEOUT "$RTLA" $2 2>&1); exitcode=$?
@@ -37,6 +69,14 @@ unset_timeout() {
unset TIMEOUT
}
+set_no_reset_osnoise() {
+ NO_RESET_OSNOISE=1
+}
+
+unset_no_reset_osnoise() {
+ unset NO_RESET_OSNOISE
+}
+
test_end() {
# If running without TEST_COUNT, tests are not actually run, just
# counted. In that case, re-run the test with the correct count.