-
Notifications
You must be signed in to change notification settings - Fork 111
/
run-test.sh
executable file
·66 lines (54 loc) · 1.67 KB
/
run-test.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
#!/usr/bin/env bash
TESTNAME=$1
ED2EXE=${2:-ed_2.2-dbg}
if [ -z "$TESTNAME" ]; then
echo "Please specify a test to run."
exit 1
fi
ED2IN="Templates/ED2IN-$TESTNAME"
if [ ! -f "$ED2IN" ]; then
echo "Test file $ED2IN does not exist"
exit 1
fi
DATA_COMMON="common"
if [ ! -d "$DATA_COMMON" ]; then
echo "Downloading common data"
wget "https://github.com/ashiklom/edts-datasets/releases/download/common/common.tar.gz"
tar -xf "$DATA_COMMON.tar.gz"
else
echo "Common data $DATA_COMMON already exists"
fi
# Test files take the form "SITENAME[.options]".
# For example, `umbs.bg` for bare-ground run at UMBS.
# They can also just be the site name -- e.g. `harvard-forest`.
#
# `SITENAME` must match the tags and file names found at
# https://github.com/ashiklom/edts-datasets/releases.
SITE=${TESTNAME%.*}
if [ ! -d "$SITE" ]; then
echo "Downloading data for site $SITE"
wget "https://github.com/ashiklom/edts-datasets/releases/download/$SITE/$SITE.tar.gz"
tar -xf "$SITE.tar.gz"
else
echo "Data for site $SITE already exists"
fi
OUTDIR="test-outputs/$TESTNAME"
echo "Running ED2. Outputs will be saved to $OUTDIR"
mkdir -p "$OUTDIR"
mkdir -p "test-logs"
LOGFILE="test-logs/$TESTNAME"
if ! uname -a | grep -q -i "darwin"; then
# Remove the stack limit. Otherwise, ED2 will mysteriously segfault early in
# its excution. But don't do this check on MacOS.
ulimit -s unlimited
fi
# Run without OMP.
# TODO: Test execution with OMP
OMP_NUM_THREADS=1 "$ED2EXE" -s -f "$ED2IN" | tee "$LOGFILE"
if grep -q "Time integration ends" "$LOGFILE"; then
echo "Run successful!"
exit 0
else
echo "Run failed. For details, see $LOGFILE"
exit 1
fi