2010-06-03 21:24:43 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2015-05-17 05:46:39 +08:00
|
|
|
set -e
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
# if this is part of a distcheck action, then this script
|
|
|
|
# will be executed in a different directory
|
|
|
|
# than the one containing it; so capture the path to this script
|
|
|
|
# as the location of the source directory.
|
2017-01-19 12:46:47 +08:00
|
|
|
|
|
|
|
if test "x$topsrcdir" != x ; then
|
|
|
|
srcdir="$topsrcdir/ncdap_test"
|
|
|
|
else
|
|
|
|
srcdir=`dirname $0`
|
|
|
|
fi
|
|
|
|
|
2012-06-07 05:57:29 +08:00
|
|
|
cd $srcdir
|
|
|
|
srcdir=`pwd`
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
# compute the build directory
|
|
|
|
builddir=`pwd`/..
|
|
|
|
# Hack for CYGWIN
|
2012-07-18 04:13:17 +08:00
|
|
|
if [ `uname | cut -d "_" -f 1` = "MINGW32" ]; then
|
2012-06-07 05:57:29 +08:00
|
|
|
srcdir=`pwd | sed 's/\/c\//c:\//g'`
|
|
|
|
builddir="$srcdir"/..
|
|
|
|
fi
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
cd ${builddir}/ncdap_test
|
|
|
|
|
|
|
|
quiet=0
|
|
|
|
cache=1
|
|
|
|
leakcheck=0
|
|
|
|
|
|
|
|
if test "x$cache" = "x1" ; then
|
|
|
|
CACHEPARAM="[cache]"
|
|
|
|
else
|
|
|
|
CACHEPARAM=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
PARAMS="[netcdf3][log]${CACHEPARAM}"
|
|
|
|
|
|
|
|
#OCLOGFILE=/dev/null
|
|
|
|
OCLOGFILE="" ; export OCLOGFILE
|
|
|
|
|
|
|
|
# Locate the testdata and expected directory
|
|
|
|
EXPECTED="${srcdir}/expecttds3"
|
|
|
|
|
|
|
|
# get the list of test files
|
|
|
|
##################################################
|
|
|
|
# Special test info
|
|
|
|
##################################################
|
|
|
|
# TDS files under 10 megabytes
|
2013-03-26 01:44:08 +08:00
|
|
|
# TDS Catalog: http://thredds.ucar.edu/thredds/catalog/public/dataset/catalog.html
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2013-03-26 01:44:08 +08:00
|
|
|
TDSURL1="http://thredds.ucar.edu/thredds/dodsC/public/dataset"
|
2010-06-03 21:24:43 +08:00
|
|
|
TDSTESTS1="\
|
|
|
|
tst-striped.nc \
|
|
|
|
tst-PROFILER_RASS.nc \
|
|
|
|
tst-upc-nmm-point.nc \
|
|
|
|
testData2.nc \
|
|
|
|
testData.nc \
|
|
|
|
tst-ocean.nc \
|
|
|
|
tst-sst.nc \
|
|
|
|
tst-RUC.nc \
|
|
|
|
tst-NCEP-NAM-CONUS.nc \
|
|
|
|
tst-NCEP-SREF-CONUS.nc \
|
|
|
|
tst-NWS-NDFD-CONUS.nc \
|
|
|
|
tst-NCEP-RUC-CONUS.nc \
|
|
|
|
tst-NCEP-GFS-ALASKA.nc \
|
|
|
|
tst-PROFILER.nc"
|
|
|
|
|
|
|
|
# TDS files over 10 megabytes
|
|
|
|
TDSURL2="${TDSURL1}"
|
|
|
|
TDSTESTS2="\
|
|
|
|
tst-NCEP-DGEX-CONUS.nc \
|
|
|
|
tst-upc-nmm-grid.nc \
|
|
|
|
tst-eta.nc \
|
|
|
|
tst-NCEP-GEFS-GLOBAL.nc \
|
|
|
|
tst-GFS_Global.nc \
|
|
|
|
tst-Surface-METAR.nc"
|
|
|
|
|
|
|
|
TESTURL="${TDSURL1}"
|
|
|
|
TESTSET="${TDSTESTS1}"
|
|
|
|
|
|
|
|
# Temporarily suppress
|
|
|
|
XFAILTESTS="tst-Surface-METAR.nc"
|
|
|
|
|
2017-11-26 22:00:17 +08:00
|
|
|
RESULTSDIR="./results_tst_tds"
|
2010-06-03 21:24:43 +08:00
|
|
|
expected3="${srcdir}/expecttds3"
|
|
|
|
|
|
|
|
# Locate some tools
|
|
|
|
NCDUMP="${builddir}/ncdump/ncdump"
|
|
|
|
NCCOPY="${builddir}/ncdump/nccopy"
|
|
|
|
|
|
|
|
if test "x$leakcheck" = x1 ; then
|
|
|
|
VALGRIND="valgrind -q --error-exitcode=2 --leak-check=full"
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -fr ${RESULTSDIR}
|
|
|
|
mkdir "${RESULTSDIR}"
|
|
|
|
|
|
|
|
passcount=0
|
|
|
|
xfailcount=0
|
|
|
|
failcount=0
|
|
|
|
|
|
|
|
if test "x$quiet" = "x0" ; then
|
|
|
|
echo "*** Testing TDS server"
|
|
|
|
echo "*** URL: ${TESTURL}"
|
|
|
|
echo "*** PARAMS: ${PARAMS}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd ${RESULTSDIR}
|
|
|
|
for t in ${TESTSET} ; do
|
|
|
|
name="$t"
|
|
|
|
url="${PARAMS}${TESTURL}/$name"
|
|
|
|
if test "x$quiet" = "x0" ; then echo "*** Testing: ${name}"; fi
|
|
|
|
|
|
|
|
# Ignore missing cases
|
|
|
|
# if test -f ${EXPECTED}/${name}.dmp
|
|
|
|
# then ignore=1; else echo "Missing: ${EXPECTED}/${name}.dmp"; continue; fi
|
|
|
|
|
|
|
|
# determine if this is an xfailtest
|
|
|
|
isxfail=0
|
|
|
|
for x in ${XFAILTESTS} ; do
|
|
|
|
if test "x${name}" = "x${x}" ; then isxfail=1; fi
|
|
|
|
done
|
|
|
|
|
|
|
|
status=0
|
|
|
|
|
|
|
|
if ${VALGRIND} ${NCCOPY} ${url} ${name}.nc
|
|
|
|
then status=$status; else status=1; fi
|
|
|
|
|
|
|
|
if ${NCDUMP} ${name}.nc > ${name}.dmp
|
|
|
|
then status=$status; else status=1; fi
|
|
|
|
|
|
|
|
if diff -w ${EXPECTED}/${name}.dmp ${name}.dmp
|
|
|
|
then status=$status; else status=1; fi
|
|
|
|
|
|
|
|
if test "x$status" = "x1" ; then
|
|
|
|
if test "x$isxfail" = "x1" ; then status=2; fi # xfail
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$status" in
|
|
|
|
0)
|
|
|
|
passcount=`expr $passcount + 1`
|
|
|
|
if test "x$quiet" = "x" ; then echo "*** SUCCEED: ${name}"; fi
|
|
|
|
;;
|
|
|
|
1)
|
|
|
|
failcount=`expr $failcount + 1`
|
|
|
|
echo "*** FAIL: ${name}"
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
xfailcount=`expr $xfailcount + 1`
|
2012-07-18 04:13:17 +08:00
|
|
|
echo "*** XFAIL : ${name}"
|
2010-06-03 21:24:43 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
done
|
|
|
|
cd ..
|
|
|
|
|
2017-11-26 22:00:17 +08:00
|
|
|
rm -fr ${RESULTSDIR}
|
2010-06-03 21:24:43 +08:00
|
|
|
totalcount=`expr $passcount + $failcount + $xfailcount`
|
|
|
|
okcount=`expr $passcount + $xfailcount`
|
|
|
|
|
|
|
|
echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"
|
|
|
|
|
|
|
|
# Ignore failures for now
|
|
|
|
#failcount=0
|
|
|
|
if test "$failcount" -gt 0 ; then
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
exit 0
|
|
|
|
fi
|