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[])
766766 struct osnoise_params * params ;
767767 struct osnoise_tool * record = NULL ;
768768 struct osnoise_tool * tool = NULL ;
769+ enum result return_value = ERROR ;
769770 struct trace_instance * trace ;
770- int return_value = 1 ;
771771 int retval ;
772772
773773 params = osnoise_hist_parse_args (argc , argv );
@@ -889,12 +889,13 @@ int osnoise_hist_main(int argc, char *argv[])
889889
890890 osnoise_print_stats (params , tool );
891891
892- return_value = 0 ;
892+ return_value = PASSED ;
893893
894894 if (osnoise_trace_is_off (tool , record )) {
895895 printf ("rtla osnoise hit stop tracing\n" );
896896 save_trace_to_file (record ? record -> trace .inst : NULL ,
897897 params -> trace_output );
898+ return_value = FAILED ;
898899 }
899900
900901out_hist :
Original file line number Diff line number Diff line change @@ -594,8 +594,8 @@ int osnoise_top_main(int argc, char **argv)
594594 struct osnoise_params * params ;
595595 struct osnoise_tool * record = NULL ;
596596 struct osnoise_tool * tool = NULL ;
597+ enum result return_value = ERROR ;
597598 struct trace_instance * trace ;
598- int return_value = 1 ;
599599 int retval ;
600600
601601 params = osnoise_top_parse_args (argc , argv );
@@ -715,12 +715,13 @@ int osnoise_top_main(int argc, char **argv)
715715
716716 osnoise_print_stats (params , tool );
717717
718- return_value = 0 ;
718+ return_value = PASSED ;
719719
720720 if (osnoise_trace_is_off (tool , record )) {
721721 printf ("osnoise hit stop tracing\n" );
722722 save_trace_to_file (record ? record -> trace .inst : NULL ,
723723 params -> trace_output );
724+ return_value = FAILED ;
724725 }
725726
726727out_top :
Original file line number Diff line number Diff line change @@ -1141,11 +1141,11 @@ int timerlat_hist_main(int argc, char *argv[])
11411141 struct timerlat_params * params ;
11421142 struct osnoise_tool * record = NULL ;
11431143 struct timerlat_u_params params_u ;
1144+ enum result return_value = ERROR ;
11441145 struct osnoise_tool * tool = NULL ;
11451146 struct osnoise_tool * aa = NULL ;
11461147 struct trace_instance * trace ;
11471148 int dma_latency_fd = -1 ;
1148- int return_value = 1 ;
11491149 pthread_t timerlat_u ;
11501150 int retval ;
11511151 int nr_cpus , i ;
@@ -1378,7 +1378,7 @@ int timerlat_hist_main(int argc, char *argv[])
13781378
13791379 timerlat_print_stats (params , tool );
13801380
1381- return_value = 0 ;
1381+ return_value = PASSED ;
13821382
13831383 if (osnoise_trace_is_off (tool , record ) && !stop_tracing ) {
13841384 printf ("rtla timerlat hit stop tracing\n" );
@@ -1388,6 +1388,7 @@ int timerlat_hist_main(int argc, char *argv[])
13881388
13891389 save_trace_to_file (record ? record -> trace .inst : NULL ,
13901390 params -> trace_output );
1391+ return_value = FAILED ;
13911392 }
13921393
13931394out_hist :
Original file line number Diff line number Diff line change @@ -985,12 +985,12 @@ int timerlat_top_main(int argc, char *argv[])
985985 struct timerlat_params * params ;
986986 struct osnoise_tool * record = NULL ;
987987 struct timerlat_u_params params_u ;
988+ enum result return_value = ERROR ;
988989 struct osnoise_tool * top = NULL ;
989990 struct osnoise_tool * aa = NULL ;
990991 struct trace_instance * trace ;
991992 int dma_latency_fd = -1 ;
992993 pthread_t timerlat_u ;
993- int return_value = 1 ;
994994 char * max_lat ;
995995 int retval ;
996996 int nr_cpus , i ;
@@ -1197,7 +1197,7 @@ int timerlat_top_main(int argc, char *argv[])
11971197
11981198 timerlat_print_stats (params , top );
11991199
1200- return_value = 0 ;
1200+ return_value = PASSED ;
12011201
12021202 if (osnoise_trace_is_off (top , record ) && !stop_tracing ) {
12031203 printf ("rtla timerlat hit stop tracing\n" );
@@ -1207,6 +1207,7 @@ int timerlat_top_main(int argc, char *argv[])
12071207
12081208 save_trace_to_file (record ? record -> trace .inst : NULL ,
12091209 params -> trace_output );
1210+ return_value = FAILED ;
12101211 } else if (params -> aa_only ) {
12111212 /*
12121213 * 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);
8383
8484#define ns_to_usf (x ) (((double)x/1000))
8585#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() {
3939}
4040
4141check () {
42+ expected_exitcode=${3:- 0}
4243 # Simple check: run rtla with given arguments and test exit code.
4344 # If TEST_COUNT is set, run the test. Otherwise, just count.
4445 ctr=$(( $ctr + 1 ))
@@ -49,7 +50,7 @@ check() {
4950 # Run rtla; in case of failure, include its output as comment
5051 # in the test results.
5152 result=$( stdbuf -oL $TIMEOUT " $RTLA " $2 2>&1 ) ; exitcode=$?
52- if [ $exitcode -eq 0 ]
53+ if [ $exitcode -eq $expected_exitcode ]
5354 then
5455 echo " ok $ctr - $1 "
5556 else
@@ -68,12 +69,14 @@ check_with_osnoise_options() {
6869 # Save original arguments
6970 arg1=$1
7071 arg2=$2
72+ arg3=$3
7173
7274 # Apply osnoise options (if not dry run)
7375 if [ -n " $TEST_COUNT " ]
7476 then
7577 [ " $NO_RESET_OSNOISE " == 1 ] || reset_osnoise
7678 shift
79+ shift
7780 while shift
7881 do
7982 [ " $1 " == " " ] && continue
@@ -84,7 +87,7 @@ check_with_osnoise_options() {
8487 done
8588 fi
8689
87- NO_RESET_OSNOISE=1 check " $arg1 " " $arg2 "
90+ NO_RESET_OSNOISE=1 check " $arg1 " " $arg2 " " $arg3 "
8891}
8992
9093set_timeout () {
Original file line number Diff line number Diff line change @@ -10,11 +10,11 @@ check "verify help page" \
1010check " detect noise higher than one microsecond" \
1111 " hwnoise -c 0 -T 1 -d 5s -q"
1212check " set the automatic trace mode" \
13- " hwnoise -a 5 -d 30s"
13+ " hwnoise -a 5 -d 30s" 2
1414check " set scheduling param to the osnoise tracer threads" \
1515 " hwnoise -P F:1 -c 0 -r 900000 -d 1M -q"
1616check " 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
1818check " enable a trace event trigger" \
1919 " hwnoise -t -e osnoise:irq_noise trigger=\" hist:key=desc,duration:sort=desc,duration:vals=hitcount\" -d 1m"
2020
Original file line number Diff line number Diff line change @@ -10,16 +10,16 @@ check "verify help page" \
1010check " verify the --priority/-P param" \
1111 " osnoise top -P F:1 -c 0 -r 900000 -d 1M -q"
1212check " verify the --stop/-s param" \
13- " osnoise top -s 30 -T 1 -t"
13+ " osnoise top -s 30 -T 1 -t" 2
1414check " verify the --trace param" \
15- " osnoise hist -s 30 -T 1 -t"
15+ " osnoise hist -s 30 -T 1 -t" 2
1616check " verify the --entries/-E param" \
1717 " osnoise hist -P F:1 -c 0 -r 900000 -d 1M -b 10 -E 25"
1818
1919# Test setting default period by putting an absurdly high period
2020# and stopping on threshold.
2121# If default period is not set, this will time out.
2222check_with_osnoise_options " apply default period" \
23- " osnoise hist -s 1" period_us=600000000
23+ " osnoise hist -s 1" 2 period_us=600000000
2424
2525test_end
Original file line number Diff line number Diff line change @@ -21,21 +21,21 @@ export RTLA_NO_BPF=$option
2121check " verify help page" \
2222 " timerlat --help"
2323check " verify -s/--stack" \
24- " timerlat top -s 3 -T 10 -t"
24+ " timerlat top -s 3 -T 10 -t" 2
2525check " verify -P/--priority" \
2626 " timerlat top -P F:1 -c 0 -d 1M -q"
2727check " test in nanoseconds" \
28- " timerlat top -i 2 -c 0 -n -d 30s"
28+ " timerlat top -i 2 -c 0 -n -d 30s" 2
2929check " set the automatic trace mode" \
30- " timerlat top -a 5 --dump-tasks"
30+ " timerlat top -a 5 --dump-tasks" 2
3131check " print the auto-analysis if hits the stop tracing condition" \
32- " timerlat top --aa-only 5"
32+ " timerlat top --aa-only 5" 2
3333check " disable auto-analysis" \
34- " timerlat top -s 3 -T 10 -t --no-aa"
34+ " timerlat top -s 3 -T 10 -t --no-aa" 2
3535check " verify -c/--cpus" \
3636 " timerlat hist -c 0 -d 30s"
3737check " 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
3939done
4040
4141test_end
You can’t perform that action at this time.
0 commit comments