2010-06-03 21:24:43 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2017-11-14 02:15:02 +08:00
|
|
|
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
2017-03-09 08:01:10 +08:00
|
|
|
. ../test_common.sh
|
2014-09-19 08:26:06 +08:00
|
|
|
|
2017-03-09 08:01:10 +08:00
|
|
|
# This shell script tests the output from several previous tests.
|
|
|
|
set -e
|
2014-09-19 08:26:06 +08:00
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
echo ""
|
|
|
|
echo "*** Testing ncgen and ncdump test output for classic format."
|
2017-11-25 22:28:07 +08:00
|
|
|
|
|
|
|
echo "*** Testing that ncgen produces correct C code from c0.cdl."
|
|
|
|
${execdir}/ref_ctest
|
|
|
|
${NCGEN} -lc -o ctest0.nc $srcdir/../ncgen/c0.cdl > tst_output_ctest.c
|
|
|
|
diff -b tst_output_ctest.c $srcdir/ref_ctest.c
|
|
|
|
|
|
|
|
echo "*** creating ctest1.cdl from tst_output_ctest0.nc..."
|
|
|
|
${NCDUMP} -n c1 ${builddir}/ctest0.nc | sed 's/e+0/e+/g' > tst_output_ctest1.cdl
|
|
|
|
echo "*** creating tst_output_c0.nc from c0.cdl..."
|
|
|
|
${NCGEN} -b -o tst_output_c0.nc ${ncgenc0}
|
|
|
|
echo "*** creating tst_output_c1.cdl from tst_output_c0.nc..."
|
|
|
|
${NCDUMP} -n c1 ${builddir}/tst_output_c0.nc | sed 's/e+0/e+/g' > tst_output_c1.cdl
|
|
|
|
echo "*** comparing tst_output_c1.cdl with ref_ctest1_nc4c.cdl..."
|
|
|
|
diff -b tst_output_c1.cdl $srcdir/ref_ctest1_nc4c.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** comparing ncdump of C program output (ctest1.cdl) with c1.cdl..."
|
2017-11-25 22:28:07 +08:00
|
|
|
diff -b tst_output_c1.cdl tst_output_ctest1.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** test output for ncdump -k"
|
2020-05-19 09:36:28 +08:00
|
|
|
KIND=`${NCDUMP} -k tst_output_c0.nc |tr -d '\r'`
|
2017-03-09 08:01:10 +08:00
|
|
|
test "$KIND" = "classic";
|
2017-11-25 22:28:07 +08:00
|
|
|
${NCGEN} -k $KIND -b -o tst_output_c0tmp.nc ${ncgenc0}
|
|
|
|
cmp tst_output_c0tmp.nc tst_output_c0.nc
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
echo "*** test output for ncdump -x"
|
|
|
|
echo "*** creating tst_ncml.nc from tst_ncml.cdl"
|
2017-03-09 08:01:10 +08:00
|
|
|
${NCGEN} -b -o tst_ncml.nc $srcdir/tst_ncml.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** creating c1.ncml from tst_ncml.nc"
|
2020-05-19 09:36:28 +08:00
|
|
|
${NCDUMP} -x tst_ncml.nc | sed 's/e-00/e-0/g' |tr -d '\000' > c1.ncml
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** comparing ncdump -x of generated file with ref1.ncml ..."
|
2012-05-09 03:36:27 +08:00
|
|
|
diff -b c1.ncml $srcdir/ref1.ncml
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
echo "*** test output for ncdump -s"
|
|
|
|
echo "*** creating tst_mslp.nc from tst_mslp.cdl"
|
2017-03-09 08:01:10 +08:00
|
|
|
${NCGEN} -b -o tst_mslp.nc $srcdir/tst_mslp.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** creating tst_format_att.cdl from tst_mslp.nc"
|
2017-03-09 08:01:10 +08:00
|
|
|
${NCDUMP} -s tst_mslp.nc > tst_format_att.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** comparing ncdump -s of generated file with ref_tst_format_att.cdl ..."
|
2012-05-09 03:36:27 +08:00
|
|
|
diff -b tst_format_att.cdl $srcdir/ref_tst_format_att.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
echo "*** All ncgen and ncdump test output for classic format passed!"
|
|
|
|
|
2017-11-25 22:28:07 +08:00
|
|
|
echo "*** Testing that ncgen with c0.cdl for 64-bit offset format."
|
|
|
|
${execdir}/ref_ctest64
|
|
|
|
${NCGEN} -k2 -lc -o ctest0_64.nc $srcdir/../ncgen/c0.cdl > tst_output_ctest64.c
|
|
|
|
diff -b tst_output_ctest64.c $srcdir/ref_ctest64.c
|
|
|
|
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** Testing ncgen and ncdump test output for 64-bit offset format."
|
2017-03-09 08:01:10 +08:00
|
|
|
echo "*** creating ctest1_64.cdl from test0_64.nc..."
|
2017-11-25 22:28:07 +08:00
|
|
|
${NCDUMP} -n c1 ctest0_64.nc | sed 's/e+0/e+/g' > tst_output_ctest1_64.cdl
|
|
|
|
echo "*** creating tst_output_c0_64.nc from c0.cdl..."
|
|
|
|
${NCGEN} -k nc6 -b -o tst_output_c0_64.nc ${ncgenc0}
|
|
|
|
echo "*** creating tst_output_c1_64.cdl from tst_output_c0_64.nc..."
|
|
|
|
${NCDUMP} -n c1 tst_output_c0_64.nc | sed 's/e+0/e+/g' > tst_output_c1_64.cdl
|
|
|
|
echo "*** comparing ncdump of C program output (ctest1_64.cdl) with tst_output_c1_64.cdl..."
|
|
|
|
diff -b tst_output_c1_64.cdl tst_output_ctest1_64.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** test output for ncdump -k"
|
2020-05-19 09:36:28 +08:00
|
|
|
KIND=`${NCDUMP} -k tst_output_c0_64.nc | tr -d '\r'`
|
|
|
|
test "$KIND" = "64-bit offset";
|
2017-11-25 22:28:07 +08:00
|
|
|
${NCGEN} -k nc6 -b -o tst_output_c0_64_tmp.nc ${ncgenc0}
|
|
|
|
cmp tst_output_c0_64_tmp.nc tst_output_c0_64.nc
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
echo "*** test output for ncdump -s"
|
|
|
|
echo "*** creating tst_mslp_64.nc from tst_mslp.cdl"
|
2017-03-09 08:01:10 +08:00
|
|
|
${NCGEN} -k nc6 -b -o tst_mslp_64.nc ${srcdir}/tst_mslp.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** creating tst_format_att_64.cdl from tst_mslp_64.nc"
|
2017-03-09 08:01:10 +08:00
|
|
|
${NCDUMP} -s tst_mslp_64.nc | sed 's/e+0/e+/g' > tst_format_att_64.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
echo "*** comparing ncdump -s of generated file with ref_tst_format_att_64.cdl ..."
|
2012-05-09 03:36:27 +08:00
|
|
|
diff -b tst_format_att_64.cdl $srcdir/ref_tst_format_att_64.cdl
|
2010-06-03 21:24:43 +08:00
|
|
|
|
|
|
|
echo "*** All ncgen and ncdump test output for 64-bit offset format passed!"
|
|
|
|
exit 0
|