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