Merge pull request #665 from NetCDF-World-Domination-Council/ejh_ncdump_3

Autotools build system tweaks and fixes to get make -j check and make -j distcheck working
This commit is contained in:
Ward Fisher 2017-11-21 18:16:33 -07:00 committed by GitHub
commit 64b500cf24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 496 additions and 422 deletions

View File

@ -4,6 +4,7 @@
# This is the main automake file for netCDF. It builds the different
# netcdf directories. Not all directories are built, depending on the
# options selected during configure.
# Ed Hartnett, Ward Fisher
# This directory stores libtool macros, put there by aclocal.
ACLOCAL_AMFLAGS = -I m4
@ -17,10 +18,6 @@ EXTRA_DIST = README.md COPYRIGHT INSTALL.md test_prog.c \
CTestConfig.cmake.in libnetcdf.settings.in netCDFConfig.cmake.in \
CMakeInstallation.cmake test-driver-verbose test_common.in
# Doxygen doesn't build nicely in vpath builds.
# Don't do this; it wipes out any exported values
#DISTCHECK_CONFIGURE_FLAGS = --disable-doxygen
pkgconfigdir=$(libdir)/pkgconfig
pkgconfig_DATA = netcdf.pc
@ -70,16 +67,6 @@ if USE_PNETCDF
LIBSRCP = libsrcp
endif
# Build UDUNITS?
#if BUILD_UDUNITS
#UDUNITS = udunits
#endif
# Build libcf?
#if BUILD_LIBCF
#LIBCF = libcf
#endif
# Define Test directories
if BUILD_TESTSETS
TESTDIRS = $(V2_TEST) nc_test $(NC_TEST4) $(NCDAP2TESTDIR) $(NCDAP4TESTDIR)
@ -88,15 +75,13 @@ endif
# This is the list of subdirs for which Makefiles will be constructed
# and run. ncgen must come before ncdump, because their tests
# depend on it.
SUBDIRS = include $(H5_TEST_DIR) libdispatch libsrc \
$(LIBSRC4_DIR) $(LIBSRCP) $(OCLIB) $(DAP2) ${DAP4} liblib \
$(NCGEN3) $(NCGEN) $(NCDUMP) \
$(TESTDIRS) \
docs $(EXAMPLES) \
$(UDUNITS) $(LIBCF)
SUBDIRS = include $(H5_TEST_DIR) libdispatch libsrc $(LIBSRC4_DIR) \
$(LIBSRCP) $(OCLIB) $(DAP2) ${DAP4} liblib $(NCGEN3) $(NCGEN) \
$(NCDUMP) $(TESTDIRS) docs $(EXAMPLES) $(UDUNITS) $(LIBCF)
# Remove these generated files, for a distclean.
DISTCLEANFILES = VERSION comps.txt test_prog libnetcdf.settings test_common.sh
DISTCLEANFILES = VERSION comps.txt test_prog libnetcdf.settings \
test_common.sh
# The nc-config script helps the user build programs with netCDF.
bin_SCRIPTS = nc-config
@ -105,34 +90,36 @@ bin_SCRIPTS = nc-config
BINFILES = README_BINARIES.txt
BINFILES += include/netcdf.h share/man/man3/netcdf.3 lib/libnetcdf.a
BINFILES += libnetcdf.settings
ZIPBINFILES = ${prefix}/include/netcdf.h ${prefix}/share/man/man3/netcdf.3 ${prefix}/lib/libnetcdf.a
ZIPBINFILES = ${prefix}/include/netcdf.h \
${prefix}/share/man/man3/netcdf.3 ${prefix}/lib/libnetcdf.a
if BUILD_UTILITIES
BINFILES += bin/ncgen3$(EXEEXT) bin/ncgen$(EXEEXT) bin/ncdump$(EXEEXT) \
share/man/man1/ncgen.1 share/man/man1/ncdump.1
ZIPBINFILES += ${prefix}/bin/ncgen3$(EXEEXT) ${prefix}/bin/ncgen$(EXEEXT) ${prefix}/bin/ncdump$(EXEEXT) \
ZIPBINFILES += ${prefix}/bin/ncgen3$(EXEEXT) \
${prefix}/bin/ncgen$(EXEEXT) ${prefix}/bin/ncdump$(EXEEXT) \
${prefix}/share/man/man1/ncgen.1 ${prefix}/share/man/man1/ncdump.1
endif
if BUILD_DLL
BINFILES += bin/libnetcdf-7.dll lib/libnetcdf.dll.a lib/libnetcdf.a \
lib/libnetcdf.la lib/netcdfdll.def
ZIPBINFILES += ${prefix}/bin/libnetcdf-7.dll ${prefix}/lib/libnetcdf.dll.a ${prefix}/lib/libnetcdf.a \
ZIPBINFILES += ${prefix}/bin/libnetcdf-7.dll \
${prefix}/lib/libnetcdf.dll.a ${prefix}/lib/libnetcdf.a \
${prefix}/lib/libnetcdf.la ${prefix}/lib/netcdfdll.def
endif # BUILD_DLL
# install libnetcdf.settings in lib directory.
settingsdir=$(libdir)
settings_DATA=libnetcdf.settings
settingsdir = $(libdir)
settings_DATA = libnetcdf.settings
####
# Provide an entry to rebuild all the m4 generated files
# List of files to create: WARNING leave off the extension
####
MM4= ./nc_test/test_put ./nc_test/test_get \
./nc_test/test_write ./nc_test/test_read \
./libsrc/netcdf ./libsrc/putget ./libsrc/ncx \
MM4= ./nc_test/test_put ./nc_test/test_get ./nc_test/test_write \
./nc_test/test_read ./libsrc/netcdf ./libsrc/putget ./libsrc/ncx \
./libsrc/t_ncxx ./libsrc/attr
mm4::
@ -147,7 +134,6 @@ mm4::
# install-netcdf-fortran.
#####
###
# build-netcdf-fortran
###
@ -186,22 +172,8 @@ check_nc_config:
$(CC) `./nc-config --cflags` test_prog.c -o test_prog `./nc-config --libs`
./test_prog
# Build nc_test/test_common.sh
# Complicated by need to create during distcheck
# which uses a read-only source tree
#all-local:
# rm -f ${top_builddir}/nc_test/test_common.sh
# cat /dev/null > ${top_builddir}/nc_test/test_common.sh
# chmod a+x ${top_builddir}/nc_test/test_common.sh
# sed -e "s|@TOPSRCDIR@|${abs_top_srcdir}|" -e "s|@TOPBUILDDIR@|${abs_top_builddir}|" <${top_srcdir}/test_common.in >>${top_builddir}/test_common.sh
install-data-hook:
# if BUILD_FORTRAN
# chmod u+x $(abs_top_builddir)/postinstall.sh
# sh -c "$(abs_top_builddir)/postinstall.sh -t autotools"
#endif
if BUILD_DLL
cp liblib/netcdfdll.def $(DESTDIR)${prefix}/bin
endif # BUILD_DLL

View File

