netcdf-c/ncgen/lfs-tests

55 lines
1.6 KiB
Plaintext
Raw Normal View History

2010-06-03 21:24:43 +08:00
#!/bin/sh
# test ncgen for generating classic and 64-bit offset files
# Argument, if any, is a directory into which (large) files are written.
case $# in
0)
LFSDIR=. ;;
1)
LFSDIR=$1 ;;
*)
echo too many args
exit 1
esac
NCGEN=./ncgen
NCDUMP=../ncdump/ncdump
# test large netCDF files with fixed vars, record vars
for version in 1 2; do # version 1 is classic, version 2 is 64-bit offset
for file in bigf$version bigr$version; do
if $NCGEN -b -x -v $version -o $LFSDIR/$file.nc $file.cdl
then
echo "*** success: $NCGEN -b -x -v $version -o $LFSDIR/$file.nc $file.cdl"
rm $LFSDIR/$file.nc
else
echo "### failure: $NCGEN -b -x -v $version -o $LFSDIR/$file.nc $file.cdl"
exit 1
fi
done
done
# test for detection of variables that are too big for classic format
for file in bigf2 bigr2; do
if $NCGEN -b -x -v 1 -o $LFSDIR/$file.nc $file.cdl 2>/dev/null
then
echo "### failure detecting error: $NCGEN -b -x -v 1 -o $LFSDIR/$file.nc $file.cdl"
rm -f $file.nc
else
echo "*** success detecting error: $NCGEN -b -x -v 1 -o $LFSDIR/$file.nc $file.cdl"
fi
done
# test for detection of variables that are too big for 64-bit offset format
for file in bigf3 bigr3; do
if $NCGEN -b -x -v 2 -o $LFSDIR/$file.nc $file.cdl 2>/dev/null
then
echo "### failure detecting error: $NCGEN -b -x -v 2 -o $LFSDIR/$file.nc $file.cdl"
rm -f $file.nc
else
echo "*** success detecting error: $NCGEN -b -x -v 2 -o $LFSDIR/$file.nc $file.cdl"
fi
done
rm -f test.cdl *.nc