Debian Codegraph @

ncgen/lfs-tests

raw
1 #!/bin/sh
2 # test ncgen for generating classic and 64-bit offset files
3 # Argument, if any, is a directory into which (large) files are written.
4
5 case $# in
6 0)
7 LFSDIR=. ;;
8 1)
9 LFSDIR=$1 ;;
10 *)
11 echo too many args
12 exit 1
13 esac
14
15 NCGEN=./ncgen
16 NCDUMP=../ncdump/ncdump
17
18 # test large netCDF files with fixed vars, record vars
19 for version in 1 2; do # version 1 is classic, version 2 is 64-bit offset
20 for file in bigf$version bigr$version; do
21 if $NCGEN -b -x -v $version -o $LFSDIR/$file.nc $file.cdl
22 then
23 echo "*** success: $NCGEN -b -x -v $version -o $LFSDIR/$file.nc $file.cdl"
24 rm $LFSDIR/$file.nc
25 else
26 echo "### failure: $NCGEN -b -x -v $version -o $LFSDIR/$file.nc $file.cdl"
27 exit 1
28 fi
29 done
30 done
31
32 # test for detection of variables that are too big for classic format
33 for file in bigf2 bigr2; do
34 if $NCGEN -b -x -v 1 -o $LFSDIR/$file.nc $file.cdl 2>/dev/null
35 then
36 echo "### failure detecting error: $NCGEN -b -x -v 1 -o $LFSDIR/$file.nc $file.cdl"
37 rm -f $file.nc
38 else
39 echo "*** success detecting error: $NCGEN -b -x -v 1 -o $LFSDIR/$file.nc $file.cdl"
40 fi
41 done
42
43 # test for detection of variables that are too big for 64-bit offset format
44 for file in bigf3 bigr3; do
45 if $NCGEN -b -x -v 2 -o $LFSDIR/$file.nc $file.cdl 2>/dev/null
46 then
47 echo "### failure detecting error: $NCGEN -b -x -v 2 -o $LFSDIR/$file.nc $file.cdl"
48 rm -f $file.nc
49 else
50 echo "*** success detecting error: $NCGEN -b -x -v 2 -o $LFSDIR/$file.nc $file.cdl"
51 fi
52 done
53
54 rm -f test.cdl *.nc