1 | #!/bin/sh |
---|
2 | # initialise user dependent variable |
---|
3 | SETTE_DIR=$(cd $(dirname "$0"); pwd) |
---|
4 | MAIN_DIR=$(dirname $SETTE_DIR) |
---|
5 | export SETTE_TIMING='no' |
---|
6 | |
---|
7 | # Parse command-line arguments |
---|
8 | if [ $# -gt 0 ]; then |
---|
9 | while getopts t:x:cshT option; do |
---|
10 | case $option in |
---|
11 | c) export SETTE_CLEAN_CONFIGS='yes' |
---|
12 | export SETTE_SYNC_CONFIGS='yes' |
---|
13 | echo "" |
---|
14 | echo "Configuration $SETTE_TEST_CONFIGS will be cleaned; this option enforces also synchronisation" |
---|
15 | echo "";; |
---|
16 | s) export SETTE_SYNC_CONFIGS='yes' |
---|
17 | echo "" |
---|
18 | echo "MY_SRC and EXP00 in $SETTE_TEST_CONFIGS will be synchronised with the MY_SRC and EXPREF from the reference configuration" |
---|
19 | echo "";; |
---|
20 | t) export SETTE_TEST_CONFIGS=($OPTARG) |
---|
21 | echo "" |
---|
22 | if [ ${#SETTE_TEST_CONFIGS[@]} -gt 1 ]; then |
---|
23 | echo "Configurations ${SETTE_TEST_CONFIGS[@]} will be tested if they are available" |
---|
24 | else |
---|
25 | echo "Configuration ${SETTE_TEST_CONFIGS[@]} will be tested if it is available" |
---|
26 | fi |
---|
27 | echo "" ;; |
---|
28 | x) export SETTE_TEST_TYPES=($OPTARG) |
---|
29 | ;; |
---|
30 | T) export SETTE_TIMING='yes' |
---|
31 | echo "" |
---|
32 | echo "ln_timing will be set to true" |
---|
33 | echo "";; |
---|
34 | h | *) echo 'sette.sh with no arguments (in this case all configuration will be tested)' |
---|
35 | echo '-t "CFG1_to_test CFG2_to_test ..." to test some specific configurations' |
---|
36 | echo '-x "TEST_type TEST_type ..." to specify particular types of test (RESTART is mandatory)' |
---|
37 | echo '-T to set ln_timing true for all non-AGRIF configurations' |
---|
38 | echo '-c to clean each configuration' |
---|
39 | echo '-s to synchronise the sette MY_SRC and EXP00 with the reference MY_SRC and EXPREF'; exit 42 ;; |
---|
40 | esac |
---|
41 | done |
---|
42 | shift $((OPTIND - 1)) |
---|
43 | fi |
---|
44 | |
---|
45 | . ./param.cfg |
---|
46 | |
---|
47 | if [ ${#SETTE_TEST_CONFIGS[@]} -eq 0 ]; then |
---|
48 | echo "" |
---|
49 | echo "Configurations $TEST_CONFIGS will be tested if they are available" |
---|
50 | echo "" |
---|
51 | fi |
---|
52 | echo "" |
---|
53 | echo "Carrying out the following tests: ${TEST_TYPES[@]}" |
---|
54 | echo "" |
---|
55 | |
---|
56 | # run sette on reference configuration |
---|
57 | . ./sette_reference-configurations.sh |
---|
58 | if [[ $? != 0 ]]; then |
---|
59 | echo "" |
---|
60 | echo "--------------------------------------------------------------" |
---|
61 | echo "./sette_cfg-ref.sh didn't finish properly, need investigations" |
---|
62 | echo "--------------------------------------------------------------" |
---|
63 | echo "" |
---|
64 | exit 42 |
---|
65 | fi |
---|
66 | |
---|
67 | # run sette on test cases |
---|
68 | . ./sette_test-cases.sh |
---|
69 | if [[ $? != 0 ]]; then |
---|
70 | echo "" |
---|
71 | echo "-----------------------------------------------------------------" |
---|
72 | echo "./sette_test-cases.sh didn't finish properly, need investigations" |
---|
73 | echo "-----------------------------------------------------------------" |
---|
74 | echo "" |
---|
75 | exit 42 |
---|
76 | fi |
---|
77 | |
---|
78 | # run sette report |
---|
79 | echo "" |
---|
80 | echo "-------------------------------------------------------------" |
---|
81 | echo "./sette_rpt.sh (script will wait all nemo_sette run are done)" |
---|
82 | echo "-------------------------------------------------------------" |
---|
83 | echo "" |
---|
84 | NRUN=999 |
---|
85 | NIT=0 |
---|
86 | while [[ $NRUN -ne 0 && $nit -le 1080 ]]; do |
---|
87 | nit=$((nit+1)) |
---|
88 | NRUN=$( ${BATCH_STAT} | grep ${BATCH_NAME} | wc -l ) |
---|
89 | if [[ $NRUN -ne 0 ]]; then |
---|
90 | printf "%-3d %s\r" $NRUN 'nemo_sette runs still in queue or running ...'; |
---|
91 | else |
---|
92 | printf "%-50s\n" " " |
---|
93 | . ./sette_rpt.sh |
---|
94 | exit |
---|
95 | fi |
---|
96 | sleep 10 |
---|
97 | done |
---|
98 | printf "\n" |
---|
99 | echo "" |
---|
100 | echo "Something wrong happened, it tooks more than 3 hours to run all the sette tests" |
---|
101 | echo "" |
---|