mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
Wiring in more validation
This commit is contained in:
parent
637f649555
commit
8dc53c4981
@ -28,9 +28,9 @@ variables:
|
||||
double d ;
|
||||
d:c = "abcd\tZ$&" ;
|
||||
int64 i64 ;
|
||||
i64:att_int64 = 1LL ;
|
||||
i64:att_int64 = 1 ;
|
||||
uint64 ui64 ;
|
||||
ui64:att_uint64 = 1ULL ;
|
||||
ui64:att_uint64 = 1 ;
|
||||
char cr(Dr) ;
|
||||
byte br(Dr) ;
|
||||
short sr(Dr) ;
|
||||
|
@ -8,7 +8,7 @@ if test "x$srcdir" = x ; then srcdir="."; fi
|
||||
# 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.
|
||||
# Input: CDL file name, minus the suffix, output filename
|
||||
# Other input: arguments.
|
||||
#
|
||||
# Example:
|
||||
@ -17,12 +17,13 @@ if test "x$srcdir" = x ; then srcdir="."; fi
|
||||
validateNC() {
|
||||
BASENAME=$1
|
||||
INFILE=$srcdir/$1.cdl
|
||||
TMPFILE="tst_$1".cdl
|
||||
TMPFILE=$2.cdl
|
||||
shift
|
||||
shift
|
||||
ARGS=$@
|
||||
|
||||
echo "*** generating $BASENAME.nc ***"
|
||||
./ncgen $ARGS $INFILE
|
||||
./ncgen $ARGS -o $BASENAME.nc $INFILE
|
||||
../ncdump/ncdump $BASENAME.nc > $TMPFILE
|
||||
echo "*** comparing binary against source CDL file *** "
|
||||
diff -b -w $INFILE $TMPFILE
|
||||
@ -35,23 +36,23 @@ echo "*** Testing ncgen for netCDF-4."
|
||||
set -e
|
||||
|
||||
echo "*** creating netCDF-4 file c0_4.nc from c0_4.cdl..."
|
||||
validateNC "c0_4" -k nc4 -b -o c0_4.nc
|
||||
validateNC "c0_4" "c0_4" -k nc4 -b -o c0_4.nc
|
||||
|
||||
echo "*** creating netCDF-4 classic model file c0_4c.nc from c0.cdl..."
|
||||
validateNC "c0" -k nc7 -b
|
||||
validateNC "c0" "c0_4c" -k nc7 -b
|
||||
|
||||
echo "*** creating C code for CAM file ref_camrun.cdl..."
|
||||
./ncgen -lc $srcdir/ref_camrun.cdl >ref_camrun.c
|
||||
|
||||
echo "*** test for jira NCF-199 bug"
|
||||
validateNC "ncf199" -k nc4
|
||||
validateNC "ncf199" "ncf199" -k nc4
|
||||
|
||||
echo "*** creating binary files for github issue 323..."
|
||||
echo "*** github issue 323 test 1"
|
||||
validateNC "compound_datasize_test" -k nc4
|
||||
validateNC "compound_datasize_test" "compound_datasize_test" -k nc4
|
||||
|
||||
echo "*** github issue 323 test 2"
|
||||
validateNC "compound_datasize_test2" -k nc4
|
||||
validateNC "compound_datasize_test2" "compound_datasize_test2" -k nc4
|
||||
|
||||
echo "*** Test successful!"
|
||||
exit 0
|
||||
|
@ -9,42 +9,35 @@ fi
|
||||
echo "*** Testing ncgen."
|
||||
set -e
|
||||
|
||||
##
|
||||
# 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
|
||||
TMPFILE=tst_$2.cdl
|
||||
shift
|
||||
shift
|
||||
ARGS=$@
|
||||
|
||||
echo "*** generating $BASENAME.nc ***"
|
||||
./ncgen $ARGS $INFILE
|
||||
./ncgen $ARGS -o $BASENAME.nc $INFILE
|
||||
../ncdump/ncdump $BASENAME.nc > $TMPFILE
|
||||
echo "*** comparing binary against source CDL file *** "
|
||||
echo "*** comparing $BASENAME.nc against $INFILE *** "
|
||||
diff -b -w $INFILE $TMPFILE
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo "*** creating classic file c0.nc from c0.cdl..."
|
||||
|
||||
validateNC c0
|
||||
validateNC c0 c0 -b
|
||||
|
||||
echo "*** creating 64-bit offset file c0_64.nc from c0.cdl..."
|
||||
|
||||
validate c0 -k 64-bit-offset -b
|
||||
validateNC c0 "c0_64" -k 64-bit-offset -b
|
||||
|
||||
echo "*** creating 64-bit offset file c5.nc from c5.cdl..."
|
||||
validate c5 -k 64-bit-data -b
|
||||
./ncgen -k 64-bit-data -b -o c5.nc $srcdir/c5.cdl
|
||||
if [ ! -f c5.nc ]; then
|
||||
echo "Failure."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "*** Test successful!"
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user