@ -3,6 +3,7 @@
# This is part of Unidata's netCDF package. Copyright 2005-2012, see
# the COPYRIGHT file for more information.
# Ed Hartnett, Ward Fisher, Dennis Heimbigner
# Recall that ${VAR-exp} expands to $VAR if var is set (even to null),
# and to exp otherwise.
@ -473,18 +474,6 @@ fi
AM_CONDITIONAL(USE_CDF5, [test x$enable_cdf5 = xyes ])
AM_CONDITIONAL(ENABLE_CDF5, [test x$enable_cdf5 = xyes ])
# Does the user want to do some extra tests?
AC_MSG_CHECKING([whether netCDF extra tests should be run (developers only)])
AC_ARG_ENABLE([extra-tests],
[AS_HELP_STRING([--enable-extra-tests],
[enable some extra tests that may not pass because of known issues])])
test "x$enable_extra_tests" = xyes || enable_extra_tests=no
AC_MSG_RESULT($enable_extra_tests)
if test "x$enable_extra_tests" = xyes; then
AC_DEFINE([EXTRA_TESTS], [1], [if true, run extra tests which may not work yet])
fi
AM_CONDITIONAL(EXTRA_TESTS, [test x$enable_extra_tests = xyes])
# Does the user want to use the ffio module?
AC_MSG_CHECKING([whether FFIO will be used])
AC_ARG_ENABLE([ffio],
@ -509,19 +498,6 @@ if test "x$enable_stdio" = xyes; then
fi
AM_CONDITIONAL(USE_STDIO, [test x$enable_stdio = xyes])
# Does the user want to enable the user-provided NEC-SX vectorization
# patch.
dnl AC_MSG_CHECKING([whether netCDF NEC-SX vectorization patch is enabled])
dnl AC_ARG_ENABLE([sx-vectorization],
dnl [AS_HELP_STRING([--enable-sx-vectorization],
dnl [enable a user-provided performance patch to allow \
dnl vectorization of type conversions on NEC SX machines.])])
dnl test "x$enable_sx_vectorization" = xyes || enable_sx_vectorization=no
dnl AC_MSG_RESULT([$enable_sx_vectorization])
dnl if test "x$enable_sx_vectorization" = xyes; then
dnl AC_DEFINE([SX_VECTORIZATION], 1, [if true, turn on vectorization patch for NEC SX])
dnl fi
nc_build_c=yes
nc_build_v2=yes
nc_build_utilities=yes

View File

@ -6,8 +6,7 @@
# Put together AM_CPPFLAGS and AM_LDFLAGS.
include $(top_srcdir)/lib_flags.am
#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
TEST_EXTENSIONS = .sh
LDADD = ${top_builddir}/liblib/libnetcdf.la
AM_CPPFLAGS += -I$(top_srcdir)/libdap4
@ -33,6 +32,11 @@ TESTS += test_meta.sh
TESTS += test_data.sh
endif
# Note which tests depend on other tests. Necessary for make -j check.
test_raw.log: test_parse.log
test_meta.log: test_raw.log
test_data.log: test_meta.log
if ENABLE_DAP_REMOTE_TESTS
# Note: This program name was changed to findtestserver4
# to avoid cmake complaint about duplicate targets.

View File

@ -11,20 +11,21 @@ cd ${DAPTESTFILES}
F=`ls -1 *.dap | sed -e 's/[.]dap//g' | tr '\r\n' ' '`
cd $WD
mkdir ./results_test_data
if test "x${RESET}" = x1 ; then rm -fr ${BASELINE}/*.d4d ; fi
for f in $F ; do
echo "testing: ${f}"
if ! ${VG} ${execdir}/test_data ${DAPTESTFILES}/${f} ./results/${f}.nc ; then
failure "${execdir}/test_data ${DAPTESTFILES}/${f} ./results/${f}.nc"
if ! ${VG} ${execdir}/test_data ${DAPTESTFILES}/${f} ./results_test_data/${f}.nc ; then
failure "${execdir}/test_data ${DAPTESTFILES}/${f} ./results_test_data/${f}.nc"
fi
${NCDUMP} ./results/${f}.nc > ./results/${f}.d4d
${NCDUMP} ./results_test_data/${f}.nc > ./results_test_data/${f}.d4d
if test "x${TEST}" = x1 ; then
if ! diff -wBb ${BASELINE}/${f}.d4d ./results/${f}.d4d ; then
failure "diff -wBb ${BASELINE}/${f}.d4d ./results/${f}.d4d"
if ! diff -wBb ${BASELINE}/${f}.d4d ./results_test_data/${f}.d4d ; then
failure "diff -wBb ${BASELINE}/${f}.d4d ./results_test_data/${f}.d4d"
fi
elif test "x${RESET}" = x1 ; then
echo "${f}:"
cp ./results/${f}.d4d ${BASELINE}/${f}.d4d
cp ./results_test_data/${f}.d4d ${BASELINE}/${f}.d4d
fi
done
@ -75,10 +76,10 @@ if test "x${CDLDIFF}" = x1 ; then
echo "Not found: ${CDLTESTFILES}/${STEM}.cdl"
continue
fi
echo "diff -wBb ${CDLTESTFILES}/${STEM}.cdl ./results/${f}.d4d"
echo "diff -wBb ${CDLTESTFILES}/${STEM}.cdl ./results_test_data/${f}.d4d"
rm -f ./b1 ./b2 ./r1 ./r2
trim ${CDLTESTFILES}/${STEM}.cdl ./b1
trim ./results/${f}.d4d ./r1
trim ./results_test_data/${f}.d4d ./r1
baseclean b1 b2
resultclean r1 r2
if ! diff -wBb ./b2 ./r2 ; then
@ -86,6 +87,7 @@ if test "x${CDLDIFF}" = x1 ; then
fi
done
fi
rm -rf ./results_test_data
finish

View File

@ -23,35 +23,36 @@ done
if test "x${RESET}" = x1 ; then rm -fr ${BASELINE}/*.d4m ; fi
mkdir ./results_test_meta
for f in ${F} ; do
echo "checking: $f"
if ! ${VG} ${execdir}/test_meta ${DMRTESTFILES}/${f}.dmr ./results/${f} ; then
failure "${execdir}/test_meta ${DMRTESTFILES}/${f}.dmr ./results/${f}"
if ! ${VG} ${execdir}/test_meta ${DMRTESTFILES}/${f}.dmr ./results_test_meta/${f} ; then
failure "${execdir}/test_meta ${DMRTESTFILES}/${f}.dmr ./results_test_meta/${f}"
fi
${NCDUMP} -h ./results/${f} > ./results/${f}.d4m
${NCDUMP} -h ./results_test_meta/${f} > ./results_test_meta/${f}.d4m
if test "x${TEST}" = x1 ; then
if ! diff -wBb ${BASELINE}/${f}.d4m ./results/${f}.d4m ; then
failure "diff -wBb ${BASELINE}/${f}.ncdump ./results/${f}.d4m"
if ! diff -wBb ${BASELINE}/${f}.d4m ./results_test_meta/${f}.d4m ; then
failure "diff -wBb ${BASELINE}/${f}.ncdump ./results_test_meta/${f}.d4m"
fi
elif test "x${RESET}" = x1 ; then
echo "${f}:"
cp ./results/${f}.d4m ${BASELINE}/${f}.d4m
cp ./results_test_meta/${f}.d4m ${BASELINE}/${f}.d4m
fi
done
if test "x${CDLDIFF}" = x1 ; then
for f in $CDL ; do
echo "diff -wBb ${CDLTESTFILES}/${f}.cdl ./results/${f}.d4m"
echo "diff -wBb ${CDLTESTFILES}/${f}.cdl ./results_test_meta/${f}.d4m"
rm -f ./tmp
cat ${CDLTESTFILES}/${f}.cdl \
cat >./tmp
echo diff -wBbu ./tmp ./results/${f}.d4m
if ! diff -wBbu ./tmp ./results/${f}.d4m ; then
echo diff -wBbu ./tmp ./results_test_meta/${f}.d4m
if ! diff -wBbu ./tmp ./results_test_meta/${f}.d4m ; then
failure "${f}"
fi
done
fi
rm -rf ./results_test_meta
finish

View File

@ -11,20 +11,21 @@ cd ${DMRTESTFILES}
F=`ls -1 *.dmr | sed -e 's/[.]dmr//' |tr '\r\n' ' '`
cd $WD
mkdir ./results_test_parse
if test "x${RESET}" = x1 ; then rm -fr ${BASELINE}/*.d4p ; fi
for f in $F ; do
echo "testing: $f"
if ! ${VG} ${execdir}/test_parse ${DMRTESTFILES}/${f}.dmr > ./results/${f}.d4p ; then
if ! ${VG} ${execdir}/test_parse ${DMRTESTFILES}/${f}.dmr > ./results_test_parse/${f}.d4p ; then
failure "${f}"
fi
if test "x${TEST}" = x1 ; then
if ! diff -wBb ${BASELINE}/${f}.d4p ./results/${f}.d4p ; then
if ! diff -wBb ${BASELINE}/${f}.d4p ./results_test_parse/${f}.d4p ; then
failure "${f}"
fi
elif test "x${DIFF}" = x1 ; then
echo "diff -wBb ${DMRTESTFILES}/${f}.dmr ./results/${f}.d4p"
echo "diff -wBb ${DMRTESTFILES}/${f}.dmr ./results_test_parse/${f}.d4p"
rm -f ./tmp
cat ./results/${f}.d4p \
cat ./results_test_parse/${f}.d4p \
| sed -e '/<Dimensions>/d' -e '/<Types>'/d -e '/<Variables>'/d -e '/<Groups>'/d \
| sed -e '/<\/Dimensions>/d' -e '/<\/Types>'/d -e '/<\/Variables>'/d -e '/<\/Groups>'/d \
| sed -e '/_edu.ucar.opaque.size/,+2d' \
@ -34,9 +35,10 @@ for f in $F ; do
fi
elif test "x${RESET}" = x1 ; then
echo "${f}:"
cp ./results/${f}.d4p ${BASELINE}/${f}.d4p
cp ./results_test_parse/${f}.d4p ${BASELINE}/${f}.d4p
fi
done
rm -rf ./results_test_parse
finish

View File

@ -40,20 +40,21 @@ resultclean() {
fi
}
mkdir ./results_test_raw
if test "x${RESET}" = x1 ; then rm -fr ${BASELINERAW}/*.dmp ; fi
for f in $F ; do
echo "testing: $f"
URL="[dap4]file://${DAPTESTFILES}/${f}"
if ! ${VG} ${NCDUMP} "${URL}" > ./results/${f}.dmp; then
if ! ${VG} ${NCDUMP} "${URL}" > ./results_test_raw/${f}.dmp; then
failure "${URL}"
fi
if test "x${TEST}" = x1 ; then
if ! diff -wBb ${BASELINERAW}/${f}.dmp ./results/${f}.dmp ; then
if ! diff -wBb ${BASELINERAW}/${f}.dmp ./results_test_raw/${f}.dmp ; then
failure "diff ${f}.dmp"
fi
elif test "x${RESET}" = x1 ; then
echo "${f}:"
cp ./results/${f}.dmp ${BASELINERAW}/${f}.dmp
cp ./results_test_raw/${f}.dmp ${BASELINERAW}/${f}.dmp
elif test "x${DIFF}" = x1 ; then
echo "hdrtest: ${f}"
rm -f ./tr1 ./tr2 ./tb1 ./tb2
@ -63,6 +64,7 @@ for f in $F ; do
fi
fi
done
rm -rf ./results_test_raw
finish

View File

@ -11,7 +11,7 @@ ENDFOREACH()
## Specify files to be distributed by 'make dist'
FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am)
SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am run_examples.sh run_examples4.sh)
ADD_EXTRA_DIST("${CUR_EXTRA_DIST}")

View File

@ -3,33 +3,37 @@
# This file builds the C examples.
# $Id: Makefile.am,v 1.26 2010/05/29 00:17:41 dmh Exp $
# Ed Hartnett
LDADD = -lm
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_LDFLAGS =
# These are the netCDF-3 examples.
TESTPROGRAMS = simple_xy_wr simple_xy_rd sfc_pres_temp_wr \
check_PROGRAMS = simple_xy_wr simple_xy_rd sfc_pres_temp_wr \
sfc_pres_temp_rd pres_temp_4D_wr pres_temp_4D_rd
TESTS = run_examples.sh
# To build netcdf-4, or not to build netcdf-4, that is the question...
if USE_NETCDF4
# These are the extra netCDF-4 examples.
TESTPROGRAMS += simple_nc4_wr simple_nc4_rd simple_xy_nc4_wr \
check_PROGRAMS += simple_nc4_wr simple_nc4_rd simple_xy_nc4_wr \
simple_xy_nc4_rd
endif #USE_NETCDF4
if USE_PNETCDF
# These are the extra netCDF-4 examples.
TESTPROGRAMS += parallel_vara
check_PROGRAMS += parallel_vara
TESTS += parallel_vara
endif #USE_PNETCDF
AM_CPPFLAGS += -I$(top_builddir)/liblib
AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la
check_PROGRAMS = $(TESTPROGRAMS)
TESTS = $(TESTPROGRAMS)
if USE_NETCDF4
TESTS += run_examples4.sh
endif #USE_NETCDF4
# This will run a bunch of the test programs with valgrind, the memory
# checking tool. (Valgrind must be present for this to work.)
@ -43,7 +47,7 @@ endif # USE_VALGRIND_TESTS
endif # USE_NETCDF4
# These files are created by the tests.
CLEANFILES = sfc_pres_temp.nc simple_xy.nc pres_temp_4D.nc \
simple_nc4.nc simple_xy_nc4.nc testfile.nc
CLEANFILES = *.nc
EXTRA_DIST = run_valgrind_tests.sh run_nc4_valgrind_tests.sh CMakeLists.txt
EXTRA_DIST = run_valgrind_tests.sh run_nc4_valgrind_tests.sh \
CMakeLists.txt run_examples.sh run_examples4.sh

24
examples/C/run_examples.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
# This shell script runs the examples.
# Ed Hartnett
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../../test_common.sh
echo "*** Running examples."
set -e
echo "*** running simple_xy examples..."
${execdir}/simple_xy_wr
${execdir}/simple_xy_rd
echo "*** running sfc_pres_temp examples..."
${execdir}/sfc_pres_temp_wr
${execdir}/sfc_pres_temp_rd
echo "*** running pres_temp_4D examples..."
${execdir}/pres_temp_4D_wr
${execdir}/pres_temp_4D_rd
echo "*** Examples successful!"
exit 0

20
examples/C/run_examples4.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# This shell script runs the examples for netCDF4.
# Ed Hartnett
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../../test_common.sh
echo "*** Running examples for netCDF-4."
set -e
echo "*** running simple_nc4 examples..."
${execdir}/simple_nc4_wr
${execdir}/simple_nc4_rd
echo "*** running simple_xy_nc4 examples..."
${execdir}/simple_xy_nc4_wr
${execdir}/simple_xy_nc4_rd
echo "*** Examples successful!"
exit 0

View File

@ -1,20 +1,22 @@
## This is a automake file, part of Unidata's netCDF package.
# Copyright 2006, see the COPYRIGHT file for more information.
# This file builds CDL examples.
# Ed Hartnett
# $Id: Makefile.am,v 1.3 2009/05/19 11:56:50 ed Exp $
# Note which tests depend on other tests. Necessary for make -j check.
TEST_EXTENSIONS = .sh
# All we do is run two shell scripts, which create the sample files
# and then compare them with the C versions of the examples.
#if !BUILD_DLL
TESTS = create_sample_files.sh do_comps.sh
#endif
# Record dependencies between test scripts.
do_comps.log: create_sample_files.log
# Ship the scripts needed to create the sample files and compare them.
EXTRA_DIST = do_comps.sh create_sample_files.sh simple_xy.cdl \
sfc_pres_temp.cdl pres_temp_4D.cdl CMakeLists.txt
# Clean up files created during the process.
CLEANFILES = simple_xy.nc sfc_pres_temp.nc pres_temp_4D.nc
CLEANFILES = *.nc

View File

@ -15,8 +15,8 @@ include $(top_srcdir)/lib_flags.am
# that netCDF-4 needs.
H5TESTS = tst_h_files tst_h_files2 tst_h_files4 tst_h_atts \
tst_h_atts3 tst_h_atts4 tst_h_vars tst_h_vars2 tst_h_vars3 tst_h_grps \
tst_h_compounds tst_h_compounds2 tst_h_wrt_cmp tst_h_rd_cmp tst_h_vl \
tst_h_opaques tst_h_strings tst_h_strings1 tst_h_strings2 tst_h_ints \
tst_h_compounds tst_h_compounds2 tst_h_wrt_cmp tst_h_vl tst_h_opaques \
tst_h_strings tst_h_strings1 tst_h_strings2 tst_h_ints \
tst_h_dimscales tst_h_dimscales1 tst_h_dimscales2 tst_h_dimscales3 \
tst_h_enums tst_h_dimscales4 #tst_h_filters

View File

@ -2,7 +2,7 @@
Copyright 2007 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
Test HDF5 compound types.
n Test HDF5 compound types.
*/
#include "h5_err_macros.h"

View File

@ -42,37 +42,69 @@ main()
printf("\n*** Checking HDF5 compound types (even more so).\n");
printf("*** Checking packing of HDF5 compound types...");
/* Open file and create group. */
if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
access_plist)) < 0) ERR;
{
/* Open file and create group. */
if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT,
access_plist)) < 0) ERR;
/* Create a simple compound type. */
if ((typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) ERR;
if (H5Tinsert(typeid, "c1", HOFFSET(struct s1, c1), H5T_NATIVE_UCHAR) < 0) ERR;
if (H5Tinsert(typeid, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) ERR;
if (H5Tcommit(fileid, COMPOUND_NAME, typeid) < 0) ERR;
/* Create a simple compound type. */
if ((typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) ERR;
if (H5Tinsert(typeid, "c1", HOFFSET(struct s1, c1), H5T_NATIVE_UCHAR) < 0) ERR;
if (H5Tinsert(typeid, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) ERR;
if (H5Tcommit(fileid, COMPOUND_NAME, typeid) < 0) ERR;
/* Create a space. */
dims[0] = DIM1_LEN;
if ((spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR;
/* Create a space. */
dims[0] = DIM1_LEN;
if ((spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR;
/* Create a dataset of this compound type. */
if ((datasetid = H5Dcreate(fileid, VAR_NAME, typeid, spaceid,
H5P_DEFAULT)) < 0) ERR;
/* Create a dataset of this compound type. */
if ((datasetid = H5Dcreate(fileid, VAR_NAME, typeid, spaceid,
H5P_DEFAULT)) < 0) ERR;
/* Write some data. */
if (H5Dwrite(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data) < 0) ERR;
/* Write some data. */
if (H5Dwrite(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data) < 0) ERR;
/* Release all resources. */
if (H5Pclose(access_plist) < 0) ERR;
if (H5Tclose(typeid) < 0) ERR;
if (H5Sclose(spaceid) < 0) ERR;
if (H5Fclose(fileid) < 0) ERR;
/* Release all resources. */
if (H5Pclose(access_plist) < 0) ERR;
if (H5Tclose(typeid) < 0) ERR;
if (H5Sclose(spaceid) < 0) ERR;
if (H5Fclose(fileid) < 0) ERR;
}
SUMMARIZE_ERR;
printf("*** Checking packing of HDF5 compound types...");
{
/* Open file. */
if ((access_plist = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
if (H5Pset_fclose_degree(access_plist, H5F_CLOSE_STRONG)) ERR;
if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, access_plist)) < 0) ERR;
/* Open dataset. */
if ((datasetid = H5Dopen1(fileid, VAR_NAME)) < 0) ERR;
/* Check space. */
if ((spaceid = H5Dget_space(datasetid)) < 0) ERR;
if (H5Sget_simple_extent_ndims(spaceid) != 1) ERR;
if (H5Sget_simple_extent_npoints(spaceid) != DIM1_LEN) ERR;
/* Get type. */
if ((typeid = H5Dget_type(datasetid)) < 0) ERR;
/* if ((native_type = H5Tget_native_type(typeid, H5T_DIR_DEFAULT)) < 0) ERR;*/
/* Read the data. */
if (H5Dread(datasetid, typeid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
data) < 0) ERR;
/* Check the data. */
for (i=0; i<DIM1_LEN; i++)
if (data[i].c1 != 126 || data[i].d != -9999999) ERR;
/* Release all resources. */
if (H5Fclose(fileid) < 0) ERR;
}
SUMMARIZE_ERR;
FINAL_RESULTS;
}

View File

@ -42,10 +42,6 @@ IF(LARGE_FILE_TESTS)
ENDIF()
IF(USE_HDF4)
SET(NC4_TESTS ${NC4_TESTS} tst_interops2)
ENDIF()
IF(USE_SZIP)
BUILD_BIN_TEST(test_szip)
BUILD_BIN_TEST(h5testszip)
@ -84,7 +80,9 @@ ENDFOREACH()
# immediately above this comment.
IF(USE_HDF4_FILE_TESTS AND NOT MSVC)
add_sh_test(nc_test4 run_get_hdf4_files)
add_bin_test_no_prefix(tst_interops2)
add_bin_test(nc_test4 tst_interops3)
add_bin_test(nc_test4 tst_bug324)
add_sh_test(nc_test4 tst_formatx_hdf4)
build_bin_test(tst_chunk_hdf4)
add_sh_test(nc_test4 run_chunk_hdf4)

View File

@ -3,7 +3,7 @@
# See COPYRIGHT file for conditions of use.
#
# This entire directory will be skipped if netCDF-4 is not enabled.
#
# Ed Hartnett
# Put together AM_CPPFLAGS and AM_LDFLAGS.
include $(top_srcdir)/lib_flags.am
@ -20,16 +20,15 @@ tst_interops6 tst_enums tst_coords tst_coords2 tst_coords3 tst_vars3 \
tst_vars4 tst_chunks tst_chunks2 tst_utf8 tst_fills tst_fills2 \
tst_fillbug tst_xplatform tst_xplatform2 tst_endian_fill tst_atts \
t_type cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2 \
tst_vars2 tst_files5 tst_files6 tst_sync \
tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite \
tst_hdf5_file_compat tst_fill_attr_vanish tst_rehash tst_filterparser
tst_vars2 tst_files5 tst_files6 tst_sync tst_h_scalar tst_rename \
tst_h5_endians tst_atts_string_rewrite tst_hdf5_file_compat \
tst_fill_attr_vanish tst_rehash tst_filterparser tst_bug324
# Temporary I hope
if !ISCYGWIN
NC4_TESTS += tst_h_strbug tst_h_refs
endif
check_PROGRAMS = $(NC4_TESTS) renamegroup tst_empty_vlen_unlim
# Add these if large file tests are turned on.
@ -40,7 +39,7 @@ endif
TESTS = $(NC4_TESTS)
if BUILD_UTILITIES
TESTS += run_grp_rename.sh tst_misc.sh
TESTS += run_grp_rename.sh tst_misc.sh
endif
TESTS += run_empty_vlen_test.sh
@ -77,9 +76,8 @@ tst_knmi_SOURCES = tst_knmi.c tst_utils.c
#WARNING: test_knmi depends on run_get_knmi_files.sh,
# so they must appear in the appropriate order.
TESTS += tst_ar4_3d tst_create_files run_bm_test1.sh run_bm_elena.sh \
run_bm_test2.sh run_tst_chunks.sh tst_files2 tst_files3 \
tst_ar5 tst_h_files3 tst_mem \
run_get_knmi_files.sh tst_knmi
run_bm_test2.sh run_tst_chunks.sh tst_files2 tst_files3 tst_ar5 \
tst_h_files3 tst_mem run_get_knmi_files.sh tst_knmi
# This will run a parallel I/O benchmark for parallel builds.
if TEST_PARALLEL4
@ -97,13 +95,17 @@ endif # BUILD_BENCHMARKS
# These are the tests for HDF4.
if USE_HDF4
check_PROGRAMS += tst_interops2 tst_chunk_hdf4 tst_h4_lendian
TESTS += tst_interops2 tst_formatx_hdf4.sh run_chunk_hdf4.sh tst_h4_lendian
if BUILD_UTILITIES
# This test script depends on ncdump.
TESTS += tst_formatx_hdf4.sh
endif # BUILD_UTILITIES
TESTS += run_chunk_hdf4.sh tst_h4_lendian
if USE_HDF4_FILE_TESTS
check_PROGRAMS += tst_interops3
TESTS += run_get_hdf4_files.sh tst_interops3 tst_hdf4_read_var.sh
endif # USE_HDF4_FILE_TESTS
#tst_interops2_LDADD = ${lib_LTLIBRARIES} -lmfhdf -ldf -ljpeg -lhdf5_hl \
#-lhdf5 -lz
endif # USE_HDF4
# Szip Tests (requires ncdump)
@ -132,33 +134,36 @@ tst_parallel4 tst_nc4perf tst_mode tst_simplerw_coll_r
TESTS += run_par_test.sh
endif
EXTRA_DIST = run_par_test.sh run_bm.sh run_bm_test1.sh run_bm_test2.sh \
run_bm_radar_2D.sh run_bm_radar_2D_compression1.sh run_par_bm_test.sh \
run_bm_elena.sh run_par_bm_radar_2D.sh run_bm_radar_2D_endianness1.sh \
run_tst_chunks.sh ref_chunks1.cdl ref_chunks2.cdl \
run_get_hdf4_files.sh run_valgrind_tests.sh run_valgrind_tests2.sh \
run_bm_ar4.sh ref_tst_compounds.nc run_hdf4_valgrind_tests.sh \
ref_tst_xplatform2_1.nc ref_tst_xplatform2_2.nc ref_tst_dims.nc \
ref_tst_interops4.nc run_get_knmi_files.sh CMakeLists.txt \
run_grp_rename.sh tst_formatx_hdf4.sh run_chunk_hdf4.sh \
tst_h5_endians.c tst_h4_lendian.c tst_atts_string_rewrite.c \
tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c run_empty_vlen_test.sh \
ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc tst_misc.sh \
tdset.h5 tst_hdf4_read_var.sh ref_contiguous.hdf4 ref_chunked.hdf4 \
tst_szip.sh ref_szip.h5 ref_szip.cdl
EXTRA_DIST = run_par_test.sh run_bm.sh run_bm_test1.sh \
run_bm_test2.sh run_bm_radar_2D.sh run_bm_radar_2D_compression1.sh \
run_par_bm_test.sh run_bm_elena.sh run_par_bm_radar_2D.sh \
run_bm_radar_2D_endianness1.sh run_tst_chunks.sh ref_chunks1.cdl \
ref_chunks2.cdl run_get_hdf4_files.sh run_valgrind_tests.sh \
run_valgrind_tests2.sh run_bm_ar4.sh ref_tst_compounds.nc \
run_hdf4_valgrind_tests.sh ref_tst_xplatform2_1.nc \
ref_tst_xplatform2_2.nc ref_tst_dims.nc ref_tst_interops4.nc \
run_get_knmi_files.sh CMakeLists.txt run_grp_rename.sh \
tst_formatx_hdf4.sh run_chunk_hdf4.sh tst_h5_endians.c \
tst_h4_lendian.c tst_atts_string_rewrite.c \
tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c \
run_empty_vlen_test.sh ref_hdf5_compat1.nc ref_hdf5_compat2.nc \
ref_hdf5_compat3.nc tst_misc.sh tdset.h5 tst_hdf4_read_var.sh \
ref_contiguous.hdf4 ref_chunked.hdf4 tst_szip.sh ref_szip.h5 \
ref_szip.cdl
CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt \
radar_3d_compression.txt radar_2d_compression.txt \
radar_3d_chunking.txt tst_floats_1D.cdl floats_1D_3.nc floats_1D.cdl \
tst_*.nc tst_floats2_*.cdl tst_ints2_*.cdl tst_shorts2_*.cdl \
tst_elena_*.cdl tst_simple*.cdl tst_chunks.cdl pr_A1.* tauu_A1.* \
usi_01.* thetau_01.* tst_*.nc tst_*.h5 \
tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \
foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc tst_empty_vlen_lim.nc \
tst_parallel4_simplerw_coll.nc tst_fill_attr_vanish.nc tst_rehash.nc \
testszip.nc test.h5 szip_dump.cdl
CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
bm_radar.nc bm_radar1.nc radar_3d_compression_test.txt \
radar_3d_compression.txt radar_2d_compression.txt \
radar_3d_chunking.txt tst_floats_1D.cdl floats_1D_3.nc floats_1D.cdl \
tst_*.nc tst_floats2_*.cdl tst_ints2_*.cdl tst_shorts2_*.cdl \
tst_elena_*.cdl tst_simple*.cdl tst_chunks.cdl pr_A1.* tauu_A1.* \
usi_01.* thetau_01.* tst_*.nc tst_*.h5 tst_grp_rename.cdl \
tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl foo1.nc \
tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc \
tst_empty_vlen_lim.nc tst_parallel4_simplerw_coll.nc \
tst_fill_attr_vanish.nc tst_rehash.nc testszip.nc test.h5 \
szip_dump.cdl
if USE_HDF4_FILE_TESTS
DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \

View File

@ -1,6 +1,6 @@
#!/bin/sh
# This shell script tests the output several previous tests.
# $Id: tst_output.sh,v 1.17 2010/05/14 16:21:15 ed Exp $
# Ed Hartnett
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
@ -13,16 +13,19 @@ echo ""
echo "*** Testing extended file format output."
set -e
echo "Creating HDF4 file"
${execdir}/tst_interops2
echo "Test extended format output for a HDF4 file"
rm -f tmp
${NCDUMP} -K $FILE >tmp
if ! fgrep 'HDF4 mode=00001000' <tmp ; then
TMP=`cat tmp`
rm -f tmp_tst_formatx_hdf4
${NCDUMP} -K $FILE >tmp_tst_formatx_hdf4
if ! fgrep 'HDF4 mode=00001000' <tmp_tst_formatx_hdf4 ; then
TMP=`cat tmp_tst_formatx_hdf4`
echo "*** Fail: extended format for an HDF4 file: result=" $TMP
ECODE=1
fi
rm -f tmp
rm -f tmp_tst_formatx_hdf4
exit $ECODE

View File

@ -10,9 +10,9 @@ EXPECTED="${srcdir}/expected3"
URL='[log][cache]file://'
URL="${URL}${srcdir}/testdata3/$F"
rm -f ./tmp
${NCDUMP} "${URL}" | sed 's/\\r//g' > ./tmp
diff -w ${EXPECTED}/$F.dmp ./tmp
rm -f ./tmp_tst_ber
${NCDUMP} "${URL}" | sed 's/\\r//g' > ./tmp_tst_ber
diff -w ${EXPECTED}/$F.dmp ./tmp_tst_ber
#cleanup
rm -f ./tmp
rm -f ./tmp_tst_ber
exit

View File

@ -19,13 +19,13 @@ URL="$DTS/test.03"
ECODE=0
echo "Test extended format output for a DAP2 file"
rm -f tmp
${NCDUMP} -K "${URL}" >tmp
if ! grep 'DAP2 mode=00000000' <tmp ; then
rm -f tmp_tst_formatx
${NCDUMP} -K "${URL}" >tmp_tst_formatx
if ! grep 'DAP2 mode=00000000' <tmp_tst_formatx ; then
echo "*** Fail: extended format for a DAP2 file"
ECODE=1
fi
rm tmp
rm tmp_tst_formatx
exit $ECODE

View File

@ -44,7 +44,7 @@ remote*)
;;
esac
RESULTSDIR="./results"
RESULTSDIR="./results_tst_ncdap"
#
if test "x$leakcheck" = "x1" ; then
VALGRIND="valgrind -q --error-exitcode=2 --leak-check=full"
@ -109,7 +109,7 @@ echo "pwd=" `pwd`
totalcount=`expr $passcount + $failcount + $xfailcount`
okcount=`expr $passcount + $xfailcount`
rm -fr ${RESULTSDIR}
echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"
#failcount=0

View File

@ -108,7 +108,7 @@ ENDIF()
add_sh_test(ncdump tst_output)
add_sh_test(ncdump tst_lengths)
add_sh_test(ncdump tst_calendars)
add_bin_test(ncdump tst_utf8)
add_bin_test_no_prefix(tst_utf8)
add_sh_test(ncdump run_utf8_tests)
IF(USE_NETCDF4)
add_sh_test(ncdump run_utf8_nc4_tests)
@ -145,17 +145,16 @@ ENDIF()
ENDIF(BUILD_DISKLESS)
IF(USE_NETCDF4)
add_bin_test(ncdump tst_create_files)
add_bin_test(ncdump tst_group_data)
add_bin_test(ncdump tst_enum_data)
add_bin_test(ncdump tst_opaque_data)
add_bin_test(ncdump tst_string_data)
add_bin_test(ncdump tst_vlen_data)
add_bin_test(ncdump tst_comp)
add_bin_test(ncdump tst_comp2)
add_bin_test(ncdump tst_nans)
add_bin_test(ncdump tst_h_scalar)
add_bin_test(ncdump tst_bug324)
add_bin_test_no_prefix(tst_create_files)
add_bin_test_no_prefix(tst_group_data)
add_bin_test_no_prefix(tst_enum_data)
add_bin_test_no_prefix(tst_opaque_data)
add_bin_test_no_prefix(tst_string_data)
add_bin_test_no_prefix(tst_vlen_data)
add_bin_test_no_prefix(tst_comp)
add_bin_test_no_prefix(tst_comp2)
add_bin_test_no_prefix(tst_nans)
add_bin_test_no_prefix(tst_h_scalar)
add_sh_test(ncdump tst_formatx4)
# Add this test by hand, as it is also called from a script.
# Editing the script would break autotools compatibility.
@ -177,12 +176,12 @@ ENDIF()
# is different, but the result is actually correct.
#IF(NOT MSVC)
add_sh_test(ncdump tst_netcdf4)
add_bin_test(ncdump tst_h_rdc0)
add_bin_test_no_prefix(tst_h_rdc0)
#ENDIF()
add_bin_test(ncdump tst_unicode)
add_bin_test_no_prefix(tst_unicode)
add_bin_test(ncdump tst_fillbug)
add_bin_test_no_prefix(tst_fillbug)
add_sh_test(ncdump_sh tst_fillbug)
IF(NOT MSVC)

View File

@ -8,11 +8,11 @@
include $(top_srcdir)/lib_flags.am
LDADD = ${top_builddir}/liblib/libnetcdf.la
#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
# Note which tests depend on other tests. Necessary for make -j check.
TEST_EXTENSIONS = .sh
TESTS_ENVIRONMENT=CC=${CC}
XFAIL_TESTS=""
# This is the program we're building, and it's sources.
bin_PROGRAMS = ncdump
ncdump_SOURCES = ncdump.c vardata.c dumplib.c indent.c nctime0.c \
@ -25,6 +25,7 @@ bin_PROGRAMS += nccopy
nccopy_SOURCES = nccopy.c nciter.c nciter.h chunkspec.h chunkspec.c \
utils.h utils.c dimmap.h dimmap.c
# A simple netcdf-4 metadata -> xml printer. Do not install.
if USE_NETCDF4
noinst_PROGRAMS = nc4print
nc4print_SOURCES = nc4print.c
@ -40,20 +41,25 @@ endif
man_MANS = ncdump.1 nccopy.1
if BUILD_TESTSETS
# These tests are run for both netCDF-4 and non-netCDF-4 builds.
# C programs needed by shell scritps for classic tests.
check_PROGRAMS = rewrite-scalar ref_ctest ref_ctest64 ncdump tst_utf8 \
bom tst_dimsizes nctrunc
TESTS = tst_ctest.sh tst_inttags.sh run_tests.sh tst_64bit.sh \
ref_ctest64 tst_output.sh tst_lengths.sh tst_calendars.sh tst_utf8 \
run_utf8_tests.sh tst_nccopy3.sh tst_nccopy3_subset.sh \
tst_charfill.sh tst_iter.sh tst_formatx3.sh tst_bom.sh \
tst_dimsizes.sh run_ncgen_tests.sh
# Tests for classic and 64-bit offset files.
TESTS = tst_inttags.sh run_tests.sh tst_64bit.sh ref_ctest \
ref_ctest64 tst_ctest.sh tst_output.sh tst_lengths.sh \
tst_calendars.sh run_utf8_tests.sh tst_nccopy3.sh \
tst_nccopy3_subset.sh tst_charfill.sh tst_iter.sh tst_formatx3.sh \
tst_bom.sh tst_dimsizes.sh run_ncgen_tests.sh tst_ncgen4_classic.sh
if USE_NETCDF4
check_PROGRAMS += tst_fileinfo
TESTS += tst_fileinfo.sh tst_hdf5_offset.sh run_ncgen_nc4_tests.sh
endif
# Record dependencies between classic test scripts.
tst_nccopy3.log: tst_calendars.log run_utf8_tests.log tst_output.log \
tst_64bit.log run_tests.log tst_lengths.log
run_ncgen_tests.log: tst_output.log tst_nccopy3.log
tst_ctest.log: ref_ctest.log ref_ctest64.log
tst_output.log: tst_ctest.log
tst_ncgen4_classic.log: tst_formatx3.log tst_output.log \
tst_nccopy3.log run_ncgen_tests.log
TESTS += tst_null_byte_padding.sh
if USE_STRICT_NULL_BYTE_HEADER_PADDING
@ -64,6 +70,33 @@ if LARGE_FILE_TESTS
TESTS += tst_iter.sh
endif
if USE_NETCDF4
# NetCDF-4 has some extra C programs to build. These will be run by
# the shell script tests.
check_PROGRAMS += tst_fileinfo tst_create_files tst_h_rdc0 \
tst_group_data tst_enum_data tst_opaque_data tst_string_data \
tst_vlen_data tst_comp tst_comp2 tst_nans tst_special_atts \
tst_unicode tst_fillbug tst_compress tst_chunking tst_h_scalar
# Tests for netCDF-4 behavior.
TESTS += tst_fileinfo.sh tst_hdf5_offset.sh tst_inttags4.sh \
tst_netcdf4.sh tst_fillbug.sh tst_netcdf4_4.sh tst_nccopy4.sh \
tst_grp_spec.sh tst_mud.sh tst_h_scalar.sh tst_formatx4.sh \
run_utf8_nc4_tests.sh run_back_comp_tests.sh run_ncgen_nc4_tests.sh \
tst_ncgen4.sh
# Record dependencies between netcdf-4 test scripts.
tst_netcdf4.log: run_ncgen_tests.log tst_output.log tst_ncgen4.log \
tst_formatx4.log
tst_nccopy4.log: tst_netcdf4.log tst_fillbug.log tst_netcdf4_4.log \
tst_h_scalar.log tst_ctest.log
run_ncgen_nc4_tests.log: run_ncgen_tests.log tst_output.log \
tst_nccopy3.log
run_utf8_nc4_tests.log: run_utf8_tests.log
tst_ncgen4.log: tst_ncgen4_classic.log tst_formatx4.log
endif #!USE_NETCDF4
# Add diskless checks if needed.
if BUILD_DISKLESS
TESTS += tst_inmemory_nc3.sh
if USE_NETCDF4
@ -71,112 +104,66 @@ TESTS += tst_inmemory_nc4.sh
endif
endif
if USE_NETCDF4
TESTS += tst_inttags4.sh
endif
if USE_NETCDF4
# NetCDF-4 has some extra tests.
check_PROGRAMS += tst_create_files tst_h_rdc0 tst_group_data \
tst_enum_data tst_opaque_data tst_string_data tst_vlen_data tst_comp \
tst_comp2 tst_nans tst_special_atts tst_unicode tst_fillbug \
tst_compress tst_chunking tst_h_scalar tst_bug324
TESTS += tst_create_files tst_group_data tst_enum_data tst_opaque_data \
tst_string_data tst_vlen_data tst_comp tst_comp2 tst_nans \
tst_special_atts tst_netcdf4.sh tst_h_rdc0 tst_unicode tst_fillbug \
tst_fillbug.sh tst_netcdf4_4.sh tst_compress tst_nccopy4.sh \
tst_grp_spec.sh tst_mud.sh tst_h_scalar tst_h_scalar.sh tst_formatx4.sh \
tst_bug324 run_utf8_nc4_tests.sh run_back_comp_tests.sh
endif #!USE_NETCDF4
TESTS += tst_ncgen4_classic.sh
if USE_NETCDF4
TESTS += tst_ncgen4.sh
endif
endif BUILD_TESTSETS
CLEANFILES = test0.nc test1_ncdump.cdl test1_ncdump.nc \
test2_ncdump.cdl test1.cdl test0_ncdump.nc ctest1.cdl test1_cdf5.nc \
test1_cdf5.cdl test0_cdf5.nc test2_cdf5.nc test2_cdf5.cdl \
test0_offset.nc test1_offset.nc test1_offset.cdl test2_offset.nc \
test2_offset.cdl ctest0.nc ctest0_64.nc c1.cdl c1_4.cdl ctest1_64.cdl \
c0.nc c0_4.nc small.nc small2.nc c0tmp.nc c1.ncml utf8.cdl \
utf8_64.cdl utf8.nc utf8_64.nc tmp.cdl tst_vlen_data.nc tst_utf8.nc \
tst_special_atts.nc tst_unicode.nc tst_solar_2.nc tst_string_data.nc \
tst_calendars.nc tst_nans.nc tst_opaque_data.nc tst_solar_cmp.nc \
tst_enum_data.nc tst_solar_1.nc tst_mslp_64.nc tst_mslp.nc \
tst_bug321.nc tst_comp2.nc tst_ncml.nc tst_fillbug.nc \
tst_group_data.nc tst_small.nc tst_comp.nc tst_unicode.cdl \
tst_group_data.cdl tst_compounds2.cdl tst_comp.cdl tst_enum_data.cdl \
tst_small.cdl tst_times.cdl tst_solar_2.cdl tst_string_data.cdl \
tst_fillbug.cdl tst_opaque_data.cdl tst_compounds4.cdl tst_utf8.cdl \
tst_compounds3.cdl tst_special_atts.cdl tst_nans.cdl \
tst_format_att_64.cdl tst_vlen_data.cdl tst_solar_1.cdl \
tst_format_att.cdl tst_inflated.nc tmp_subset.cdl tst_inflated4.nc \
tst_deflated.nc tst_chunking.nc tmp*.nc tst_charfill.nc \
tmp_tst_charfill.cdl iter.* tst_nc_test_netcdf4_4_0.cdl tst_mud4.nc \
tst_mud4.cdl tst_mud4-bc.cdl tst_ncf213.cdl tst_ncf213.nc \
tst_h_scalar.cdl tst_h_scalar.nc tst_mud4_chars.cdl tst_mud4_chars.nc \
inttags.nc inttags4.nc tst_inttags.cdl tst_inttags4.cdl \
tst_dimsize_classic.nc tst_dimsize_64offset.nc tst_dimsize_64data.nc \
nc4_fileinfo.nc hdf5_fileinfo.hdf ref_hdf5_compat1.nc \
ref_hdf5_compat2.nc ref_hdf5_compat3.nc ref_tst_compounds.nc \
ref_tst_dims.nc ref_tst_interops4.nc ref_tst_xplatform2_1.nc \
ref_tst_xplatform2_2.nc nccopy3_subset_out.nc
# These files all have to be included with the distribution.
EXTRA_DIST = run_tests.sh tst_64bit.sh tst_output.sh test0.cdl \
ref_ctest1_nc4.cdl ref_ctest1_nc4c.cdl ref_tst_solar_1.cdl \
ref_tst_solar_2.cdl tst_netcdf4.sh tst_netcdf4_4.sh ref_tst_small.cdl \
tst_lengths.sh tst_ncml.cdl ref1.ncml ref_tst_group_data.cdl \
ref_tst_enum_data.cdl ref_tst_opaque_data.cdl ref_tst_string_data.cdl \
ref_tst_vlen_data.cdl ref_tst_comp.cdl ref_tst_unicode.cdl \
ref_tst_nans.cdl small.cdl small2.cdl $(man_MANS) run_utf8_tests.sh \
ref_tst_utf8.cdl ref_tst_fillbug.cdl tst_fillbug.sh tst_calendars.cdl \
tst_calendars.sh ref_times.cdl ref_tst_special_atts.cdl \
ref_tst_noncoord.cdl ref_tst_compounds2.nc ref_tst_compounds2.cdl \
ref_tst_compounds3.nc ref_tst_compounds3.cdl ref_tst_compounds4.nc \
ref_tst_compounds4.cdl ref_tst_group_data_v23.cdl tst_mslp.cdl \
tst_bug321.cdl ref_tst_format_att.cdl ref_tst_format_att_64.cdl \
tst_nccopy3.sh tst_nccopy4.sh ref_nc_test_netcdf4_4_0.nc \
run_back_comp_tests.sh ref_nc_test_netcdf4.cdl \
ref_tst_special_atts3.cdl tst_brecs.cdl ref_tst_grp_spec0.cdl \
ref_tst_grp_spec.cdl tst_grp_spec.sh ref_tst_charfill.cdl \
tst_charfill.cdl tst_charfill.sh tst_iter.sh tst_mud.sh \
ref_tst_mud4.cdl ref_tst_mud4-bc.cdl ref_tst_mud4_chars.cdl \
inttags.cdl inttags4.cdl ref_inttags.cdl ref_inttags4.cdl \
ref_tst_ncf213.cdl tst_h_scalar.sh run_utf8_nc4_tests.sh \
tst_formatx3.sh tst_formatx4.sh ref_tst_utf8_4.cdl tst_inttags.sh \
tst_inttags4.sh CMakeLists.txt XGetopt.c tst_bom.sh \
tst_inmemory_nc3.sh tst_dimsizes.sh tst_inmemory_nc4.sh \
tst_fileinfo.sh run_ncgen_tests.sh test_360_day_1900.nc \
test_365_day_1900.nc test_366_day_1900.nc ref_test_360_day_1900.cdl \
ref_test_365_day_1900.cdl ref_test_366_day_1900.cdl \
tst_hdf5_offset.sh run_ncgen_nc4_tests.sh tst_nccopy3_subset.sh \
ref_nccopy3_subset.nc test_corrupt_magic.nc ref_null_byte_padding_test.nc \
tst_null_byte_padding.sh
EXTRA_DIST = run_tests.sh tst_64bit.sh tst_output.sh test0.cdl \
ref_ctest1_nc4.cdl ref_ctest1_nc4c.cdl ref_tst_solar_1.cdl \
ref_tst_solar_2.cdl tst_netcdf4.sh tst_netcdf4_4.sh ref_tst_small.cdl \
tst_lengths.sh tst_ncml.cdl ref1.ncml ref_tst_group_data.cdl \
ref_tst_enum_data.cdl ref_tst_opaque_data.cdl ref_tst_string_data.cdl \
ref_tst_vlen_data.cdl ref_tst_comp.cdl ref_tst_unicode.cdl \
ref_tst_nans.cdl small.cdl small2.cdl $(man_MANS) run_utf8_tests.sh \
ref_tst_utf8.cdl ref_tst_fillbug.cdl tst_fillbug.sh tst_calendars.cdl \
tst_calendars.sh ref_times.cdl ref_tst_special_atts.cdl \
ref_tst_noncoord.cdl ref_tst_compounds2.nc ref_tst_compounds2.cdl \
ref_tst_compounds3.nc ref_tst_compounds3.cdl ref_tst_compounds4.nc \
ref_tst_compounds4.cdl ref_tst_group_data_v23.cdl tst_mslp.cdl \
tst_bug321.cdl ref_tst_format_att.cdl ref_tst_format_att_64.cdl \
tst_nccopy3.sh tst_nccopy4.sh ref_nc_test_netcdf4_4_0.nc \
run_back_comp_tests.sh ref_nc_test_netcdf4.cdl \
ref_tst_special_atts3.cdl tst_brecs.cdl ref_tst_grp_spec0.cdl \
ref_tst_grp_spec.cdl tst_grp_spec.sh ref_tst_charfill.cdl \
tst_charfill.cdl tst_charfill.sh tst_iter.sh tst_mud.sh \
ref_tst_mud4.cdl ref_tst_mud4-bc.cdl ref_tst_mud4_chars.cdl \
inttags.cdl inttags4.cdl ref_inttags.cdl ref_inttags4.cdl \
ref_tst_ncf213.cdl tst_h_scalar.sh run_utf8_nc4_tests.sh \
tst_formatx3.sh tst_formatx4.sh ref_tst_utf8_4.cdl tst_inttags.sh \
tst_inttags4.sh CMakeLists.txt XGetopt.c tst_bom.sh \
tst_inmemory_nc3.sh tst_dimsizes.sh tst_inmemory_nc4.sh \
tst_fileinfo.sh run_ncgen_tests.sh ref_test_360_day_1900.nc \
ref_test_365_day_1900.nc ref_test_366_day_1900.nc \
ref_test_360_day_1900.cdl ref_test_365_day_1900.cdl \
ref_test_366_day_1900.cdl tst_hdf5_offset.sh run_ncgen_nc4_tests.sh \
tst_nccopy3_subset.sh ref_nccopy3_subset.nc ref_test_corrupt_magic.nc \
tst_ncgen_shared.sh tst_ncgen4.sh tst_ncgen4_classic.sh \
tst_ncgen4_diff.sh tst_ncgen4_cycle.sh tst_ctest.sh \
tst_null_byte_padding.sh ref_null_byte_padding_test.nc
# The L512.bin file is file containing exactly 512 bytes each of value 0.
# It is used for creating hdf5 files with varying offsets for testing.
EXTRA_DIST += L512.bin
# CDL files and Expected results
SUBDIRS=cdl expected
EXTRA_DIST += tst_ncgen_shared.sh tst_ncgen4.sh tst_ncgen4_classic.sh \
tst_ncgen4_diff.sh tst_ncgen4_cycle.sh tst_ctest.sh
SUBDIRS = cdl expected
CLEANFILES += results/*.nc results/*.dmp results/*.dmp2 tmp*.cdl \
c5.nc compound_datasize_test.nc compound_datasize_test2.nc ncf199.nc \
ref_camrun.c tst_c0.cdl tst_c0_4.cdl tst_c0_4c.cdl tst_c0_64.cdl \
CLEANFILES = tst_*.nc tmp*.nc test*.nc iter.* tmp*.cdl \
test1_ncdump.cdl test2_ncdump.cdl test1.cdl ctest1.cdl test1_cdf5.cdl \
test2_cdf5.cdl test1_offset.cdl test2_offset.cdl ctest0.nc \
ctest0_64.nc c1.cdl c1_4.cdl ctest1_64.cdl c0.nc c0_4.nc small.nc \
small2.nc c0tmp.nc c1.ncml utf8.cdl utf8_64.cdl utf8.nc utf8_64.nc \
tst_unicode.cdl tst_group_data.cdl tst_compounds2.cdl tst_comp.cdl \
tst_enum_data.cdl tst_small.cdl tst_times.cdl tst_solar_2.cdl \
tst_string_data.cdl tst_fillbug.cdl tst_opaque_data.cdl \
tst_compounds4.cdl tst_utf8.cdl tst_compounds3.cdl \
tst_special_atts.cdl tst_nans.cdl tst_format_att_64.cdl \
tst_vlen_data.cdl tst_solar_1.cdl tst_format_att.cdl \
tst_nc_test_netcdf4_4_0.cdl tst_mud4.cdl tst_mud4-bc.cdl \
tst_ncf213.cdl tst_h_scalar.cdl tst_mud4_chars.cdl inttags.nc \
inttags4.nc tst_inttags.cdl tst_inttags4.cdl nc4_fileinfo.nc \
hdf5_fileinfo.hdf nccopy3_subset_out.nc c5.nc \
compound_datasize_test.nc compound_datasize_test2.nc ncf199.nc \
tst_c0.cdl tst_c0_4.cdl tst_c0_4c.cdl tst_c0_64.cdl \
tst_compound_datasize_test.cdl tst_compound_datasize_test2.cdl \
tst_gattenum.nc tst_ncf199.cdl tst_tst_gattenum.cdl \
tst_tst_usuffix.cdl tst_usuffix.nc tst_bug324.nc ctest.c ctest64.c \
nccopy3_subset_out.nc
DISTCLEANFILES = results
clean-local:
-rm -rf results
tst_ncf199.cdl tst_tst_gattenum.cdl tst_tst_usuffix.cdl ctest.c \
ctest64.c nccopy3_subset_out.nc camrun.c

View File

@ -11,9 +11,9 @@
/* BOM Sequences */
static char* U8 = "\xEF\xBB\xBF"; /* UTF-8 */
static char* BE32 = "\x00\x00\xFE\xFF"; /* UTF-32; big-endian */
static char* LE32 = "\xFF\xFE"; /* UTF-32; little-endian */
/* static char* LE32 = "\xFF\xFE"; /\* UTF-32; little-endian *\/ */
static char* BE16 = "\xFE\xFF"; /* UTF-16; big-endian */
static char* LE16 = "\xFF\xFE"; /* UTF-16; little-endian */
/* static char* LE16 = "\xFF\xFE"; /\* UTF-16; little-endian *\/ */
int
main(int argc, char** argv)

View File

@ -172,8 +172,8 @@ fi
set -e
rm -fr results
mkdir results
rm -fr results_ctests
mkdir results_ctests
failcount=0
passcount=0
@ -190,7 +190,7 @@ for x in ${TESTSET} ; do
if test "$x" = "$s" ; then isxfail=1; fi
done
ok=0;
cd results
cd results_ctests
if ${NCGEN4} -lc -k${KFLAG} ${cdl}/${x}.cdl >${x}.c
then ok=1; else ok=0; fi
if $CC ${INCL} -c ${x}.c
@ -204,7 +204,7 @@ for x in ${TESTSET} ; do
cd ..
if test 1 = 1; then
# compare with expected
if diff -b -w ${expected}/${x}.dmp results/${x}.dmp
if diff -b -w ${expected}/${x}.dmp results_ctests/${x}.dmp
then ok=1; else ok=0; fi
if test "$ok" = "1" ; then
echo "*** PASS: ${x}"
@ -221,6 +221,7 @@ done
totalcount=`expr $passcount + $failcount + $xfailcount`
okcount=`expr $passcount + $xfailcount`
rm -fr results_ctests
echo "PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"

View File

@ -722,9 +722,6 @@ copy_var_filter(int igrp, int varid, int ogrp, int o_varid)
VarID vid = {igrp,varid};
VarID ovid = {ogrp,o_varid};
/* handle filter parameters, copying from input, overriding with command-line options */
unsigned int filterid = 0;
size_t nparams = 0;
unsigned int* params = NULL;
struct FilterSpec spec;
int i, found;
char* ofqn = NULL;

View File

@ -12,7 +12,6 @@
int
main(int argc, char** argv)
{
long pos = 0;
unsigned char buffer[BUFLEN];
size_t count, red, avail, trunc;
unsigned char* p = buffer;

View File

@ -1,14 +1,14 @@
#!/bin/sh
# This shell script runs the ncdump tests.
# $Id: run_nc4_tests.sh,v 1.4 2010/05/18 20:05:23 dmh Exp $
# Dennis Heimbigner
if test "x$srcdir" = x ; then srcdir="."; fi
. ../test_common.sh
##
# Function to test a netCDF CDL file.
# 1. Generate binary nc.
# Use ncdump to compare against original CDL file.
# First generate binary nc. Then use ncdump to compare against
# original CDL file.
# Input: CDL file name, minus the suffix, output filename
# Other input: arguments.
#
@ -30,8 +30,6 @@ validateNC() {
diff -b -w $INFILE $TMPFILE
}
echo "*** Testing ncgen for netCDF-4."
set -e
@ -42,7 +40,7 @@ echo "*** creating netCDF-4 classic model file c0_4c.nc from c0.cdl..."
validateNC "c0" "c0_4c" -k nc7 -b
echo "*** creating C code for CAM file ref_camrun.cdl..."
${NCGEN} -lc $top_srcdir/ncgen/ref_camrun.cdl >ref_camrun.c
${NCGEN} -lc $top_srcdir/ncgen/ref_camrun.cdl > camrun.c
echo "*** test for jira NCF-199 bug"
validateNC "ncf199" "ncf199" -k nc4

View File

@ -9,6 +9,9 @@ set -e
echo ""
echo "*** Testing ncgen and ncdump for UTF8 support..."
# Run tst_utf8.c to produce test file tst_utf8.nc.
${execdir}/tst_utf8
if test "x$builddir" = x ; then
builddir="."
fi

Binary file not shown.

View File

@ -23,7 +23,7 @@ TSTS="test_360_day_1900 test_365_day_1900 test_366_day_1900"
for t in $TSTS ; do
rm -f ./${t}.cdl
echo "create: ${t}.cdl from ${t}.nc"
${NCDUMP} -n ${t} -t $srcdir/${t}.nc > ${t}.cdl
${NCDUMP} -n ${t} -t $srcdir/ref_${t}.nc > ${t}.cdl
echo "compare: ${t}.cdl ref_${t}.cdl"
diff -b ${t}.cdl $srcdir/ref_${t}.cdl
rm -f ${t}.cdl

View File

@ -4,7 +4,7 @@
Create a compressible test file for nccopy to compress.
$Id$
Russ Rew, Ward Fisher, Dennis Heimbigner
*/
#include "config.h"

View File

@ -20,16 +20,16 @@ ${execdir}/tst_dimsizes
echo "*** Verify that ncdump can read dimsizes"
rm -fr ./tmp
if ${NCDUMP} -h tst_dimsize_classic.nc > ./tmp ; then
rm -fr ./tmp_tst_dimsizes
if ${NCDUMP} -h tst_dimsize_classic.nc > ./tmp_tst_dimsizes ; then
echo "*** PASS: ncdump tst_dimsize_classic.nc"
else
echo "*** FAIL: ncdump tst_dimsize_classic.nc"
RETURN=1
fi
rm -fr ./tmp
if ${NCDUMP} -h tst_dimsize_64offset.nc > ./tmp ; then
rm -fr ./tmp_tst_dimsizes
if ${NCDUMP} -h tst_dimsize_64offset.nc > ./tmp_tst_dimsizes ; then
echo "*** PASS: ncdump tst_dimsize_64offset.nc"
else
echo "*** FAIL: ncdump tst_dimsize_64offset.nc"
@ -37,8 +37,8 @@ RETURN=1
fi
if test -f tst_dimsize_64data.nc ; then
rm -fr ./tmp
if ${NCDUMP} -h tst_dimsize_64data.nc > ./tmp ; then
rm -fr ./tmp_tst_dimsizes
if ${NCDUMP} -h tst_dimsize_64data.nc > ./tmp_tst_dimsizes ; then
echo "*** PASS: ncdump tst_dimsize_64data.nc"
else
echo "*** FAIL: ncdump tst_dimsize_64data.nc"
@ -47,6 +47,6 @@ if test -f tst_dimsize_64data.nc ; then
fi
# Cleanup
rm -f tmp tst_dimsize_classic.nc tst_dimsize_64offset.nc tst_dimsize_64data.nc
rm -f tmp_tst_dimsizes tst_dimsize_classic.nc tst_dimsize_64offset.nc tst_dimsize_64data.nc
exit $RETURN

View File

@ -13,13 +13,13 @@ HDF=$srcdir/hdf5_fileinfo.hdf
NF=ref_tst_compounds4.nc
# Do a false negative test
rm -f ./tmp
if $NCDUMP -s $builddir/$NF | fgrep '_IsNetcdf4 = 0' > ./tmp ; then
rm -f ./tmp_tst_fileinfo
if $NCDUMP -s $builddir/$NF | fgrep '_IsNetcdf4 = 0' > ./tmp_tst_fileinfo ; then
echo "Pass: False negative for file: $NF"
else
echo "FAIL: False negative for file: $NF"
fi
rm -f ./tmp
rm -f ./tmp_tst_fileinfo
if ${execdir}/tst_fileinfo > /dev/null ; then
# look at the _IsNetcdf4 flag

View File

@ -8,6 +8,7 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
echo ""
echo "*** Running ncdump bug test."
${execdir}/tst_fillbug
# echo "*** dumping tst_fillbug.nc to tst_fillbug.cdl..."
${NCDUMP} tst_fillbug.nc > tst_fillbug.cdl
# echo "*** comparing tst_fillbug.cdl with ref_tst_fillbug.cdl..."

View File

@ -24,19 +24,19 @@ echo ""
echo "*** Testing extended file format output."
set -e
echo "Test extended format output for a netcdf-3 file"
rm -f tmp
${NCGEN} -k nc3 -b -o ./test.nc $srcdir/ref_tst_small.cdl
${NCDUMP} -K test.nc >tmp
if ! grep 'classic mode=00000000' <tmp ; then
rm -f tmp_tst_formatx3
${NCGEN} -k nc3 -b -o ./tst_formatx3.nc $srcdir/ref_tst_small.cdl
${NCDUMP} -K tst_formatx3.nc >tmp_tst_formatx3
if ! grep 'classic mode=00000000' <tmp_tst_formatx3 ; then
echo "*** Fail: extended format for a classic file"
ECODE=1
fi
echo "Test extended format output for a 64-bit offset netcdf-3 file"
rm -f tmp
${NCGEN} -k nc6 -b -o ./test.nc $srcdir/ref_tst_small.cdl
${NCDUMP} -K test.nc >tmp
if ! grep '64-bit offset mode=00000200' <tmp ; then
rm -f tmp_tst_formatx3
${NCGEN} -k nc6 -b -o ./tst_formatx3.nc $srcdir/ref_tst_small.cdl
${NCDUMP} -K tst_formatx3.nc >tmp_tst_formatx3
if ! grep '64-bit offset mode=00000200' <tmp_tst_formatx3 ; then
echo "*** Fail: extended format for a 64-bit classic file"
ECODE=1
fi
@ -46,15 +46,15 @@ fi
if test "x$USE_CDF5" = x1 ; then
echo "Test extended format output for a 64-bit CDF-5 classic file"
rm -f tmp
${NCGEN} -k5 -b -o ./test.nc $srcdir/ref_tst_small.cdl
${NCDUMP} -K test.nc >tmp
if ! grep -F '64-bit data mode=00000020' <tmp ; then
rm -f tmp_tst_formatx3
${NCGEN} -k5 -b -o ./tst_formatx3.nc $srcdir/ref_tst_small.cdl
${NCDUMP} -K tst_formatx3.nc >tmp_tst_formatx3
if ! grep -F '64-bit data mode=00000020' <tmp_tst_formatx3 ; then
echo "*** Fail: extended format for a 64-bit CDF-5 classic file"
ECODE=1
fi
fi
rm -f tmp test.nc
rm -f tmp_tst_formatx3 tst_formatx3.nc
exit $ECODE

View File

@ -10,24 +10,24 @@ echo ""
echo "*** Testing extended file format output."
set -e
echo "Test extended format output for a netcdf-4 file"
rm -f tmp
${NCGEN} -k nc4 -b -o ./test.nc $srcdir/ref_tst_small.cdl
${NCDUMP} -K test.nc >tmp
if ! grep 'HDF5 mode=00001000' <tmp ; then
rm -f tmp_tst_formatx4
${NCGEN} -k nc4 -b -o ./tst_formatx4.nc $srcdir/ref_tst_small.cdl
${NCDUMP} -K tst_formatx4.nc >tmp_tst_formatx4
if ! grep 'HDF5 mode=00001000' <tmp_tst_formatx4 ; then
echo "*** Fail: extended format for a netcdf-4 file"
ECODE=1
fi
echo "Test extended format output for a classic netcdf-4 file"
rm -f tmp
${NCGEN} -k nc7 -b -o ./test.nc $srcdir/ref_tst_small.cdl
${NCDUMP} -K test.nc >tmp
if ! grep 'HDF5 mode=00001000' <tmp ; then
rm -f tmp_tst_formatx4
${NCGEN} -k nc7 -b -o ./tst_formatx4.nc $srcdir/ref_tst_small.cdl
${NCDUMP} -K tst_formatx4.nc >tmp_tst_formatx4
if ! grep 'HDF5 mode=00001000' <tmp_tst_formatx4 ; then
echo "*** Fail: extended format for a classic netcdf-4 file"
ECODE=1
fi
rm -f tmp test.nc
rm -f tmp_tst_formatx4 tst_formatx4.nc
exit $ECODE

View File

@ -5,7 +5,7 @@
Use HDF5 to read c0.nc, a file created by ncdump. This check was
added to detect a problem in the early HDF5 1.8.0 releases.
$Id: tst_h_rdc0.c,v 1.5 2010/06/01 15:34:53 ed Exp $
Ed Hartnett
*/
#include <nc_tests.h>
#include "err_macros.h"

View File

@ -5,6 +5,8 @@
This program sets up HDF5 files that contain scalar attributes and
variables, of both string and numeric datatypes. ncdump should handle
all of these.
Russ Rew
*/
#include <nc_tests.h>

View File

@ -9,6 +9,7 @@ set -e
echo ""
echo "*** Running ncdump scalar test."
${execdir}/tst_h_scalar
# echo "*** dumping tst_h_scalar.nc to tst_h_scalar.cdl..."
${NCDUMP} tst_h_scalar.nc > tst_h_scalar.cdl
# echo "*** comparing tst_h_scalar.cdl with ref_tst_h_scalar.cdl..."

View File

@ -13,19 +13,19 @@ PASS=1
CLASSIC="small ref_tst_nans ref_tst_utf8"
EXTENDED="ref_nc_test_netcdf4 ref_tst_comp ref_tst_opaque_data"
rm -fr ./results
mkdir ./results
rm -fr ./results_tst_inmemory_nc3
mkdir ./results_tst_inmemory_nc3
# Dump classic files two ways and compare
dotest() {
K=$1
for f in $2 ; do
echo "Testing ${f}"
${NCGEN} -$K -o ./results/${f}.nc ${srcdir}/${f}.cdl
${NCDUMP} ./results/${f}.nc > ./results/${f}.cdl
${NCDUMP} -Xm ./results/${f}.nc > ./results/${f}.cdx
diff -w ./results/${f}.cdl ./results/${f}.cdx &> ./results/${f}.diff
if test -s ./results/${f}.diff ; then
${NCGEN} -$K -o ./results_tst_inmemory_nc3/${f}.nc ${srcdir}/${f}.cdl
${NCDUMP} ./results_tst_inmemory_nc3/${f}.nc > ./results_tst_inmemory_nc3/${f}.cdl
${NCDUMP} -Xm ./results_tst_inmemory_nc3/${f}.nc > ./results_tst_inmemory_nc3/${f}.cdx
diff -w ./results_tst_inmemory_nc3/${f}.cdl ./results_tst_inmemory_nc3/${f}.cdx &> ./results_tst_inmemory_nc3/${f}.diff
if test -s ./results_tst_inmemory_nc3/${f}.diff ; then
echo "***FAIL: $f"
PASS=0
fi
@ -35,7 +35,7 @@ done
dotest "3" "$CLASSIC"
# Cleanup
rm -fr results
rm -fr results_tst_inmemory_nc3
if test "x$PASS" = x1 ; then
echo "*** PASS all tests"

View File

@ -13,19 +13,19 @@ PASS=1
CLASSIC="small ref_tst_nans ref_tst_utf8"
EXTENDED="ref_nc_test_netcdf4 ref_tst_comp ref_tst_opaque_data"
rm -fr ./results
mkdir ./results
rm -fr ./results_tst_inmemory_nc4
mkdir ./results_tst_inmemory_nc4
# Dump classic files two ways and compare
dotest() {
K=$1
for f in $2 ; do
echo "Testing ${f}"
${NCGEN} -$K -o ./results/${f}.nc ${srcdir}/${f}.cdl
${NCDUMP} ./results/${f}.nc > ./results/${f}.cdl
${NCDUMP} -Xm ./results/${f}.nc > ./results/${f}.cdx
diff -w ./results/${f}.cdl ./results/${f}.cdx &> ./results/${f}.diff
if test -s ./results/${f}.diff ; then
${NCGEN} -$K -o ./results_tst_inmemory_nc4/${f}.nc ${srcdir}/${f}.cdl
${NCDUMP} ./results_tst_inmemory_nc4/${f}.nc > ./results_tst_inmemory_nc4/${f}.cdl
${NCDUMP} -Xm ./results_tst_inmemory_nc4/${f}.nc > ./results_tst_inmemory_nc4/${f}.cdx
diff -w ./results_tst_inmemory_nc4/${f}.cdl ./results_tst_inmemory_nc4/${f}.cdx &> ./results_tst_inmemory_nc4/${f}.diff
if test -s ./results_tst_inmemory_nc4/${f}.diff ; then
echo "***FAIL: $f"
PASS=0
fi
@ -42,7 +42,7 @@ if test -f ${top_builddir}/config.h ; then
fi
# Cleanup
rm -fr results
rm -fr results_tst_inmemory_nc4
if test "x$PASS" = x1 ; then
echo "*** PASS all tests"

View File

@ -30,21 +30,21 @@ fi
echo "*** Testing netCDF-3 features of nccopy on ncdump/*.nc files"
for i in $TESTFILES ; do
echo "*** Testing nccopy $i.nc copy_of_$i.nc ..."
${NCCOPY} $i.nc copy_of_$i.nc
${NCDUMP} -n copy_of_$i $i.nc > tmp.cdl
${NCDUMP} copy_of_$i.nc > copy_of_$i.cdl
diff copy_of_$i.cdl tmp.cdl
rm copy_of_$i.nc copy_of_$i.cdl tmp.cdl
echo "*** Testing nccopy $i.nc nccopy3_copy_of_$i.nc ..."
${NCCOPY} $i.nc nccopy3_copy_of_$i.nc
${NCDUMP} -n nccopy3_copy_of_$i $i.nc > tmp_tst_nccopy3.cdl
${NCDUMP} nccopy3_copy_of_$i.nc > nccopy3_copy_of_$i.cdl
diff nccopy3_copy_of_$i.cdl tmp_tst_nccopy3.cdl
rm nccopy3_copy_of_$i.nc nccopy3_copy_of_$i.cdl tmp_tst_nccopy3.cdl
done
echo "*** Testing nccopy -u"
${NCGEN} -b $srcdir/tst_brecs.cdl
# convert record dimension to fixed-size dimension
$NCCOPY -u tst_brecs.nc copy_of_tst_brecs.nc
${NCDUMP} -n copy_of_tst_brecs tst_brecs.nc | sed '/ = UNLIMITED ;/s/\(.*\) = UNLIMITED ; \/\/ (\(.*\) currently)/\1 = \2 ;/' > tmp.cdl
${NCDUMP} copy_of_tst_brecs.nc > copy_of_tst_brecs.cdl
diff -b copy_of_tst_brecs.cdl tmp.cdl
rm copy_of_tst_brecs.cdl tmp.cdl tst_brecs.nc copy_of_tst_brecs.nc
$NCCOPY -u tst_brecs.nc nccopy3_copy_of_tst_brecs.nc
${NCDUMP} -n nccopy3_copy_of_tst_brecs tst_brecs.nc | sed '/ = UNLIMITED ;/s/\(.*\) = UNLIMITED ; \/\/ (\(.*\) currently)/\1 = \2 ;/' > tmp_tst_nccopy3.cdl
${NCDUMP} nccopy3_copy_of_tst_brecs.nc > nccopy3_copy_of_tst_brecs.cdl
diff -b nccopy3_copy_of_tst_brecs.cdl tmp_tst_nccopy3.cdl
rm nccopy3_copy_of_tst_brecs.cdl tmp_tst_nccopy3.cdl tst_brecs.nc nccopy3_copy_of_tst_brecs.nc
echo "*** All nccopy tests passed!"
exit 0

View File

@ -16,6 +16,10 @@ TESTFILES='tst_comp tst_comp2 tst_enum_data tst_fillbug
tst_solar_cmp tst_special_atts tst_string_data tst_unicode
tst_vlen_data'
# Run these programs to create some test files.
${execdir}/tst_comp2
${execdir}/tst_compress
echo "*** Testing netCDF-4 features of nccopy on ncdump/*.nc files"
for i in $TESTFILES ; do
echo "*** Test nccopy $i.nc copy_of_$i.nc ..."

View File

@ -33,5 +33,6 @@ echo "*** Performing diff tests: k=4"
sh ${srcdir}/tst_ncgen4_diff.sh
echo "*** Performing cycle tests: k=4"
sh ${srcdir}/tst_ncgen4_cycle.sh
rm -rf ${RESULTSDIR}
exit

View File

@ -10,8 +10,8 @@ verbose=0
export verbose
KFLAG=1 ; export KFLAG
sh ${srcdir}/tst_ncgen4_diff.sh
sh ${srcdir}/tst_ncgen4_cycle.sh
bash -x ${srcdir}/tst_ncgen4_diff.sh
bash -x ${srcdir}/tst_ncgen4_cycle.sh
exit 0

View File

@ -16,6 +16,7 @@ fi
echo "*** Cycle testing ncgen with -k${KFLAG}"
mkdir ${RESULTSDIR}
cd ${RESULTSDIR}
for x in ${TESTSET} ; do
test "x$verbose" = x1 && echo "*** Testing: ${x}"
@ -61,6 +62,7 @@ totalcount=`expr $passcount + $failcount + $xfailcount`
okcount=`expr $passcount + $xfailcount`
echo "*** PASSED: ${okcount}/${totalcount} ; ${failcount} unexpected failures; ${xfailcount} expected failures ignored"
rm -rf ${RESULTSDIR}
if test $failcount -gt 0 ; then
exit 1

View File

@ -20,6 +20,7 @@ fi
echo "*** Testing ncgen with -k${KFLAG}"
mkdir ${RESULTSDIR}
cd ${RESULTSDIR}
for x in ${TESTSET} ; do
if test $verbose = 1 ; then echo "*** Testing: ${x}" ; fi
@ -62,6 +63,7 @@ totalcount=`expr $passcount + $failcount + $xfailcount`
okcount=`expr $passcount + $xfailcount`
echo "*** PASSED: ${okcount}/${totalcount} ; ${xfailcount} expected failures ; ${failcount} unexpected failures"
rm -rf ${RESULTSDIR}
if test $failcount -gt 0 ; then
exit 1

View File

@ -14,7 +14,7 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
# and expected/Makefile.am
set -e
RESULTSDIR="./results"
RESULTSDIR="./results_$$"
#SHOWXFAILS=1
# Locate the cdl and expected directory
@ -143,5 +143,5 @@ failcount=0
passcount=0
xfailcount=0
rm -fr results
mkdir results
rm -fr $RESULTSDIR
#mkdir $RESULTSDIR

View File

@ -1,10 +1,10 @@
#!/bin/sh
# This shell script tests ncdump for netcdf-4
# Ed Hartnett, Dennis Heimbigner
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
# This shell script tests ncdump for netcdf-4
set -e
echo ""
@ -21,16 +21,24 @@ echo "*** Testing ncgen and ncdump test output for netCDF-4 classic format."
${NCGEN} -k nc7 -b -o c0.nc ${ncgenc0}
# echo "*** creating c1.cdl from c0.nc..."
echo "*** Testing that program tst_h_rdc0 can read c0.cdl."
${execdir}/tst_h_rdc0
# echo "*** comparing c1.cdl with ref_ctest1_nc4c.cdl..."
diff -b c1.cdl $srcdir/ref_ctest1_nc4c.cdl
echo "*** Testing ncdump output for netCDF-4 features."
echo "*** Running tst_create_files.c to create test files."
${execdir}/tst_create_files
echo "*** Testing tst_create_files output for netCDF-4 features."
${NCDUMP} tst_solar_1.nc | sed 's/e+0/e+/g' > tst_solar_1.cdl
# echo "*** comparing tst_solar_1.cdl with ref_tst_solar_1.cdl..."
diff -b tst_solar_1.cdl $srcdir/ref_tst_solar_1.cdl
${NCDUMP} tst_solar_2.nc | sed 's/e+0/e+/g' > tst_solar_2.cdl
# echo "*** comparing tst_solar_2.cdl with ref_tst_solar_2.cdl..."
diff -b tst_solar_2.cdl $srcdir/ref_tst_solar_2.cdl
echo "*** Running tst_group_data.c to create test files."
${execdir}/tst_group_data
${NCDUMP} tst_group_data.nc | sed 's/e+0/e+/g' > tst_group_data.cdl
# echo "*** comparing tst_group_data.cdl with ref_tst_group_data.cdl..."
diff -b tst_group_data.cdl $srcdir/ref_tst_group_data.cdl
@ -47,35 +55,52 @@ ${NCDUMP} -v /g2/g3/var tst_group_data.nc | sed 's/e+0/e+/g' > tst_group_data.cd
diff -b tst_group_data.cdl $srcdir/ref_tst_group_data_v23.cdl
fi
echo "*** Testing -v option with relative name and groups..."
${NCDUMP} -v var,var2 tst_group_data.nc | sed 's/e+0/e+/g' > tst_group_data.cdl
# echo "*** comparing tst_group_data.cdl with ref_tst_group_data.cdl..."
diff -b tst_group_data.cdl $srcdir/ref_tst_group_data.cdl
echo "*** Running tst_enum_data.c to create test files."
${execdir}/tst_enum_data
${NCDUMP} tst_enum_data.nc | sed 's/e+0/e+/g' > tst_enum_data.cdl
# echo "*** comparing tst_enum_data.cdl with ref_tst_enum_data.cdl..."
diff -b tst_enum_data.cdl $srcdir/ref_tst_enum_data.cdl
echo "*** Running tst_opaque_data.c to create test files."
${execdir}/tst_opaque_data
${NCDUMP} tst_opaque_data.nc | sed 's/e+0/e+/g' > tst_opaque_data.cdl
# echo "*** comparing tst_opaque_data.cdl with ref_tst_opaque_data.cdl..."
diff -b tst_opaque_data.cdl $srcdir/ref_tst_opaque_data.cdl
echo "*** Running tst_vlen_data.c to create test files."
${execdir}/tst_vlen_data
${NCDUMP} tst_vlen_data.nc | sed 's/e+0/e+/g' > tst_vlen_data.cdl
# echo "*** comparing tst_vlen_data.cdl with ref_tst_vlen_data.cdl..."
diff -b tst_vlen_data.cdl $srcdir/ref_tst_vlen_data.cdl
echo "*** Running tst_comp.c to create test files."
${execdir}/tst_comp
${NCDUMP} tst_comp.nc | sed 's/e+0/e+/g' > tst_comp.cdl
# echo "*** comparing tst_comp.cdl with ref_tst_comp.cdl..."
diff -b tst_comp.cdl $srcdir/ref_tst_comp.cdl
# echo "*** creating tst_nans.cdl from tst_nans.nc"
echo "*** Running tst_nans.c to create test files."
${execdir}/tst_nans
${NCDUMP} tst_nans.nc | sed 's/e+0/e+/g' > tst_nans.cdl
# echo "*** comparing ncdump of generated file with ref_tst_nans.cdl ..."
diff -b tst_nans.cdl $srcdir/ref_tst_nans.cdl
# Do unicode test only if it exists => BUILD_UTF8 is true
if test -f ./tst_unicode -o -f ./tst_unicode.exe ; then
echo "*** dumping tst_unicode.nc to tst_unicode.cdl..."
./tst_unicode
${execdir}/tst_unicode
${NCDUMP} tst_unicode.nc | sed 's/e+0/e+/g' > tst_unicode.cdl
#echo "*** comparing tst_unicode.cdl with ref_tst_unicode.cdl..."
#diff -b tst_unicode.cdl $srcdir/ref_tst_unicode.cdl
fi
echo "*** Running tst_special_atts.c to create test files."
${execdir}/tst_special_atts
${NCDUMP} -c -s tst_special_atts.nc \
| sed 's/e+0/e+/g' \
@ -88,13 +113,13 @@ diff -b tst_special_atts.cdl $srcdir/ref_tst_special_atts.cdl
echo ""
echo "*** Testing ncdump on file with corrupted header "
rm -f ./ignore
if ${NCDUMP} ${srcdir}/test_corrupt_magic.nc > ./ignore 2>&1 ; then
echo "***Fail: ncdump should have failed on test_corrupt_magic.nc"
rm -f ./ignore_tst_netcdf4
if ${NCDUMP} ${srcdir}/ref_test_corrupt_magic.nc > ./ignore_tst_netcdf4 2>&1 ; then
echo "***Fail: ncdump should have failed on ref_test_corrupt_magic.nc"
else
echo "***XFail: ncdump properly failed on test_corrupt_magic.nc"
echo "***XFail: ncdump properly failed on ref_test_corrupt_magic.nc"
fi
rm -fr ./ignore
rm -fr ./ignore_tst_netcdf4
echo "*** All ncgen and ncdump test output for netCDF-4 format passed!"
exit 0

View File

@ -1,10 +1,10 @@
#!/bin/sh
# This shell script runs extra tests ncdump for netcdf-4
# Dennis Heimbigner, Ward Fisher
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh
# This shell script runs extra tests ncdump for netcdf-4
set -e
echo ""
@ -19,12 +19,14 @@ echo "*** Running extra netcdf-4 tests."
#
# Short term solution, use sed when on windows/MSYS to
# remove the './','../../ncdump'.
#
#
echo "*** running tst_string_data to create test files..."
${execdir}/tst_string_data
if [ `uname | cut -d "_" -f 1` = "MINGW32" ]; then # MINGW Platforms
echo "*** dumping tst_string_data.nc to tst_string_data.cdl..."
${NCDUMP} tst_string_data.nc > tst_string_data.cdl
TMPNAME=`head -n 1 tst_string_data.cdl | cut -d" " -f 2`
NEWNAME=`basename $TMPNAME`

View File

@ -4,7 +4,7 @@
Create a test file with a string data for ncdump to read.
$Id: tst_string_data.c,v 1.7 2009/01/28 18:19:48 russ Exp $
Russ Rew
*/
#include <nc_tests.h>

View File

@ -27,6 +27,9 @@ TESTPROGRAMS = nctest tst_rename
check_PROGRAMS = $(TESTPROGRAMS)
TESTS = $(TESTPROGRAMS) compare_test_files.sh
# Note which tests depend on other tests. Necessary for make -j check.
TEST_EXTENSIONS = .sh
# compare_test_files depends on nctest executing first.
compare_test_files.log: nctest.log