Debian Codegraph @

tools/tracing/rtla/tests/osnoise.t

raw
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 source tests/engine.sh
4 test_begin
5
6 set_timeout 2m
7
8 check "verify help page" \
9 "osnoise --help" 0 "osnoise version"
10 check "verify the --priority/-P param" \
11 "osnoise top -P F:1 -c 0 -r 900000 -d 10s -q -S 1 --on-threshold shell,command=\"tests/scripts/check-priority.sh osnoise/ SCHED_FIFO 1\"" \
12 2 "Priorities are set correctly"
13 check "verify the --stop/-s param" \
14 "osnoise top -s 30 -T 1" 2 "osnoise hit stop tracing"
15 check "verify the --trace param" \
16 "osnoise hist -s 30 -T 1 -t" 2 "Saving trace to osnoise_trace.txt"
17 check "verify the --entries/-E param" \
18 "osnoise hist -P F:1 -c 0 -r 900000 -d 10s -b 10 -E 25"
19
20 # Test setting default period by putting an absurdly high period
21 # and stopping on threshold.
22 # If default period is not set, this will time out.
23 check_with_osnoise_options "apply default period" \
24 "osnoise hist -s 1" 2 period_us=600000000
25
26 # Actions tests
27 check "trace output through -t with custom filename" \
28 "osnoise hist -S 2 -t custom_filename.txt" 2 "^ Saving trace to custom_filename.txt$"
29 check "trace output through --on-threshold trace" \
30 "osnoise hist -S 2 --on-threshold trace" 2 "^ Saving trace to osnoise_trace.txt$"
31 check "trace output through --on-threshold trace with custom filename" \
32 "osnoise hist -S 2 --on-threshold trace,file=custom_filename.txt" 2 "^ Saving trace to custom_filename.txt$"
33 check "exec command" \
34 "osnoise hist -S 2 --on-threshold shell,command='echo TestOutput'" 2 "^TestOutput$"
35 check "multiple actions" \
36 "osnoise hist -S 2 --on-threshold shell,command='echo -n 1' --on-threshold shell,command='echo 2'" 2 "^12$"
37 check "hist stop at failed action" \
38 "osnoise hist -S 2 --on-threshold shell,command='echo -n 1; false' --on-threshold shell,command='echo -n 2'" 2 "^1# RTLA osnoise histogram$"
39 check "top stop at failed action" \
40 "osnoise top -S 2 --on-threshold shell,command='echo -n abc; false' --on-threshold shell,command='echo -n defgh'" 2 "^abc" "defgh"
41 check "hist with continue" \
42 "osnoise hist -S 2 -d 5s --on-threshold shell,command='echo TestOutput' --on-threshold continue" 0 "^TestOutput$"
43 check "top with continue" \
44 "osnoise top -q -S 2 -d 5s --on-threshold shell,command='echo TestOutput' --on-threshold continue" 0 "^TestOutput$"
45 check "hist with trace output at end" \
46 "osnoise hist -d 1s --on-end trace" 0 "^ Saving trace to osnoise_trace.txt$"
47 check "top with trace output at end" \
48 "osnoise top -d 1s --on-end trace" 0 "^ Saving trace to osnoise_trace.txt$"
49
50 test_end