* [PATCH 0/2] rtla: Add tests for option parsing with attached arguments
@ 2026-06-02 15:52 John Kacur
2026-06-02 15:52 ` [PATCH 1/2] rtla/timerlat: " John Kacur
2026-06-02 15:52 ` [PATCH 2/2] rtla: " John Kacur
0 siblings, 2 replies; 3+ messages in thread
From: John Kacur @ 2026-06-02 15:52 UTC (permalink / raw)
To: linux-trace-kernel; +Cc: Steven Rostedt, Tomas Glozar, linux-kernel
This patch series adds comprehensive tests to verify that short options
with attached numeric arguments (e.g., -p100) work correctly across all
rtla commands.
These tests complement Tomas Glozar's fix "rtla: Fix parsing of
multi-character short options" which resolves the issue where options
like -p100 were incorrectly parsed as multiple separate options due to
getopt_long() being called twice.
The tests verify four option formats for each command:
-p 100 (short with space)
-p100 (short attached - previously broken)
--period=100 (long with equals)
--period 100 (long with space)
Commands tested:
- timerlat hist and top
- osnoise hist and top
- hwnoise
All 20 tests pass with Tomas's fix applied, confirming the issue is
resolved and preventing future regressions. These tests will continue to
work when rtla transitions to libsubcmd in the future, ensuring this
functionality remains correct across parsing implementations.
Note: Patch 1/2 is a resend of the timerlat hist tests sent previously.
Patch 2/2 adds tests for the remaining rtla commands.
Signed-off-by: John Kacur <jkacur@redhat.com>
John Kacur (2):
rtla/timerlat: Add tests for option parsing with attached arguments
rtla: Add tests for option parsing with attached arguments
tools/tracing/rtla/tests/hwnoise.t | 10 ++++++++++
tools/tracing/rtla/tests/osnoise.t | 18 ++++++++++++++++++
tools/tracing/rtla/tests/timerlat.t | 18 ++++++++++++++++++
3 files changed, 46 insertions(+)
--
2.54.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] rtla/timerlat: Add tests for option parsing with attached arguments
2026-06-02 15:52 [PATCH 0/2] rtla: Add tests for option parsing with attached arguments John Kacur
@ 2026-06-02 15:52 ` John Kacur
2026-06-02 15:52 ` [PATCH 2/2] rtla: " John Kacur
1 sibling, 0 replies; 3+ messages in thread
From: John Kacur @ 2026-06-02 15:52 UTC (permalink / raw)
To: linux-trace-kernel; +Cc: Steven Rostedt, Tomas Glozar, linux-kernel
Add tests to verify that numeric arguments work correctly with both
attached and detached formats:
-p 100 (short with space)
-p100 (short without space)
--period=100 (long with =)
--period 100 (long with space)
These tests prevent regression of the bug fixed in commit eefa8af46ff7
("rtla/timerlat: Fix parsing of short options with attached arguments")
where -p100 was incorrectly parsed as multiple separate options.
The tests verify that:
1. All four argument formats succeed (exit code 0)
2. None trigger the "no-irq and no-thread" error that occurred when
the bug was present
Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: John Kacur <jkacur@redhat.com>
---
tools/tracing/rtla/tests/timerlat.t | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/tracing/rtla/tests/timerlat.t b/tools/tracing/rtla/tests/timerlat.t
index fd4935fd7b49..1a63301f5d70 100644
--- a/tools/tracing/rtla/tests/timerlat.t
+++ b/tools/tracing/rtla/tests/timerlat.t
@@ -42,6 +42,16 @@ check "verify -c/--cpus" \
check "hist test in nanoseconds" \
"timerlat hist -i 2 -c 0 -n -d 10s" 2 "ns"
+# Option parsing tests - verify attached numeric arguments work correctly
+check "verify -p with space" \
+ "timerlat hist -p 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify -p without space (attached argument)" \
+ "timerlat hist -p100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify --period with equals" \
+ "timerlat hist --period=100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify --period with space" \
+ "timerlat hist --period 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+
# Actions tests
check "trace output through -t" \
"timerlat hist -T 2 -t" 2 "^ Saving trace to timerlat_trace.txt$"
--
2.54.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] rtla: Add tests for option parsing with attached arguments
2026-06-02 15:52 [PATCH 0/2] rtla: Add tests for option parsing with attached arguments John Kacur
2026-06-02 15:52 ` [PATCH 1/2] rtla/timerlat: " John Kacur
@ 2026-06-02 15:52 ` John Kacur
1 sibling, 0 replies; 3+ messages in thread
From: John Kacur @ 2026-06-02 15:52 UTC (permalink / raw)
To: linux-trace-kernel; +Cc: Steven Rostedt, Tomas Glozar, linux-kernel
Add tests to verify that short options with attached numeric arguments
work correctly for all rtla commands after the parsing fixes.
Tests verify four formats for each command:
- Short option with space: -p 100
- Short option attached: -p100
- Long option with equals: --period=100
- Long option with space: --period 100
For osnoise and hwnoise commands, the tests also include -r 100 (runtime)
to satisfy the osnoise constraint that runtime <= period.
These tests complement the existing timerlat hist tests added in commit
d489b602c669 ("rtla/timerlat: Add tests for option parsing with attached
arguments").
Assisted-by: Claude:claude-sonnet-4-5
Signed-off-by: John Kacur <jkacur@redhat.com>
---
tools/tracing/rtla/tests/hwnoise.t | 10 ++++++++++
tools/tracing/rtla/tests/osnoise.t | 18 ++++++++++++++++++
tools/tracing/rtla/tests/timerlat.t | 8 ++++++++
3 files changed, 36 insertions(+)
diff --git a/tools/tracing/rtla/tests/hwnoise.t b/tools/tracing/rtla/tests/hwnoise.t
index 23ce250a6852..c61f02bc42fe 100644
--- a/tools/tracing/rtla/tests/hwnoise.t
+++ b/tools/tracing/rtla/tests/hwnoise.t
@@ -19,4 +19,14 @@ check "enable a trace event trigger" \
"hwnoise -t -e osnoise:irq_noise --trigger=\"hist:key=desc,duration:sort=desc,duration:vals=hitcount\" -d 10s" \
0 "Saving event osnoise:irq_noise hist to osnoise_irq_noise_hist.txt"
+# Option parsing tests - verify attached numeric arguments work correctly
+check "verify -p with space" \
+ "hwnoise -p 100 -r 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify -p without space (attached argument)" \
+ "hwnoise -p100 -r 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify --period with equals" \
+ "hwnoise --period=100 -r 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify --period with space" \
+ "hwnoise --period 100 -r 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+
test_end
diff --git a/tools/tracing/rtla/tests/osnoise.t b/tools/tracing/rtla/tests/osnoise.t
index 396334608920..1807236431df 100644
--- a/tools/tracing/rtla/tests/osnoise.t
+++ b/tools/tracing/rtla/tests/osnoise.t
@@ -17,6 +17,24 @@ check "verify the --trace param" \
check "verify the --entries/-E param" \
"osnoise hist -P F:1 -c 0 -r 900000 -d 10s -b 10 -E 25"
+# Option parsing tests - verify attached numeric arguments work correctly
+check "verify -p with space" \
+ "osnoise hist -p 100 -r 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify -p without space (attached argument)" \
+ "osnoise hist -p100 -r 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify --period with equals" \
+ "osnoise hist --period=100 -r 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify --period with space" \
+ "osnoise hist --period 100 -r 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify osnoise top -p with space" \
+ "osnoise top -p 100 -r 100 -c 0 -d 1s -q" 0 "" "no-irq and no-thread"
+check "verify osnoise top -p without space (attached argument)" \
+ "osnoise top -p100 -r 100 -c 0 -d 1s -q" 0 "" "no-irq and no-thread"
+check "verify osnoise top --period with equals" \
+ "osnoise top --period=100 -r 100 -c 0 -d 1s -q" 0 "" "no-irq and no-thread"
+check "verify osnoise top --period with space" \
+ "osnoise top --period 100 -r 100 -c 0 -d 1s -q" 0 "" "no-irq and no-thread"
+
# Test setting default period by putting an absurdly high period
# and stopping on threshold.
# If default period is not set, this will time out.
diff --git a/tools/tracing/rtla/tests/timerlat.t b/tools/tracing/rtla/tests/timerlat.t
index 1a63301f5d70..506227412027 100644
--- a/tools/tracing/rtla/tests/timerlat.t
+++ b/tools/tracing/rtla/tests/timerlat.t
@@ -51,6 +51,14 @@ check "verify --period with equals" \
"timerlat hist --period=100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
check "verify --period with space" \
"timerlat hist --period 100 -c 0 -d 1s" 0 "" "no-irq and no-thread"
+check "verify timerlat top -p with space" \
+ "timerlat top -p 100 -c 0 -d 1s -q" 0 "" "no-irq and no-thread"
+check "verify timerlat top -p without space (attached argument)" \
+ "timerlat top -p100 -c 0 -d 1s -q" 0 "" "no-irq and no-thread"
+check "verify timerlat top --period with equals" \
+ "timerlat top --period=100 -c 0 -d 1s -q" 0 "" "no-irq and no-thread"
+check "verify timerlat top --period with space" \
+ "timerlat top --period 100 -c 0 -d 1s -q" 0 "" "no-irq and no-thread"
# Actions tests
check "trace output through -t" \
--
2.54.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-02 15:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 15:52 [PATCH 0/2] rtla: Add tests for option parsing with attached arguments John Kacur
2026-06-02 15:52 ` [PATCH 1/2] rtla/timerlat: " John Kacur
2026-06-02 15:52 ` [PATCH 2/2] rtla: " John Kacur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox