]> rtime.felk.cvut.cz Git - hubacji1/iamcar2.git/blob - scripts/test_simple_scenarios.sh
Update scenario script (lib)
[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 tells how many simple scenarios are generated.'
19         echo '- RUNx are runnable binaries.'
20         exit 1
21 fi
22 results=$1
23 shift
24 count=$1
25 shift
26 runnables=$@
27
28 if [ ! -d $results ]
29 then
30         mkdir $results
31         mkdir ${results}_t
32 fi
33
34 cnt=0
35 while [ $cnt -lt $count ]
36 do
37         mkdir $results/$cnt
38         python3 ../scripts/generate_simple_json_scenario.py > t
39         for r in $runnables
40         do
41                 ./$r < t > $results/$cnt/$r.json
42         done
43         mv t ${results}_t/t_$cnt
44         cnt=$(( $cnt + 1 ))
45 done