netcdf-c/ncdap_test/tst_utils.sh
Dennis Heimbigner 8072d1f6bb Modify DAP2 and DAP4 to optionally allow Fillvalue/Variable mismatch
re: issue https://github.com/Unidata/netcdf-c/issues/1151

Modify DAP2 and DAP4 code to handle case when _FillValue type is not
same as the parent variable type.

Specifically:
1. Define a parameter [fillmismatch] to allow this mismatch;
   default is to disallow.
2. If allowed, forcibly change the type of the _FillValue to match
   the parent variable.
3. If allowed Convert the values to match new type
4. Generate a log message
5. if not allowed, then fail

Implementing this required some changes to ncdap_test/dapcvt.c
Also added test cases.

Minor Unrelated Changes:
1. There were a number of warnings about e.g.
   assigning a const char* to a char*. Fix these
2. In nccopy.1, replace .NP with .IP "n"
   (re PR https://github.com/Unidata/netcdf-c/pull/1144)
3. fix minor error in ncdump/ocprint
2018-10-01 15:51:43 -06:00

87 lines
1.6 KiB
Bash

# This is not a standalone script; it is invoked by
# one or more of the main scripts
if test "x$SETX" = x1 ; then set -x ; fi
quiet=0
PARAMS="[log]"
#PARAMS="${PARAMS}[fetch=memory]"
#PARAMS="${PARAMS}[show=fetch]"
OCLOGFILE=/dev/null
DUMPFLAGS=
# Locate directories
testdata3="${srcdir}/testdata3"
expected3="${srcdir}/expected3"
rm -f ./.dodsrc ./.ocrc ./.daprc
passcount=0
xfailcount=0
failcount=0
# Try to figure out our platform
myplatform=`uname -a | cut -d" " -f 1`
case "$myplatform" in
Darwin*) platform=osx ;;
MINGW*) platform=mingw ;;
CYGWIN*) platform=cygwin ;;
linux*) platform=linux ;;
Linux*) platform=linux ;;
*) platform=unknown ;;
esac
# How to access local files
FILEURL="file://${testdata3}"
processstatus() {
if test "$ok" = 1 ; then
status=0 # succeed
elif test "x$isxfail" = "x0" ; then
status=1 # fail
else
status=2 # xfail
fi
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`
echo "*** XFAIL : ${x}"
;;
esac
}
summarize() {
totalcount=`expr $passcount + $failcount + $xfailcount`
okcount=`expr $passcount + $xfailcount`
if test "$failcount" -gt 0 ; then
echo "*** FAILED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"
else
echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"
fi
}
cleanup() {
rm -fr ${RESULTSDIR}
}
doexit() {
if test "$failcount" -gt 0
then
exit 1
else
exit 0
fi
}