netcdf-c/ncgen/ctests.sh

177 lines
3.3 KiB
Bash
Raw Normal View History

2010-06-03 21:24:43 +08:00
#!/bin/sh
Primary change: add dap4 support Specific changes: 1. Add dap4 code: libdap4 and dap4_test. Note that until the d4ts server problem is solved, dap4 is turned off. 2. Modify various files to support dap4 flags: configure.ac, Makefile.am, CMakeLists.txt, etc. 3. Add nc_test/test_common.sh. This centralizes the handling of the locations of various things in the build tree: e.g. where is ncgen.exe located. See nc_test/test_common.sh for details. 4. Modify .sh files to use test_common.sh 5. Obsolete separate oc2 by moving it to be part of netcdf-c. This means replacing code with netcdf-c equivalents. 5. Add --with-testserver to configure.ac to allow override of the servers to be used for --enable-dap-remote-tests. 6. There were multiple versions of nctypealignment code. Try to centralize in libdispatch/doffset.c and include/ncoffsets.h 7. Add a unit test for the ncuri code because of its complexity. 8. Move the findserver code out of libdispatch and into a separate, self contained program in ncdap_test and dap4_test. 9. Move the dispatch header files (nc{3,4}dispatch.h) to .../include because they are now shared by modules. 10. Revamp the handling of TOPSRCDIR and TOPBUILDDIR for shell scripts. 11. Make use of MREMAP if available 12. Misc. minor changes e.g. - #include <config.h> -> #include "config.h" - Add some no-install headers to /include - extern -> EXTERNL and vice versa as needed - misc header cleanup - clean up checking for misc. unix vs microsoft functions 13. Change copyright decls in some files to point to LICENSE file. 14. Add notes to RELEASENOTES.md
2017-03-09 08:01:10 +08:00
2010-06-03 21:24:43 +08:00
echo "*** ctests.sh: testing ncgen4 -lc"
INSTALL=/tmp/install
KFLAG=1
NETCDF4=0
thisdir=`pwd`
if test "x$builddir" = "x"; then builddir=`pwd`/..; fi
if test "x$srcdir" = "x"; then srcdir=`dirname $0`; fi
# Make srcdir point to the netcdf-3 level */
srcdir="${srcdir}/.."
# Make buildir absolute
cd $builddir
builddir=`pwd`
# Return to home
cd $thisdir
# Make srcdir be absolute
cd $srcdir
srcdir=`pwd`
cd $builddir
# Return to home
cd $thisdir
# Locate the cdl and expected directories
cdl="${srcdir}/ncdump/cdl4"
expected="${srcdir}/ncdump/expected4"
# Locate various libraries, programs, etc
# The hard part is locating the HDF5 and Z libraries
NCGEN4=${builddir}/ncgen/ncgen
#NCGEN4=${builddir}/ncgen/.libs/ncgen
NCDUMP=${builddir}/ncdump/ncdump
CC=cc
INCL="-I ${INSTALL}/include"
LIBS="-L${INSTALL}/lib -lnetcdf"
RPATH="-Wl,-rpath,${INSTALL}/lib"
# Define the set of tests that can be
# processed with either the -k nc3 or -k nc4 flag
2010-06-03 21:24:43 +08:00
TESTS3="\
test0 \
nc_enddef \
ref_tst_unicode \
ref_tst_utf8 \
sfc_pres_temp \
simple_xy \
small \
fills \
c0 \
example_good \
nc_sync \
pres_temp_4D \
ref_tst_small \
ref_nctst \
ref_nctst_64bit_offset \
small2 \
tst_ncml \
ref_ctest1_nc4 \
ref_ctest1_nc4c \
ref_nctst_netcdf4 \
ref_nctst_netcdf4_classic"
# Define the set of tests that must be
# processed with the -k nc4 flag
2010-06-03 21:24:43 +08:00
TESTS4="\
ref_dimscope \
ref_typescope \
ref_tst_string_data \
ref_tst_comp \
ref_tst_comp2 \
ref_tst_group_data \
ref_tst_opaque_data \
ref_tst_vlen_data \
ref_tst_solar_1 \
ref_tst_solar_2 \
ref_tst_enum_data \
ref_tst_nans \
ref_tst_special_atts \
ref_const_test"
SPECIALTESTS="ref_tst_special_atts"
XFAILTESTS="ref_tst_special_atts"
# Following are generally not run
# Because of the size of their output
BIGTESTS3="\
bigf1 \
bigf2 \
bigf3 \
bigr1 \
bigr2"
BIGTESTS4="ref_tst_solar_1"
# This test is both big and slow
BIGBIG3="gfs1"
if test "${KFLAG}" = 1 ; then
TESTSET="${TESTS3}"
elif test "${KFLAG}" = 3 ; then
TESTSET="${TESTS3} ${TESTS4}"
else
echo "Bad KFLAG=$KFLAG"
exit 1
fi
set -e
rm -fr results
mkdir results
failcount=0
passcount=0
xfailcount=0
for x in ${TESTSET} ; do
echo "Testing: ${x}"
specflag=""
isxfail=0
for s in $SPECIALTESTS ; do
if test "$x" = "$s" ; then specflag="-s"; fi
done
for s in $XFAILTESTS ; do
if test "$x" = "$s" ; then isxfail=1; fi
done
ok=0;
cd results
if ${NCGEN4} -lc -k${KFLAG} ${cdl}/${x}.cdl >${x}.c
then ok=1; else ok=0; fi
if $CC ${INCL} -c ${x}.c
then ok=1; else ok=0; fi
if $CC -o ${x}.exe ${x}.o ${LIBS} ${RPATH}
then ok=1; else ok=0; fi
if ./${x}.exe
then ok=1; else ok=0; fi
if ${NCDUMP} ${specflag} ${x}.nc > ${x}.dmp
then ok=1; else ok=0; fi
cd ..
if test 1 = 1; then
# compare with expected
if diff -w ${expected}/${x}.dmp results/${x}.dmp
then ok=1; else ok=0; fi
if test "$ok" = "1" ; then
echo "SUCCEED: ${x}"
passcount=`expr $passcount + 1`
elif test $isxfail = 1 ; then
echo "XFAIL : ${x}"
2010-06-03 21:24:43 +08:00
xfailcount=`expr $xfailcount + 1`
else
echo "FAIL: ${x}"
failcount=`expr $failcount + 1`
fi
fi
done
totalcount=`expr $passcount + $failcount + $xfailcount`
okcount=`expr $passcount + $xfailcount`
echo "PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"
#if test $failcount -gt 0 ; then
# exit 1
#else
exit 0
#fi