Skip to content

Commit 4e26f84

Browse files
lenticularis39rostedt
authored andcommitted
rtla/tests: Add tests for actions
Add a bunch of tests covering most of both --on-threshold and --on-end. Parts sensitive to implementation of hist/top are tested for both. Cc: John Kacur <[email protected]> Cc: Luis Goncalves <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Chang Yin <[email protected]> Cc: Costa Shulyupin <[email protected]> Cc: Crystal Wood <[email protected]> Cc: Gabriele Monaco <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Tomas Glozar <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 916a9c5 commit 4e26f84

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tools/tracing/rtla/tests/timerlat.t

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ fi
1818
for option in $no_bpf_options
1919
do
2020
export RTLA_NO_BPF=$option
21+
22+
# Basic tests
2123
check "verify help page" \
2224
"timerlat --help"
2325
check "verify -s/--stack" \
@@ -36,6 +38,32 @@ check "verify -c/--cpus" \
3638
"timerlat hist -c 0 -d 30s"
3739
check "hist test in nanoseconds" \
3840
"timerlat hist -i 2 -c 0 -n -d 30s" 2
41+
42+
# Actions tests
43+
check "trace output through -t" \
44+
"timerlat hist -T 2 -t" 2 "^ Saving trace to timerlat_trace.txt$"
45+
check "trace output through -t with custom filename" \
46+
"timerlat hist -T 2 -t custom_filename.txt" 2 "^ Saving trace to custom_filename.txt$"
47+
check "trace output through -A trace" \
48+
"timerlat hist -T 2 --on-threshold trace" 2 "^ Saving trace to timerlat_trace.txt$"
49+
check "trace output through -A trace with custom filename" \
50+
"timerlat hist -T 2 --on-threshold trace,file=custom_filename.txt" 2 "^ Saving trace to custom_filename.txt$"
51+
check "exec command" \
52+
"timerlat hist -T 2 --on-threshold shell,command='echo TestOutput'" 2 "^TestOutput$"
53+
check "multiple actions" \
54+
"timerlat hist -T 2 --on-threshold shell,command='echo -n 1' --on-threshold shell,command='echo 2'" 2 "^12$"
55+
check "hist stop at failed action" \
56+
"timerlat hist -T 2 --on-threshold shell,command='echo -n 1; false' --on-threshold shell,command='echo -n 2'" 2 "^1# RTLA timerlat histogram$"
57+
check "top stop at failed action" \
58+
"timerlat top -T 2 --on-threshold shell,command='echo -n 1; false' --on-threshold shell,command='echo -n 2'" 2 "^1ALL"
59+
check "hist with continue" \
60+
"timerlat hist -T 2 -d 1s --on-threshold shell,command='echo TestOutput' --on-threshold continue" 0 "^TestOutput$"
61+
check "top with continue" \
62+
"timerlat top -q -T 2 -d 1s --on-threshold shell,command='echo TestOutput' --on-threshold continue" 0 "^TestOutput$"
63+
check "hist with trace output at end" \
64+
"timerlat hist -d 1s --on-end trace" 0 "^ Saving trace to timerlat_trace.txt$"
65+
check "top with trace output at end" \
66+
"timerlat top -d 1s --on-end trace" 0 "^ Saving trace to timerlat_trace.txt$"
3967
done
4068

4169
test_end

0 commit comments

Comments
 (0)