-
Notifications
You must be signed in to change notification settings - Fork 139
/
Copy pathtest_common.sh.in
63 lines (56 loc) · 2.08 KB
/
test_common.sh.in
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
#***********************************************************************
# GNU Lesser General Public License
#
# This file is part of the GFDL Flexible Modeling System (FMS).
#
# FMS is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# FMS is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with FMS. If not, see <http://www.gnu.org/licenses/>.
#***********************************************************************
# Ed Hartnett 11/26/19
# Cause test shell scripts to exit and return error if any command
# fails.
set -e
# Set exit codes to control the failure modes. These exit codes are found in
# The GNU Automake manual: https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html
# Note, any non-zero status, other than SKIP and ERROR is a FAIL
TEST_PASS=0
TEST_FAIL=1
TEST_SKIP=77
TEST_ERROR=99
# Set the source and build top directories for use in test scripts.
top_srcdir='@abs_top_srcdir@'
top_buildir='@abs_top_builddir@'
# Set the name of the mpi launcher for use in test scripts.
mpi_launcher='@MPI_LAUNCHER@'
oversubscribe='@OVERSUBSCRIBE@'
# Function to set up and run tests.
# Inputs:
# {1} Name of test
# {2} Number of processors
# {3} Set to skip
# {4} Set to true if you want mpi launcher to oversubscribe, IF possible
# For example: run_test test_time_manager 1
run_test()
{
# If the tests is known to fail exit
if test "x${3}" = "xskip" ; then
return $TEST_SKIP
else
# If there is no mpi launcher just ./{job_script}
if test "x$mpi_launcher" != "x" ; then
npes="-n ${2}"
fi
fi
# Run test
$mpi_launcher $oversubscribe $npes ./${1}
}