source: BOL/script_install_amaury/test_compils.sh @ 5226

Last change on this file since 5226 was 5043, checked in by abarral, 4 months ago

fix $jobcmd for make_xios & xios compile msg
add $debug to test_compils.sh

  • Property svn:executable set to *
File size: 2.7 KB
RevLine 
[4909]1#!/bin/bash
2# Test LMDZ compilation in various situations
3
4set -eu
5
[5037]6## Params
7
8#submit_cmd="sbatch -A $(/usr/sbin/my_project.py -l 2>&1 | head -1 | cut -d " " -f 3- | cut -c 5-) --constraint=GENOA --time=00:15:00 -N 1 -n 1 -c 8"  # to launch on Adastra /!\ Not working rn, since jobs don't have internet access
9submit_cmd=""  # to launch directly
10#base_args="-arch_dir arch_local -arch local-gfortran"  # to use local arch
11base_args="-arch local-gfortran-parallel"
12
13
14## End params
15
16local=$(pwd)
[4909]17mkdir -p test_logs
18
19function do_one_test {
20    # Perform one test, if the log file doesn't already exist
[5043]21    cd "$local"
[4909]22
23    # Create test args
[5043]24    local args="$base_args -rad $rad -parallel $parallel -netcdf 0 -veget $veget $xios $lmdzrev $cosp $debug"
[4914]25    # trim
26    args=$(echo "$args" | xargs)
[4909]27
[5037]28    local logfile="$local/test_logs/$args.out"
29    if [[ -f $logfile ]]; then return; fi  # ALready exists = test already ran
[4909]30    echo "Testing $args"
31
[5037]32    # Create temp folder
33    mkdir -p "test_logs/${args// /_}_$$" && cd "test_logs/${args// /_}_$$"
34    cp ../../install_lmdz.sh .
[4909]35
36    # shellcheck disable=SC2086
[5037]37    local test_cmd="$submit_cmd ./install_lmdz.sh -name LMDZ $args"
38    if ! $test_cmd > "$logfile" 2>&1; then
[4909]39        # Check bench success if bench
40        if (grep -q "EXECUTION DU BENCH" < "$logfile") && (! grep -q "Everything is cool" < "$logfile"); then
41            echo "/!\\ Bench FAILED /!\\"
42        else
43            echo "/!\\ Install FAILED /!\\"
44        fi
45    fi
46}
47
48function run_all_tests {
49    for parallel in "none" "mpi_omp"; do
[4929]50    for rad in "oldrad" "rrtm" "ecrad"; do
[4909]51    for veget in "none" "orch2.0" "orch2.2"; do
52    for xios in "" "-xios"; do
[4929]53      if [[ $xios = "-xios" && $parallel = "none" ]]; then continue; fi
[5037]54    for lmdzrev in ""; do
[4929]55    for cosp in "" "-cosp v1" "-cosp v2"; do
[5043]56    for debug in "" "-debug"; do
[4909]57        do_one_test
58    done
59    done
60    done
61    done
[4914]62    done
[4929]63    done
[5043]64    done
[4909]65}
66
67function display_results {
[5037]68    cd "$local/test_logs"
[4917]69    echo "Success=o, Failure=XXX, non-breaking error=/!\\"
[4909]70    echo "INSTALL  BENCH  NAME"
[5037]71    for fname in *.out; do
[4909]72        if [[ $(tail -n 1 -- "$fname") = " Everything is cool" ]]; then
[4917]73            if grep -q "Error" < "$fname"; then
74                    echo "   o      /!\\   $fname"
75                else
76                    echo "   o       o    $fname"
77                fi
[4909]78        else
79            if grep -q "EXECUTION DU BENCH" < "$fname"; then
80                echo "   o      XXX   $fname"
81            else
82                echo "  XXX           $fname"
83            fi
84        fi
85    done
86}
87
88skip_tests=""
89while (($# > 0)); do
90    case $1 in
91        "-s") skip_tests="y"; shift;;
92    esac
93done
94
95if [[ -z $skip_tests ]]; then run_all_tests; fi
96display_results
Note: See TracBrowser for help on using the repository browser.