run_tests 2.36 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash

#input:
# FP_exec : path to flexpart executable  
# path_flextest: directory  path to output base directory
# test_names (bash array): list of tests to be run

# defaults
#FP_exec=/home/ignacio/repos/flexpart/src/FP_ecmwf_gfortran
#FP_exec=/xnilu_wrk/flexbuild/tests/NILU/FP_ecmwf_gfortran
FP_exec=$WORKSPACE/src/FP_ecmwf_gfortran
#path_flextest=/home/ignacio/repos/flextest/
#path_flextest=/xnilu_wrk/flexbuild/flextest/
path_flextest=$WORKSPACE/flextest/
#options_default=/xnilu_wrk/flexbuild/flexpart/options/
options_default=$WORKSPACE/options/
#declare -a test_names=('1' 'HelloWorld' 'Fwd1' 'Fwd2' 'Bwd1' 'Volc' '2')
#test_names[0]='1' 
test_names[0]='HelloWorld' 

group_name=tests

source ./$1


suffix=$(date "+%y-%m-%d_%H%M%S")
#tests_dir=tests_${suffix}/
tests_dir=${group_name}_${suffix}/
path_tests=${path_flextest}/$tests_dir
mkdir $path_tests


#declare Bash Array
#declare -a test_names=('1' '2' 'HelloWorld')
#declare -a test_names=('1' '2' 'HelloWorld' 'Fwd1' 'Fwd2' 'Bwd1' 'Volc')
#declare -a test_names=('2' 'Volc')
#declare -a test_names=('1' 'HelloWorld' 'Fwd1' 'Fwd2' 'Bwd1' 'Volc' '2')

#Print the Whole Bash Array
s_test_names=${test_names[@]}
# Length of the Bash Array
n_tests=${#test_names[@]}
#echo n_tests=$n_tests
echo run $s_test_names
echo total $n_tests tests
#test
#tests_dir='tests_15-08-19_113139/'
#path_tests=${path_flextest}/$tests_dir


outlog=stdout.log
i=0
i_end=$n_tests
while [ $i -lt $i_end ] ;
do
  let j=i+1
  name=${test_names[i]};
  echo run test no. $j  
#  echo name= $name
#  echo working dir= $path_tests/test_$name
#  echo executable= $FP_exec 
#  echo default options from $options_default 
  ./run_test test_$name  $FP_exec $path_tests $options_default
  echo test $name terminated
  success="$(cat $path_tests/test_$name/$outlog  | grep CONGRATULATIONS  | wc -l)"
  echo success=$success
let i=i+1;
done
 
tot_successes="$(cat $path_tests/test_*/$outlog  | grep CONGRATULATIONS  | wc -l)"
tot_runs="$(ls -1 $path_tests | wc -l)"

echo ' '
echo finished  $tot_runs tests of $n_tests 
echo $tot_successes seccessful
exit













./run_test test_1  $FP_exec $path_tests
./run_test test_2  $FP_exec $path_tests
# 6 species
./run_test test_Volc  $FP_exec $path_tests
./run_test test_HelloWorld  $FP_exec $path_tests
./run_test test_Fwd1  $FP_exec $path_tests
./run_test test_Fwd2  $FP_exec $path_tests
./run_test test_Bwd1  $FP_exec $path_tests