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