netcdf-c/ncgen/run_tests.sh

51 lines
1.0 KiB
Bash
Raw Normal View History

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
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
##
# 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..."
validateNC c0
2010-06-03 21:24:43 +08:00
echo "*** creating 64-bit offset file c0_64.nc from c0.cdl..."
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..."
validate c5 -k 64-bit-data -b
2010-06-03 21:24:43 +08:00
echo "*** Test successful!"
exit 0