2010-06-03 21:24:43 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2017-06-29 03:51:01 +08:00
|
|
|
if test "x$SETX" != x ; then set -x ; fi
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
quiet=0
|
|
|
|
leakcheck=0
|
|
|
|
|
2012-01-30 02:56:29 +08:00
|
|
|
PARAMS="[log]"
|
|
|
|
#PARAMS="${PARAMS}[fetch=memory]"
|
|
|
|
#PARAMS="${PARAMS}[show=fetch]"
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
OCLOGFILE=/dev/null
|
|
|
|
|
|
|
|
# Capture arguments
|
|
|
|
srcdir="$1"
|
|
|
|
builddir="$2"
|
|
|
|
mode="$3"
|
|
|
|
|
|
|
|
# Locate the testdata and expected directory
|
|
|
|
testdata3="${srcdir}/testdata3"
|
|
|
|
expected3="${srcdir}/expected3"
|
2017-06-29 03:51:01 +08:00
|
|
|
|
|
|
|
TITLE="DAP to netCDF-3 translation"
|
|
|
|
EXPECTED="$expected3"
|
|
|
|
PARAMS="${PARAMS}[cache]"
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
# get the list of test files
|
|
|
|
. ${srcdir}/tst_ncdap_shared.sh
|
|
|
|
|
|
|
|
case "$mode" in
|
|
|
|
file*)
|
|
|
|
TESTURL="$FILEURL"
|
|
|
|
TESTSET="$FILETESTS"
|
|
|
|
;;
|
2013-02-26 12:31:06 +08:00
|
|
|
dds*)
|
|
|
|
TESTURL="[noprefetch]$FILEURL"
|
|
|
|
TESTSET="$DDSTESTS"
|
2018-10-02 05:51:43 +08:00
|
|
|
FLAGS="$FLAGS -h"
|
2013-02-26 12:31:06 +08:00
|
|
|
;;
|
2010-06-03 21:24:43 +08:00
|
|
|
remote*)
|
|
|
|
TESTURL="$REMOTEURL"
|
|
|
|
TITLE="Remote $TITLE"
|
|
|
|
TESTSET="$REMOTETESTS"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2017-11-18 01:49:06 +08:00
|
|
|
RESULTSDIR="./results_tst_ncdap"
|
2017-06-29 03:51:01 +08:00
|
|
|
#
|
2010-06-03 21:24:43 +08:00
|
|
|
if test "x$leakcheck" = "x1" ; then
|
|
|
|
VALGRIND="valgrind -q --error-exitcode=2 --leak-check=full"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -fr ${RESULTSDIR}
|
|
|
|
mkdir "${RESULTSDIR}"
|
|
|
|
|
2015-07-06 09:26:01 +08:00
|
|
|
rm -f ./.dodsrc ./.ocrc ./.daprc
|
2010-06-03 21:24:43 +08:00
|
|
|
passcount=0
|
|
|
|
xfailcount=0
|
|
|
|
failcount=0
|
|
|
|
|
|
|
|
echo "*** Testing $TITLE "
|
|
|
|
echo " Base URL: ${TESTURL}"
|
|
|
|
echo " Client Parameters: ${PARAMS}"
|
|
|
|
|
|
|
|
cd ${RESULTSDIR}
|
2010-07-20 02:06:09 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
for x in ${TESTSET} ; do
|
|
|
|
url="${PARAMS}${TESTURL}/$x"
|
2012-07-18 04:13:17 +08:00
|
|
|
if test "x$quiet" = "x0" ; then echo "*** Testing: ${x} ; url=$url" ; fi
|
2010-06-03 21:24:43 +08:00
|
|
|
# determine if this is an xfailtest
|
|
|
|
isxfail=0
|
|
|
|
for t in ${XFAILTESTS} ; do
|
|
|
|
if test "x${t}" = "x${x}" ; then isxfail=1; fi
|
|
|
|
done
|
|
|
|
ok=1
|
2017-07-27 03:35:27 +08:00
|
|
|
if ${VALGRIND} ${NCDUMP} ${FLAGS} "${url}" | sed 's/\\r//g' > ${x}.dmp ; then ok=$ok; else ok=0; fi
|
2010-06-03 21:24:43 +08:00
|
|
|
# compare with expected
|
2017-07-26 04:58:29 +08:00
|
|
|
if diff -w ${EXPECTED}/${x}.dmp ${x}.dmp ; then ok=$ok; else ok=0; fi
|
2010-06-03 21:24:43 +08:00
|
|
|
if test "$ok" = 1 ; then
|
|
|
|
status=0 # succeed
|
|
|
|
elif test "x$isxfail" = "x0" ; then
|
|
|
|
status=1 # fail
|
|
|
|
else
|
|
|
|
status=2 # xfail
|
|
|
|
fi
|
2017-07-27 03:35:27 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
case "$status" in
|
|
|
|
0)
|
|
|
|
passcount=`expr $passcount + 1`
|
|
|
|
if test "x$quiet" = "x" ; then echo "*** SUCCEED: ${x}"; fi
|
|
|
|
;;
|
|
|
|
1)
|
|
|
|
failcount=`expr $failcount + 1`
|
|
|
|
echo "*** FAIL: ${x}"
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
xfailcount=`expr $xfailcount + 1`
|
2012-07-18 04:13:17 +08:00
|
|
|
echo "*** XFAIL : ${x}"
|
2010-06-03 21:24:43 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
done
|
2010-07-20 02:06:09 +08:00
|
|
|
|
2015-07-06 09:26:01 +08:00
|
|
|
rm -f ./.dodsrc ./.ocrc ./.daprc
|
2010-07-20 02:06:09 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
cd ..
|
2015-07-06 09:26:01 +08:00
|
|
|
echo "pwd=" `pwd`
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
totalcount=`expr $passcount + $failcount + $xfailcount`
|
|
|
|
okcount=`expr $passcount + $xfailcount`
|
2017-11-18 01:49:06 +08:00
|
|
|
rm -fr ${RESULTSDIR}
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"
|
|
|
|
|
|
|
|
#failcount=0
|
|
|
|
if test "$failcount" -gt 0
|
|
|
|
then
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
exit 0
|
|
|
|
fi
|