netcdf-c/dap4_test/tst_raw.sh
Dennis Heimbigner 6d8809100f Fix pull request https://github.com/Unidata/netcdf-c/pull/374 (dap4.dmh)
1. When running under windows (as opposed to cygwin)
   we need to make sure to not user /cygdrive/ file paths.
   This was ocurring in libdap4/d4read.c, but may occur
   elsewhere.
2. Shell scripts in the git repo are not being checked-out
   with the executable mode set. Had core.filemode set to false.
   Was a major hassle to fix.
2017-04-03 21:39:44 -06:00

68 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
. ${srcdir}/d4test_common.sh
set -x
# Compute the set of testfiles
PUSHD ${srcdir}/daptestfiles
F=`ls -1d *.dap`
POPD
F=`echo $F | tr '\r\n' ' '`
F=`echo $F | sed -e s/.dap//g`
# Do cleanup on the baseline file
baseclean() {
if test $# != 2 ; then
echo "simplify: too few args"
else
rm -f $2
while read -r iline; do
oline=`echo $iline | tr "'" '"'`
echo "$oline" >> $2
done < $1
fi
}
# Do cleanup on the result file
resultclean() {
if test $# != 2 ; then
echo "simplify: too few args"
else
rm -f $2
while read -r iline; do
oline=`echo $iline | sed -e 's|^\(netcdf.*\)[.]nc\(.*\)$|\\1\\2|'`
echo "$oline" >> $2
done < $1
fi
}
if test "x${RESET}" = x1 ; then rm -fr ${BASELINERAW}/*.dmp ; fi
for f in $F ; do
echo "testing: $f"
URL="[dap4]file:${DAPTESTFILES}/${f}"
if ! ${VG} ${NCDUMP} "${URL}" > ./results/${f}.dmp; then
failure "${URL}"
fi
if test "x${TEST}" = x1 ; then
if ! diff -wBb ${BASELINERAW}/${f}.dmp ./results/${f}.dmp ; then
failure "diff ${f}.dmp"
fi
elif test "x${RESET}" = x1 ; then
echo "${f}:"
cp ./results/${f}.dmp ${BASELINERAW}/${f}.dmp
elif test "x${DIFF}" = x1 ; then
echo "hdrtest: ${f}"
rm -f ./tr1 ./tr2 ./tb1 ./tb2
baseclean
if ! diff -wBb ./${BASELINERAW}/${f}.dmp ./${BASELINE}/${f}.ncdump ; then
failure diff -wBb ./${BASELINERAW}/${f}.dmp ./${BASELINE}/${f}.ncdump
fi
fi
done
finish