File tree Expand file tree Collapse file tree 9 files changed +34
-21
lines changed Expand file tree Collapse file tree 9 files changed +34
-21
lines changed Original file line number Diff line number Diff line change @@ -766,8 +766,8 @@ int osnoise_hist_main(int argc, char *argv[])
766
766
struct osnoise_params * params ;
767
767
struct osnoise_tool * record = NULL ;
768
768
struct osnoise_tool * tool = NULL ;
769
+ enum result return_value = ERROR ;
769
770
struct trace_instance * trace ;
770
- int return_value = 1 ;
771
771
int retval ;
772
772
773
773
params = osnoise_hist_parse_args (argc , argv );
@@ -889,12 +889,13 @@ int osnoise_hist_main(int argc, char *argv[])
889
889
890
890
osnoise_print_stats (params , tool );
891
891
892
- return_value = 0 ;
892
+ return_value = PASSED ;
893
893
894
894
if (osnoise_trace_is_off (tool , record )) {
895
895
printf ("rtla osnoise hit stop tracing\n" );
896
896
save_trace_to_file (record ? record -> trace .inst : NULL ,
897
897
params -> trace_output );
898
+ return_value = FAILED ;
898
899
}
899
900
900
901
out_hist :
Original file line number Diff line number Diff line change @@ -594,8 +594,8 @@ int osnoise_top_main(int argc, char **argv)
594
594
struct osnoise_params * params ;
595
595
struct osnoise_tool * record = NULL ;
596
596
struct osnoise_tool * tool = NULL ;
597
+ enum result return_value = ERROR ;
597
598
struct trace_instance * trace ;
598
- int return_value = 1 ;
599
599
int retval ;
600
600
601
601
params = osnoise_top_parse_args (argc , argv );
@@ -715,12 +715,13 @@ int osnoise_top_main(int argc, char **argv)
715
715
716
716
osnoise_print_stats (params , tool );
717
717
718
- return_value = 0 ;
718
+ return_value = PASSED ;
719
719
720
720
if (osnoise_trace_is_off (tool , record )) {
721
721
printf ("osnoise hit stop tracing\n" );
722
722
save_trace_to_file (record ? record -> trace .inst : NULL ,
723
723
params -> trace_output );
724
+ return_value = FAILED ;
724
725
}
725
726
726
727
out_top :
Original file line number Diff line number Diff line change @@ -1141,11 +1141,11 @@ int timerlat_hist_main(int argc, char *argv[])
1141
1141
struct timerlat_params * params ;
1142
1142
struct osnoise_tool * record = NULL ;
1143
1143
struct timerlat_u_params params_u ;
1144
+ enum result return_value = ERROR ;
1144
1145
struct osnoise_tool * tool = NULL ;
1145
1146
struct osnoise_tool * aa = NULL ;
1146
1147
struct trace_instance * trace ;
1147
1148
int dma_latency_fd = -1 ;
1148
- int return_value = 1 ;
1149
1149
pthread_t timerlat_u ;
1150
1150
int retval ;
1151
1151
int nr_cpus , i ;
@@ -1378,7 +1378,7 @@ int timerlat_hist_main(int argc, char *argv[])
1378
1378
1379
1379
timerlat_print_stats (params , tool );
1380
1380
1381
- return_value = 0 ;
1381
+ return_value = PASSED ;
1382
1382
1383
1383
if (osnoise_trace_is_off (tool , record ) && !stop_tracing ) {
1384
1384
printf ("rtla timerlat hit stop tracing\n" );
@@ -1388,6 +1388,7 @@ int timerlat_hist_main(int argc, char *argv[])
1388
1388
1389
1389
save_trace_to_file (record ? record -> trace .inst : NULL ,
1390
1390
params -> trace_output );
1391
+ return_value = FAILED ;
1391
1392
}
1392
1393
1393
1394
out_hist :
Original file line number Diff line number Diff line change @@ -985,12 +985,12 @@ int timerlat_top_main(int argc, char *argv[])
985
985
struct timerlat_params * params ;
986
986
struct osnoise_tool * record = NULL ;
987
987
struct timerlat_u_params params_u ;
988
+ enum result return_value = ERROR ;
988
989
struct osnoise_tool * top = NULL ;
989
990
struct osnoise_tool * aa = NULL ;
990
991
struct trace_instance * trace ;
991
992
int dma_latency_fd = -1 ;
992
993
pthread_t timerlat_u ;
993
- int return_value = 1 ;
994
994
char * max_lat ;
995
995
int retval ;
996
996
int nr_cpus , i ;
@@ -1197,7 +1197,7 @@ int timerlat_top_main(int argc, char *argv[])
1197
1197
1198
1198
timerlat_print_stats (params , top );
1199
1199
1200
- return_value = 0 ;
1200
+ return_value = PASSED ;
1201
1201
1202
1202
if (osnoise_trace_is_off (top , record ) && !stop_tracing ) {
1203
1203
printf ("rtla timerlat hit stop tracing\n" );
@@ -1207,6 +1207,7 @@ int timerlat_top_main(int argc, char *argv[])
1207
1207
1208
1208
save_trace_to_file (record ? record -> trace .inst : NULL ,
1209
1209
params -> trace_output );
1210
+ return_value = FAILED ;
1210
1211
} else if (params -> aa_only ) {
1211
1212
/*
1212
1213
* If the trace did not stop with --aa-only, at least print the
Original file line number Diff line number Diff line change @@ -83,3 +83,9 @@ int auto_house_keeping(cpu_set_t *monitored_cpus);
83
83
84
84
#define ns_to_usf (x ) (((double)x/1000))
85
85
#define ns_to_per (total , part ) ((part * 100) / (double)total)
86
+
87
+ enum result {
88
+ PASSED = 0 , /* same as EXIT_SUCCESS */
89
+ ERROR = 1 , /* same as EXIT_FAILURE, an error in arguments */
90
+ FAILED = 2 , /* test hit the stop tracing condition */
91
+ };
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ reset_osnoise() {
39
39
}
40
40
41
41
check () {
42
+ expected_exitcode=${3:- 0}
42
43
# Simple check: run rtla with given arguments and test exit code.
43
44
# If TEST_COUNT is set, run the test. Otherwise, just count.
44
45
ctr=$(( $ctr + 1 ))
@@ -49,7 +50,7 @@ check() {
49
50
# Run rtla; in case of failure, include its output as comment
50
51
# in the test results.
51
52
result=$( stdbuf -oL $TIMEOUT " $RTLA " $2 2>&1 ) ; exitcode=$?
52
- if [ $exitcode -eq 0 ]
53
+ if [ $exitcode -eq $expected_exitcode ]
53
54
then
54
55
echo " ok $ctr - $1 "
55
56
else
@@ -68,12 +69,14 @@ check_with_osnoise_options() {
68
69
# Save original arguments
69
70
arg1=$1
70
71
arg2=$2
72
+ arg3=$3
71
73
72
74
# Apply osnoise options (if not dry run)
73
75
if [ -n " $TEST_COUNT " ]
74
76
then
75
77
[ " $NO_RESET_OSNOISE " == 1 ] || reset_osnoise
76
78
shift
79
+ shift
77
80
while shift
78
81
do
79
82
[ " $1 " == " " ] && continue
@@ -84,7 +87,7 @@ check_with_osnoise_options() {
84
87
done
85
88
fi
86
89
87
- NO_RESET_OSNOISE=1 check " $arg1 " " $arg2 "
90
+ NO_RESET_OSNOISE=1 check " $arg1 " " $arg2 " " $arg3 "
88
91
}
89
92
90
93
set_timeout () {
Original file line number Diff line number Diff line change @@ -10,11 +10,11 @@ check "verify help page" \
10
10
check " detect noise higher than one microsecond" \
11
11
" hwnoise -c 0 -T 1 -d 5s -q"
12
12
check " set the automatic trace mode" \
13
- " hwnoise -a 5 -d 30s"
13
+ " hwnoise -a 5 -d 30s" 2
14
14
check " set scheduling param to the osnoise tracer threads" \
15
15
" hwnoise -P F:1 -c 0 -r 900000 -d 1M -q"
16
16
check " stop the trace if a single sample is higher than 1 us" \
17
- " hwnoise -s 1 -T 1 -t -d 30s"
17
+ " hwnoise -s 1 -T 1 -t -d 30s" 2
18
18
check " enable a trace event trigger" \
19
19
" hwnoise -t -e osnoise:irq_noise trigger=\" hist:key=desc,duration:sort=desc,duration:vals=hitcount\" -d 1m"
20
20
Original file line number Diff line number Diff line change @@ -10,16 +10,16 @@ check "verify help page" \
10
10
check " verify the --priority/-P param" \
11
11
" osnoise top -P F:1 -c 0 -r 900000 -d 1M -q"
12
12
check " verify the --stop/-s param" \
13
- " osnoise top -s 30 -T 1 -t"
13
+ " osnoise top -s 30 -T 1 -t" 2
14
14
check " verify the --trace param" \
15
- " osnoise hist -s 30 -T 1 -t"
15
+ " osnoise hist -s 30 -T 1 -t" 2
16
16
check " verify the --entries/-E param" \
17
17
" osnoise hist -P F:1 -c 0 -r 900000 -d 1M -b 10 -E 25"
18
18
19
19
# Test setting default period by putting an absurdly high period
20
20
# and stopping on threshold.
21
21
# If default period is not set, this will time out.
22
22
check_with_osnoise_options " apply default period" \
23
- " osnoise hist -s 1" period_us=600000000
23
+ " osnoise hist -s 1" 2 period_us=600000000
24
24
25
25
test_end
Original file line number Diff line number Diff line change @@ -21,21 +21,21 @@ export RTLA_NO_BPF=$option
21
21
check " verify help page" \
22
22
" timerlat --help"
23
23
check " verify -s/--stack" \
24
- " timerlat top -s 3 -T 10 -t"
24
+ " timerlat top -s 3 -T 10 -t" 2
25
25
check " verify -P/--priority" \
26
26
" timerlat top -P F:1 -c 0 -d 1M -q"
27
27
check " test in nanoseconds" \
28
- " timerlat top -i 2 -c 0 -n -d 30s"
28
+ " timerlat top -i 2 -c 0 -n -d 30s" 2
29
29
check " set the automatic trace mode" \
30
- " timerlat top -a 5 --dump-tasks"
30
+ " timerlat top -a 5 --dump-tasks" 2
31
31
check " print the auto-analysis if hits the stop tracing condition" \
32
- " timerlat top --aa-only 5"
32
+ " timerlat top --aa-only 5" 2
33
33
check " disable auto-analysis" \
34
- " timerlat top -s 3 -T 10 -t --no-aa"
34
+ " timerlat top -s 3 -T 10 -t --no-aa" 2
35
35
check " verify -c/--cpus" \
36
36
" timerlat hist -c 0 -d 30s"
37
37
check " hist test in nanoseconds" \
38
- " timerlat hist -i 2 -c 0 -n -d 30s"
38
+ " timerlat hist -i 2 -c 0 -n -d 30s" 2
39
39
done
40
40
41
41
test_end
You can’t perform that action at this time.
0 commit comments