-
Notifications
You must be signed in to change notification settings - Fork 266
/
Copy pathd4test_common.sh
executable file
·135 lines (115 loc) · 2.76 KB
/
d4test_common.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# not executable
. ${srcdir}/d4manifest.sh
if test "x$SETX" = x1 ; then set -x ; fi
if test "x$NOOPTIONS" = x ; then
if test $# = 0 ; then
TEST=1
else
for arg in "$@"; do
case "${arg}" in
test) TEST=1 ;;
reset) RESET=1 ;;
diff) DIFF=1 ;;
cdl) CDLDIFF=1 ;;
log) ;;
*) echo unknown argument $arg ;;
esac
done
fi
fi
# Define input paths
WD=`pwd`
cd ${top_srcdir}/dap4_test/cdltestfiles; CDLTESTFILES=`pwd` ; cd ${WD}
cd ${top_srcdir}/dap4_test/rawtestfiles; RAWTESTFILES=`pwd` ; cd ${WD}
cd ${top_srcdir}/dap4_test/baseline; BASELINE=`pwd` ; cd ${WD}
cd ${top_srcdir}/dap4_test/baselineraw; BASELINERAW=`pwd` ; cd ${WD}
cd ${top_srcdir}/dap4_test/baselineremote; BASELINEREM=`pwd` ; cd ${WD}
cd ${top_srcdir}/dap4_test/baselinehyrax; BASELINEHY=`pwd` ; cd ${WD}
cd ${top_srcdir}/dap4_test/baselinethredds; BASELINETH=`pwd` ; cd ${WD}
setresultdir() {
rm -fr ${builddir}/$1
mkdir -p ${builddir}/$1
}
FAILURES=
failure() {
echo "*** Fail: $1"
FAILURES=1
if test "x$2" != x ; then
exit 1
fi
}
PUSHD() {
pushd $1 >>/dev/null
}
POPD() {
popd >>/dev/null
}
filesexist() {
for x in "$@" ; do
if ! test -e $x ; then
failure "missing file: $x"
fi
done
}
urlbasename() {
constraint=`echo "$1" | cut -d '?' -f2`
unconstrained=`echo "$1" | cut -d '?' -f1`
base=`basename $unconstrained`
prefix=`dirname $unconstrained`
}
makeurl() {
urlbasename "$2"
if test "x$constraint" = "x$unconstrained" ; then
URL="$1/${prefix}/${base}${FRAG}"
else
URL="$1/${prefix}/${base}?$constraint${FRAG}"
fi
}
finish() {
if test "x$FAILURES" = x1 ; then
echo "*** Fail"
exit 1
else
echo "*** Pass"
exit 0
fi
}
# Return the complete set of arguments minus any found in $SUPPRESS
suppress() {
local args="$@"
suppress=
for a in $args; do
for s in $SUPPRESS; do if test "x$a" != "x$s" ; then suppress="$suppress $a"; fi; done
done
}
# Compute the set of testable names using the manifest.
EXCLUDEDFILES="test_vlen9 test_vlen10"
computetestablefiles() {
local F0 firs excluded
# remove untestable files
F=
first=0
for f in ${dap4_manifest} ; do
excluded=0
for x in $EXCLUDEDFILES ; do
if test "x$x" = "x$f" ; then excluded=1; break; fi
done
if test "x$excluded" = x0 ; then
if test "x$first" = x1 ; then F="${f}.nc"; first=0; else F="$F ${f}.nc"; fi
fi
done
}
# Split a d4manifest.sh constraint line
# Result is to set 4 variables: FILE QUERY INDEX FRAG
splitconstraint() {
local tpl
tpl="$1"
FILE=`echo $tpl | cut -d"?" -f1`
tpl=`echo $tpl | cut -d"?" -f2`
QUERY=`echo $tpl | cut -d"=" -f1`
INDEX=`echo $tpl | cut -d"=" -f2`
FRAG="#dap4&log&show=fetch"
}
VG="valgrind --leak-check=full --error-exitcode=1 --num-callers=100"
if test "x$USEVG" = x ; then VG=; fi
DUMPFLAGS="-XF"