netcdf-c/dap4_test/test_data.sh
Dennis Heimbigner 835b81a285 Cleanup DAP4 testing
NOTE: This PR should not be included in 4.9.1 since additional
DAP4 related PRs will be forthcoming.

This PR makes major changes to libdap4 and dap4_test driven by changes to TDS.

* Enable DAP4
* Clean up the test input files and the test baseline comparison files. This entails:
    * Remove a multitude of unused test input and baseline data files; among them are dap4_test/: daptestfiles, dmrtestfiles, nctestfiles, and misctestfiles.
    * Define a canonical set of test input files and record in dap4_test/cdltestfiles.
    * Use the cdltestfiles to generate the .nc test inputs. This set of .nc files is then moved to the d4ts (DAP4 test server) war file in the tds repository. This set then becomes the canonical set of DAP4 test sources.
    * Scrape d4ts to obtain copies of the raw streams of DAP4 encoded data. The .dmr and .dap streams are then stored in dap4_test/rawtestfiles.
    * Disable some remote server tests until those servers are fixed.
* Add an option to ncdump (-XF) that forces the type of the _FillValue attribute; this is primarily to simplify testing of fill mismatch.
* Minor bug fixes to ncgen.
* Changes to libdap4:
    * Replace old checksum hack with the dap4.checksum flag.
    * Support the dap4.XXX controls.
    * Cleanup _FillValue handling, especially var-attribute type mismatches.
    * Fix enum handling based on changes to netcdf-java.
* Changes to dap4_test:
    * Add getopt support to various test support programs.
    * Remove unneeded shell scripts.
    * Add new scripts: test_curlopt.sh
2022-11-13 13:15:11 -07:00

88 lines
2.2 KiB
Bash
Executable File

#!/bin/sh
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
set -e
. ${top_srcdir}/dap4_test/d4test_common.sh
echo "test_data.sh:"
computetestablefiles
setresultdir results_test_data
if test "x${RESET}" = x1 ; then rm -fr ${BASELINE}/*.d4d ; fi
for f in $F ; do
echo "testing: ${f}"
if ! ${execdir}/test_data -s ${builddir}/results_test_data/${f} ${RAWTESTFILES}/${f} ; then
echo "failure"
fi
${NCDUMP} ${DUMPFLAGS} ${builddir}/results_test_data/${f} > ${builddir}/results_test_data/${f}.d4d
if test "x${TEST}" = x1 ; then
diff -wBb ${BASELINE}/${f}.d4d ${builddir}/results_test_data/${f}.d4d
elif test "x${RESET}" = x1 ; then
echo "${f}:"
cp ${builddir}/results_test_data/${f}.d4d ${BASELINE}/${f}.d4d
fi
done
# Remove empty lines and trim lines in a cdl file
trim() {
if test $# != 2 ; then
echo "simplify: too few args"
else
rm -f $2
while read -r iline; do
oline=`echo $iline | sed -e 's/^[\t ]*\([^\t ]*\)[\t ]*$/\\1/'`
if test "x$oline" = x ; then continue ; fi
echo "$oline" >> $2
done < $1
fi
}
# 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${CDLDIFF}" = x1 ; then
for f in $F ; do
STEM=`echo $f | cut -d. -f 1`
if ! test -e ${CDLTESTFILES}/${STEM}.cdl ; then
echo "Not found: ${CDLTESTFILES}/${STEM}.cdl"
continue
fi
echo "diff -wBb ${CDLTESTFILES}/${STEM}.cdl ${builddir}/results_test_data/${f}.d4d"
rm -f ${builddir}/b1 ${builddir}/b2 ${builddir}/r1 ${builddir}/r2
trim ${CDLTESTFILES}/${STEM}.cdl ${builddir}/b1
trim ${builddir}/results_test_data/${f}.d4d ${builddir}/r1
baseclean b1 b2
resultclean r1 r2
diff -wBb ${builddir}/b2 ${builddir}/r2
done
fi