2015-05-29 05:03:02 +08:00
|
|
|
#!/bin/sh
|
|
|
|
verbose=1
|
|
|
|
set -e
|
2015-06-02 03:07:16 +08:00
|
|
|
set -x
|
2015-05-29 05:03:02 +08:00
|
|
|
if test "x$builddir" = "x"; then builddir=`pwd`; fi
|
|
|
|
if test "x$srcdir" = "x"; then srcdir=`dirname $0`; fi
|
|
|
|
|
|
|
|
# Make buildir absolute
|
|
|
|
cd $builddir
|
|
|
|
builddir=`pwd`
|
|
|
|
|
|
|
|
# Make srcdir be absolute
|
|
|
|
cd $srcdir
|
|
|
|
srcdir=`pwd`
|
|
|
|
cd $builddir
|
|
|
|
|
|
|
|
# Setup
|
|
|
|
PASS=1
|
|
|
|
|
|
|
|
# Define the .cdl files to test
|
|
|
|
CLASSIC="small ref_tst_nans ref_tst_utf8"
|
|
|
|
EXTENDED="ref_nc_test_netcdf4 ref_tst_comp ref_tst_opaque_data"
|
|
|
|
|
|
|
|
rm -fr ./results
|
|
|
|
mkdir ./results
|
|
|
|
|
|
|
|
# Dump classic files two ways and compare
|
|
|
|
dotest() {
|
|
|
|
K=$1
|
|
|
|
for f in $2 ; do
|
|
|
|
echo "Testing ${f}"
|
|
|
|
${builddir}/../ncgen/ncgen -$K -o ./results/${f}.nc ${srcdir}/${f}.cdl
|
2015-06-02 03:07:16 +08:00
|
|
|
./ncdump ./results/${f}.nc > ./results/${f}.cdl
|
|
|
|
./ncdump -Xm ./results/${f}.nc > ./results/${f}.cdx
|
|
|
|
diff -w ./results/${f}.cdl ./results/${f}.cdx &> ./results/${f}.diff
|
2015-05-29 05:03:02 +08:00
|
|
|
if test -s ./results/${f}.diff ; then
|
|
|
|
echo "***FAIL: $f"
|
|
|
|
PASS=0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2015-05-29 09:23:33 +08:00
|
|
|
dotest "3" "$CLASSIC"
|
|
|
|
dotest "4" "$EXTENDED"
|
2015-05-29 05:03:02 +08:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
rm -fr results
|
|
|
|
|
|
|
|
if test "x$PASS" = x1 ; then
|
|
|
|
echo "*** PASS all tests"
|
|
|
|
CODE=0
|
|
|
|
else
|
|
|
|
CODE=1
|
|
|
|
fi
|
|
|
|
exit $CODE
|
|
|
|
|
|
|
|
|