2010-06-03 21:24:43 +08:00
|
|
|
#!/bin/sh
|
|
|
|
# This shell script runs the ncgen tests.
|
|
|
|
# $Id: run_tests.sh,v 1.10 2010/04/04 22:06:03 dmh Exp $
|
|
|
|
|
2015-08-16 06:26:35 +08:00
|
|
|
if test "x$srcdir" = x ; then
|
2016-05-04 11:17:06 +08:00
|
|
|
srcdir=`pwd`
|
2015-08-16 06:26:35 +08:00
|
|
|
fi
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** Testing ncgen."
|
|
|
|
set -e
|
2015-11-20 04:44:07 +08:00
|
|
|
|
2016-11-19 02:11:53 +08:00
|
|
|
##
|
|
|
|
# Function to test a netCDF CDL file.
|
|
|
|
# 1. Generate binary nc.
|
|
|
|
# Use ncdump to compare against original CDL file.
|
|
|
|
# Input: CDL file name, minus the suffix.
|
|
|
|
# Other input: arguments.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
# $ validateNC compound_datasize_test -k nc4
|
|
|
|
##
|
|
|
|
validateNC() {
|
|
|
|
BASENAME=$1
|
|
|
|
INFILE=$srcdir/$1.cdl
|
|
|
|
TMPFILE="tst_$1".cdl
|
|
|
|
shift
|
|
|
|
ARGS=$@
|
|
|
|
|
|
|
|
echo "*** generating $BASENAME.nc ***"
|
|
|
|
./ncgen $ARGS $INFILE
|
|
|
|
../ncdump/ncdump $BASENAME.nc > $TMPFILE
|
|
|
|
echo "*** comparing binary against source CDL file *** "
|
|
|
|
diff -b -w $INFILE $TMPFILE
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** creating classic file c0.nc from c0.cdl..."
|
2016-11-19 02:11:53 +08:00
|
|
|
|
|
|
|
validateNC c0
|
2015-11-03 04:58:55 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** creating 64-bit offset file c0_64.nc from c0.cdl..."
|
2016-11-19 02:11:53 +08:00
|
|
|
|
|
|
|
validate c0 -k 64-bit-offset -b
|
2010-06-03 21:24:43 +08:00
|
|
|
|
2015-08-16 06:26:35 +08:00
|
|
|
echo "*** creating 64-bit offset file c5.nc from c5.cdl..."
|
2016-11-19 02:11:53 +08:00
|
|
|
validate c5 -k 64-bit-data -b
|
2015-11-03 04:58:55 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** Test successful!"
|
|
|
|
exit 0
|