[1333256] | 1 | #!/bin/bash |
---|
| 2 | |
---|
[1be76d8] | 3 | #input: |
---|
| 4 | # FP_exec : path to flexpart executable |
---|
| 5 | # path_flextest: directory path to output base directory |
---|
| 6 | # test_names (bash array): list of tests to be run |
---|
| 7 | |
---|
| 8 | # defaults |
---|
| 9 | FP_exec=/home/ignacio/repos/flexpart/src/FP_ecmwf_gfortran |
---|
| 10 | path_flextest=/home/ignacio/repos/flextest/ |
---|
| 11 | options_default=/home/ignacio/repos/flexpart/options/ |
---|
| 12 | #declare -a test_names=('1' 'HelloWorld' 'Fwd1' 'Fwd2' 'Bwd1' 'Volc' '2') |
---|
| 13 | #test_names[0]='1' |
---|
| 14 | test_names[0]='HelloWorld' |
---|
| 15 | |
---|
| 16 | group_name=tests |
---|
| 17 | |
---|
| 18 | source ./$1 |
---|
| 19 | |
---|
[1333256] | 20 | |
---|
| 21 | suffix=$(date "+%y-%m-%d_%H%M%S") |
---|
[1be76d8] | 22 | #tests_dir=tests_${suffix}/ |
---|
| 23 | tests_dir=${group_name}_${suffix}/ |
---|
| 24 | path_tests=${path_flextest}/$tests_dir |
---|
| 25 | mkdir $path_tests |
---|
[1333256] | 26 | |
---|
| 27 | |
---|
[1be76d8] | 28 | #declare Bash Array |
---|
| 29 | #declare -a test_names=('1' '2' 'HelloWorld') |
---|
| 30 | #declare -a test_names=('1' '2' 'HelloWorld' 'Fwd1' 'Fwd2' 'Bwd1' 'Volc') |
---|
| 31 | #declare -a test_names=('2' 'Volc') |
---|
| 32 | #declare -a test_names=('1' 'HelloWorld' 'Fwd1' 'Fwd2' 'Bwd1' 'Volc' '2') |
---|
| 33 | |
---|
| 34 | #blabla |
---|
| 35 | #Print the Whole Bash Array |
---|
| 36 | s_test_names=${test_names[@]} |
---|
| 37 | # Length of the Bash Array |
---|
| 38 | n_tests=${#test_names[@]} |
---|
| 39 | #echo n_tests=$n_tests |
---|
| 40 | echo run $n_tests tests: $s_test_names |
---|
| 41 | |
---|
| 42 | #test |
---|
| 43 | #tests_dir='tests_15-08-19_113139/' |
---|
| 44 | #path_tests=${path_flextest}/$tests_dir |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | outlog=stdout.log |
---|
| 48 | i=0 |
---|
| 49 | i_end=$n_tests |
---|
| 50 | while [ $i -lt $i_end ] ; |
---|
| 51 | do |
---|
| 52 | let j=i+1 |
---|
| 53 | name=${test_names[i]}; |
---|
| 54 | echo test no. $j name= $name |
---|
| 55 | echo in $path_tests/test_$name |
---|
| 56 | ./run_test test_$name $FP_exec $path_tests $options_default |
---|
| 57 | echo terminated |
---|
| 58 | success="$(cat $path_tests/test_$name/$outlog | grep CONGRATULATIONS | wc -l)" |
---|
| 59 | echo success=$success |
---|
| 60 | let i=i+1; |
---|
| 61 | done |
---|
| 62 | |
---|
| 63 | tot_successes="$(cat $path_tests/test_*/$outlog | grep CONGRATULATIONS | wc -l)" |
---|
| 64 | tot_runs="$(ls -1 $path_tests | wc -l)" |
---|
| 65 | |
---|
| 66 | echo ' ' |
---|
| 67 | echo finished $tot_runs tests of $n_tests |
---|
| 68 | echo $tot_successes seccessful |
---|
| 69 | exit |
---|
| 70 | |
---|
[1333256] | 71 | |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | |
---|
[1be76d8] | 76 | |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | ./run_test test_1 $FP_exec $path_tests |
---|
| 84 | ./run_test test_2 $FP_exec $path_tests |
---|
| 85 | # 6 species |
---|
| 86 | ./run_test test_Volc $FP_exec $path_tests |
---|
| 87 | ./run_test test_HelloWorld $FP_exec $path_tests |
---|
| 88 | ./run_test test_Fwd1 $FP_exec $path_tests |
---|
| 89 | ./run_test test_Fwd2 $FP_exec $path_tests |
---|
| 90 | ./run_test test_Bwd1 $FP_exec $path_tests |
---|
| 91 | |
---|
| 92 | |
---|