2013-12-23 03:53:20 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2017-09-15 04:18:56 +08:00
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
2017-03-09 08:01:10 +08:00
|
|
|
. ../test_common.sh
|
2013-12-23 03:53:20 +08:00
|
|
|
|
2017-09-15 04:18:56 +08:00
|
|
|
# This shell script runs the ncdump tests.
|
|
|
|
# get some config.h parameters
|
|
|
|
if test -f ${top_builddir}/config.h ; then
|
2024-03-19 04:32:03 +08:00
|
|
|
if fgrep -e '#define NETCDF_ENABLE_CDF5 1' ${top_builddir}/config.h >/dev/null ; then
|
|
|
|
NETCDF_ENABLE_CDF5=1
|
2017-09-15 04:18:56 +08:00
|
|
|
else
|
2024-03-19 04:32:03 +08:00
|
|
|
NETCDF_ENABLE_CDF5=0
|
2017-09-15 04:18:56 +08:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Cannot locate config.h"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-03-09 08:01:10 +08:00
|
|
|
# This shell script tests the output several previous tests.
|
2013-12-23 03:53:20 +08:00
|
|
|
|
|
|
|
ECODE=0
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "*** Testing extended file format output."
|
|
|
|
set -e
|
|
|
|
echo "Test extended format output for a netcdf-3 file"
|
2017-11-17 23:22:49 +08:00
|
|
|
rm -f tmp_tst_formatx3
|
|
|
|
${NCGEN} -k nc3 -b -o ./tst_formatx3.nc $srcdir/ref_tst_small.cdl
|
|
|
|
${NCDUMP} -K tst_formatx3.nc >tmp_tst_formatx3
|
|
|
|
if ! grep 'classic mode=00000000' <tmp_tst_formatx3 ; then
|
2013-12-23 03:53:20 +08:00
|
|
|
echo "*** Fail: extended format for a classic file"
|
|
|
|
ECODE=1
|
|
|
|
fi
|
|
|
|
|
2015-08-16 06:26:35 +08:00
|
|
|
echo "Test extended format output for a 64-bit offset netcdf-3 file"
|
2017-11-17 23:22:49 +08:00
|
|
|
rm -f tmp_tst_formatx3
|
|
|
|
${NCGEN} -k nc6 -b -o ./tst_formatx3.nc $srcdir/ref_tst_small.cdl
|
|
|
|
${NCDUMP} -K tst_formatx3.nc >tmp_tst_formatx3
|
|
|
|
if ! grep '64-bit offset mode=00000200' <tmp_tst_formatx3 ; then
|
2013-12-23 03:53:20 +08:00
|
|
|
echo "*** Fail: extended format for a 64-bit classic file"
|
|
|
|
ECODE=1
|
|
|
|
fi
|
|
|
|
|
2017-09-15 04:18:56 +08:00
|
|
|
|
2024-03-19 04:32:03 +08:00
|
|
|
# Only do following test if NETCDF_ENABLE_CDF5 is true.
|
2017-09-15 04:18:56 +08:00
|
|
|
|
2024-03-19 04:32:03 +08:00
|
|
|
if test "x$NETCDF_ENABLE_CDF5" = x1 ; then
|
2017-09-15 04:18:56 +08:00
|
|
|
echo "Test extended format output for a 64-bit CDF-5 classic file"
|
2017-11-17 23:22:49 +08:00
|
|
|
rm -f tmp_tst_formatx3
|
|
|
|
${NCGEN} -k5 -b -o ./tst_formatx3.nc $srcdir/ref_tst_small.cdl
|
|
|
|
${NCDUMP} -K tst_formatx3.nc >tmp_tst_formatx3
|
|
|
|
if ! grep -F '64-bit data mode=00000020' <tmp_tst_formatx3 ; then
|
2017-09-15 04:18:56 +08:00
|
|
|
echo "*** Fail: extended format for a 64-bit CDF-5 classic file"
|
|
|
|
ECODE=1
|
|
|
|
fi
|
2015-08-16 06:26:35 +08:00
|
|
|
fi
|
|
|
|
|
2017-11-17 23:22:49 +08:00
|
|
|
rm -f tmp_tst_formatx3 tst_formatx3.nc
|
2013-12-23 03:53:20 +08:00
|
|
|
|
|
|
|
exit $ECODE
|