forked from noaa-ocs-modeling/CoastalApp-testsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_all.sh
executable file
·94 lines (76 loc) · 2.59 KB
/
run_all.sh
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
#!/usr/bin/env bash
###########################################################################
### Author: Panagiotis Velissariou <[email protected]>
### Contributions: Saeed Moghimi <[email protected]>
###
### Version - 1.1
###
### 1.1 Tue Dec 20 2022
### 1.0 Fri Dec 09 2022
###########################################################################
###====================
# Make sure that the current working directory is in the PATH
[[ ! :$PATH: == *:".":* ]] && export PATH="${PATH}:."
####################
# Get the directory where the script is located
if [[ $(uname -s) == Darwin ]]; then
readonly scrNAME="$( grealpath -s "${BASH_SOURCE[${#BASH_SOURCE[@]} - 1]}" )"
readonly scrDIR="$(cd "$(dirname "${scrNAME}" )" && pwd -P)"
else
readonly scrNAME="$( realpath -s "${BASH_SOURCE[${#BASH_SOURCE[@]} - 1]}" )"
readonly scrDIR="$(cd "$(dirname "${scrNAME}" )" && pwd -P)"
fi
####################
#################################
### Script configuration
#################################
### This is the work directory where the tests are being run
tmpVAL=${scrDIR:+${scrDIR}/}work
WORKdir=${WORKdir:-${tmpVAL}}
### The CoastalApp supported platform to use (compiler is intel)
tmpVAL=hera
PLATFORM=${PLATFORM:-${tmpVAL}}
export PLATFORM
### This is the COMM directory where large input files are stored (e.g., HSOFS data files)
tmpVAL=${scrDIR:+${scrDIR}/}comm
COMMDIR=${COMMDIR:-${tmpVAL}}
export COMMDIR
echo $COMMDIR
### This is the CoastalApp root directory
tmpVAL=${scrDIR:+${scrDIR}/}CoastalApp
ROOTDIR=${1:-${ROOTDIR}}
ROOTDIR=${ROOTDIR:-${tmpVAL}}
if [ -d "${ROOTDIR}" ]; then
export ROOTDIR="$(cd "${ROOTDIR}" && pwd -P)"
else
echo "The ROOTDIR = <${ROOTDIR}> is not found."
echo "Exiting the script: ${scrNAME} ..."
exit 1
fi
### This is the file that contains all the test cases to run.
### If a case is commented out, it is not run
TESTLIST=regtest_list.dat
#################################
#################################
### Start the calculations
#################################
echo "$(basename "${scrNAME}"): Running all tests in: ${TESTLIST}"
if [ -f "${TESTLIST}" ]; then
while read regtest
do
if [ -n "${regtest:+1}" ]; then
case "${regtest}" in \#*) continue ;; esac
echo "> Running case: ${regtest}"
work_dir=${WORKdir:-work}/${regtest}
if [ -d "${work_dir}" ]; then
mv -f ${work_dir} ${work_dir}_$(date +"%d%m%Y-%H%M%S")
fi
mkdir -p ${work_dir}
cp -rp ${regtest}/* ${work_dir}/
${work_dir}/run_case.sh
fi
done < ${TESTLIST}
else
echo "${TESTLIST}: File not found"
fi
exit $?