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