[4909] | 1 | #!/bin/bash |
---|
| 2 | # Test LMDZ compilation in various situations |
---|
| 3 | |
---|
| 4 | set -eu |
---|
| 5 | |
---|
| 6 | mkdir -p test_logs |
---|
| 7 | |
---|
| 8 | function do_one_test { |
---|
| 9 | # Perform one test, if the log file doesn't already exist |
---|
| 10 | |
---|
| 11 | # Create test args |
---|
| 12 | args="-arch_dir arch_local -arch local-gfortran" |
---|
| 13 | if [[ ! $parallel = "none" ]]; then |
---|
| 14 | args="$args-parallel" |
---|
| 15 | fi |
---|
[4929] | 16 | args="$args -rad $rad -parallel $parallel -netcdf 0 -veget $veget $xios $lmdzrev $cosp" |
---|
[4914] | 17 | # trim |
---|
| 18 | args=$(echo "$args" | xargs) |
---|
[4909] | 19 | |
---|
| 20 | logfile="test_logs/$args.out" |
---|
| 21 | if [[ -f $logfile ]]; then return; fi |
---|
| 22 | echo "Testing $args" |
---|
| 23 | rm -rf LMDZ |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | # shellcheck disable=SC2086 |
---|
| 27 | if ! ./install_lmdz.sh -name LMDZ $args > "$logfile" 2>&1; then |
---|
| 28 | # Check bench success if bench |
---|
| 29 | if (grep -q "EXECUTION DU BENCH" < "$logfile") && (! grep -q "Everything is cool" < "$logfile"); then |
---|
| 30 | echo "/!\\ Bench FAILED /!\\" |
---|
| 31 | else |
---|
| 32 | echo "/!\\ Install FAILED /!\\" |
---|
| 33 | fi |
---|
| 34 | fi |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | function run_all_tests { |
---|
| 38 | for parallel in "none" "mpi_omp"; do |
---|
[4929] | 39 | for rad in "oldrad" "rrtm" "ecrad"; do |
---|
[4909] | 40 | for veget in "none" "orch2.0" "orch2.2"; do |
---|
| 41 | for xios in "" "-xios"; do |
---|
[4929] | 42 | if [[ $xios = "-xios" && $parallel = "none" ]]; then continue; fi |
---|
[4917] | 43 | for lmdzrev in "" "-r 4894"; do # TODO when base lmdz becomes >=4894, change condition for lmdzrev="" |
---|
| 44 | if [[ (! $veget = "none") && ($parallel = "none") && ($(echo "$lmdzrev" | cut -c 4-) -lt 4894) ]]; then continue; fi |
---|
[4929] | 45 | for cosp in "" "-cosp v1" "-cosp v2"; do |
---|
[4909] | 46 | do_one_test |
---|
| 47 | done |
---|
| 48 | done |
---|
| 49 | done |
---|
| 50 | done |
---|
[4914] | 51 | done |
---|
[4929] | 52 | done |
---|
[4909] | 53 | } |
---|
| 54 | |
---|
| 55 | function display_results { |
---|
| 56 | cd "test_logs" |
---|
[4917] | 57 | echo "Success=o, Failure=XXX, non-breaking error=/!\\" |
---|
[4909] | 58 | echo "INSTALL BENCH NAME" |
---|
| 59 | for fname in *; do |
---|
| 60 | if [[ $(tail -n 1 -- "$fname") = " Everything is cool" ]]; then |
---|
[4917] | 61 | if grep -q "Error" < "$fname"; then |
---|
| 62 | echo " o /!\\ $fname" |
---|
| 63 | else |
---|
| 64 | echo " o o $fname" |
---|
| 65 | fi |
---|
[4909] | 66 | else |
---|
| 67 | if grep -q "EXECUTION DU BENCH" < "$fname"; then |
---|
| 68 | echo " o XXX $fname" |
---|
| 69 | else |
---|
| 70 | echo " XXX $fname" |
---|
| 71 | fi |
---|
| 72 | fi |
---|
| 73 | done |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | skip_tests="" |
---|
| 77 | while (($# > 0)); do |
---|
| 78 | case $1 in |
---|
| 79 | "-s") skip_tests="y"; shift;; |
---|
| 80 | esac |
---|
| 81 | done |
---|
| 82 | |
---|
| 83 | if [[ -z $skip_tests ]]; then run_all_tests; fi |
---|
| 84 | display_results |
---|