]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/blob - scripts/test_simple_scenarios.sh
Make test scenario scripts executable
[hubacji1/iamcar2.git] / scripts / test_simple_scenarios.sh
1 # Run `test1`, `test2`, `test3`, ... for 100 times on randomly generated simple
2 # scenario.
3
4 # This script should be run from the `build` folder as:
5 #
6 #       bash ../scripts/test_all_scenarios.sh out 100 test1 test2 test3 ...
7 #
8
9 if [ $# -lt 3 ]
10 then
11         echo 'Test `runnable`s for `count` simple scenarios'
12         echo ''
13         echo 'Usage:'
14         echo ''
15         echo -e '\tbash test_simple_scenarios.sh RESULTS COUNT RUN1 RUN2 ...'
16         echo ''
17         echo '- RESULTS is the directory to store the results to.'
18         echo '- COUNT how many times the runnable is run.'
19         echo '- COUNT tells how many simple scenarios are generated.'
20         echo '- RUNx are runnable binaries.'
21         exit 1
22 fi
23 results=$1
24 shift
25 rcount=$1
26 shift
27 count=$1
28 shift
29 runnables=$@
30
31 if [ ! -d $results ]
32 then
33         mkdir $results
34         mkdir ${results}_t
35 fi
36
37 cnt=0
38 while [ $cnt -lt $count ]
39 do
40         python3 ../scripts/generate_simple_json_scenario.py > t
41         cp t ${results}_t/t_$cnt
42         rcnt=0
43         while [ $rcnt -lt $rcount ]
44         do
45             mkdir -p $results/$cnt/$rcnt
46             for r in $runnables
47             do
48                     ./$r < t > $results/$cnt/$rcnt/$r.json
49             done
50             rcnt=$(($rcnt + 1))
51         done
52         cnt=$(( $cnt + 1 ))
53 done