From d85bb6fe20c583c1bdcbe753f5c88309a6dbf562 Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Wed, 12 Aug 2020 15:42:50 -0600 Subject: [PATCH] The big change for this commit is complete the disengagement of enable-netcdf4 from enable-hdf5. That is, with the advent of nczarr, it is possible to turn off hdf5 but still need netcdf-4 enabled because nczarr uses libsrc4, but not libhdf5. This change involves a bunch of things: 1. Modify configure.ac and CMakelist to make enable_hdf5 control if hdf5 support is provided. For back compatibility, disable-netcdf4 is treated as disable-hdf5. But internally, netcdf4 support is controlled only by the enabling of formats that require it. 2. In support of #1, modify .travis.yml to use enable/disable-hdf5 instead of enable/disable-netcdf4. 3. test_common.in is modified to track selected features, including enable-hdf5 and enable-s3-tests. This is used in selected tests that mix netcdf-3 and netcdf4 tests. 4. The conflation of USE_HDF5 and USE_NETCDF4 is common in code, tests, and build files, so all of those had to be weeded out. 5. It turns out that some of the NC4_dim functions really are HDF5 specific, but are not treated as such. So they are moved from nc4dim.c to hdf5dim.c or hdf5dispatch.c 6. Some generic functions in libhdf5 can be (and were) moved to libsrc4. --- .travis.yml | 8 +- CMakeLists.txt | 39 +++---- Makefile.am | 2 +- configure.ac | 75 +++++--------- include/hdf5dispatch.h | 9 ++ include/nc4dispatch.h | 9 -- include/nc_logging.h | 2 +- include/ncdispatch.h | 2 - libdap2/CMakeLists.txt | 4 +- libdap2/Makefile.am | 5 - libdap4/CMakeLists.txt | 4 +- libhdf4/hdf4dispatch.c | 3 +- libhdf5/hdf5dim.c | 6 +- libhdf5/hdf5dispatch.c | 6 +- libhdf5/hdf5type.c | 78 -------------- libhdf5/hdf5var.c | 2 +- libhdf5/nc4hdf.c | 72 ------------- liblib/CMakeLists.txt | 7 +- liblib/Makefile.am | 2 +- libnczarr/zdim.c | 1 - libnczarr/zdispatch.c | 2 +- libnczarr/zfilter.c | 2 +- libnczarr/zinternal.h | 2 +- libsrc/CMakeLists.txt | 4 +- libsrc4/CMakeLists.txt | 4 +- libsrc4/nc4type.c | 150 +++++++++++++++++++++++++++ nc_test/CMakeLists.txt | 4 +- nc_test/run_diskless.sh | 14 ++- nc_test/run_inmemory.sh | 10 +- nc_test/test_byterange.sh | 6 +- nc_test/tst_big_rvar.c | 2 +- nc_test/tst_big_var.c | 2 +- nc_test/tst_big_var2.c | 2 +- nc_test/tst_big_var6.c | 2 +- nc_test/tst_byterange.c | 2 +- nc_test/tst_def_var_fill.c | 2 +- nc_test/tst_default_format_pnetcdf.c | 2 +- nc_test/tst_diskless.c | 2 +- nc_test/tst_large.c | 2 +- nc_test/tst_large_cdf5.c | 2 +- nc_test/tst_misc.c | 4 +- nc_test/tst_names.c | 2 +- nc_test/tst_open_mem.c | 2 +- nc_test4/findplugin.in | 11 +- nc_test4/tst_converts.c | 4 +- nc_test4/tst_udf.c | 5 +- ncdap_test/t_dap.c | 10 -- ncdap_test/t_dap3a.c | 10 -- ncdap_test/test_cvt.c | 10 -- ncdump/CMakeLists.txt | 28 ++--- ncdump/Makefile.am | 2 +- ncgen/CMakeLists.txt | 2 +- ncgen/Makefile.am | 4 +- ncgen3/CMakeLists.txt | 2 +- nczarr_test/CMakeLists.txt | 14 +-- nczarr_test/Makefile.am | 9 +- nczarr_test/run_it_test1.sh | 8 +- nczarr_test/run_it_test2.sh | 8 +- nczarr_test/run_ut_map.sh | 7 +- nczarr_test/run_ut_mapapi.sh | 10 +- test_common.in | 5 + 61 files changed, 322 insertions(+), 389 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7496d5f29..86a07ae3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,13 @@ services: env: matrix: # Ubuntu - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-fsigned-char' AC_COPTS='--disable-netcdf-4 --disable-hdf4 --disable-dap-remote-tests --enable-cdf5 --enable-byterange' COPTS='-DENABLE_NETCDF_4=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=TRUE -DENABLE_BYTERANGE=TRUE' USECP=FALSE CURHOST=docker-gcc-x64-signed TESTFILTER=FALSE + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-fsigned-char' AC_COPTS='--disable-hdf5 --disable-hdf4 --disable-dap-remote-tests --enable-cdf5 --enable-byterange' COPTS='-DENABLE_HDF5=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=TRUE -DENABLE_BYTERANGE=TRUE' USECP=FALSE CURHOST=docker-gcc-x64-signed TESTFILTER=FALSE - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-fsigned-char' AC_COPTS='--disable-netcdf-4 --disable-hdf4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=OFF' USECP=FALSE CURHOST=docker-gcc-x86-signed TESTFILTER=FALSE + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-fsigned-char' AC_COPTS='--disable-hdf5 --disable-hdf4 --disable-dap-remote-tests' COPTS='-DENABLE_HDF5=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=OFF' USECP=FALSE CURHOST=docker-gcc-x86-signed TESTFILTER=FALSE - - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-funsigned-char' AC_COPTS='--disable-netcdf-4 --disable-hdf4 --disable-dap-remote-tests --enable-cdf5' COPTS='-DENABLE_NETCDF_4=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=TRUE' USECP=FALSE CURHOST=docker-gcc-x64-unsigned TESTFILTER=FALSE + - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-funsigned-char' AC_COPTS='--disable-hdf5 --disable-hdf4 --disable-dap-remote-tests --enable-cdf5' COPTS='-DENABLE_HDF5=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=TRUE' USECP=FALSE CURHOST=docker-gcc-x64-unsigned TESTFILTER=FALSE - - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-funsigned-char' AC_COPTS='--disable-netcdf-4 --disable-hdf4 --disable-dap-remote-tests' COPTS='-DENABLE_NETCDF_4=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=OFF' USECP=FALSE CURHOST=docker-gcc-x86-unsigned TESTFILTER=FALSE + - DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-funsigned-char' AC_COPTS='--disable-hdf5 --disable-hdf4 --disable-dap-remote-tests' COPTS='-DENABLE_HDF5=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=OFF' USECP=FALSE CURHOST=docker-gcc-x86-unsigned TESTFILTER=FALSE - DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-fsigned-char' AC_COPTS='--disable-dap-remote-tests --enable-cdf5' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=TRUE' USECP=FALSE CURHOST=docker-gcc-x64-signed TESTFILTER=TRUE diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a543097a..1ad7d0dd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -440,10 +440,17 @@ ENDIF() # Format Option checks ################################ +# We need to now treat enable-netcdf4 and enable-hdf5 as separate, +# but for back compatability, we need to treat enable-netcdf4 +# as equivalent to enable-hdf5. +# We detect this using these rules: +# 1. if ENABLE_HDF5 is off then disable hdf5 +# 2. if ENABLE_NETCDF4 is off then disable hdf5 +# 3. else enable hdf5 OPTION(ENABLE_NETCDF_4 "Use HDF5." ON) OPTION(ENABLE_NETCDF4 "Use HDF5." ON) OPTION(ENABLE_HDF5 "Use HDF5." ON) -IF(NOT ENABLE_NETCDF4 OR NOT ENABLE_NETCDF_4) +IF(NOT ENABLE_HDF5 OR NOT ENABLE_NETCDF4 OR NOT ENABLE_NETCDF_4) SET(ENABLE_HDF5 OFF CACHE BOOL "Use HDF5" FORCE) ENDIF() OPTION(ENABLE_HDF4 "Build netCDF-4 with HDF4 read capability(HDF4, HDF5 and Zlib required)." OFF) @@ -591,9 +598,7 @@ ENDIF(ENABLE_STRICT_NULL_BYTE_HEADER_PADDING) # * ## SET(USE_HDF5 ${ENABLE_HDF5}) -IF(USE_HDF5 OR ENABLE_NETCDF_4) - SET(USE_HDF5 ON) - SET(USE_NETCDF4 ON) +IF(USE_HDF5) ## # Accommodate developers who have hdf5 libraries and # headers on their system, but do not have a the hdf @@ -801,8 +806,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) #option to include HDF5 High Level header file (hdf5_hl.h) in case we are not doing a make install INCLUDE_DIRECTORIES(${HDF5_HL_INCLUDE_DIR}) - -ENDIF(USE_HDF5 OR ENABLE_NETCDF_4) +ENDIF(USE_HDF5) # See if we have libcurl FIND_PACKAGE(CURL) @@ -864,11 +868,9 @@ IF(ENABLE_DAP) SET(USE_DAP ON CACHE BOOL "") SET(ENABLE_DAP2 ON CACHE BOOL "") - IF(ENABLE_NETCDF_4) + IF(ENABLE_HDF5) SET(ENABLE_DAP4 ON CACHE BOOL "") - ELSE(ENABLE_NETCDF_4) - SET(ENABLE_DAP4 OFF CACHE BOOL "") - ENDIF(ENABLE_NETCDF_4) + ENDIF(ENABLE_HDF5) ELSE() SET(ENABLE_DAP2 OFF) @@ -1072,15 +1074,15 @@ IF(ENABLE_LARGE_FILE_SUPPORT) ENDIF() ENDIF() -OPTION(ENABLE_EXAMPLE_TESTS "Run extra example tests. Requires GNU Sed. Ignored if netCDF-4 is not Enabled" OFF) -IF(NOT ENABLE_NETCDF_4 AND ENABLE_EXAMPLE_TESTS) +OPTION(ENABLE_EXAMPLE_TESTS "Run extra example tests. Requires GNU Sed. Ignored if HDF5 is not Enabled" OFF) +IF(NOT ENABLE_HDF5 AND ENABLE_EXAMPLE_TESTS) SET(ENABLE_EXAMPLE_TESTS OFF) ENDIF() # Enable Parallel IO with netCDF-4/HDF5 files using HDF5 parallel I/O. SET(STATUS_PARALLEL "OFF") OPTION(ENABLE_PARALLEL4 "Build netCDF-4 with parallel IO" "${HDF5_PARALLEL}") -IF(ENABLE_PARALLEL4 AND ENABLE_NETCDF_4) +IF(ENABLE_PARALLEL4 AND ENABLE_HDF5) IF(NOT HDF5_PARALLEL) SET(USE_PARALLEL OFF CACHE BOOL "") MESSAGE(STATUS "Cannot find HDF5 library built with parallel support. Disabling parallel build.") @@ -1221,9 +1223,9 @@ IF (ENABLE_PARALLEL_TESTS AND NOT USE_PARALLEL) ENDIF() # Enable special filter test; experimental when using cmake. -OPTION(ENABLE_FILTER_TESTING "Enable filter testing. Ignored if shared libraries or netCDF4 are not enabled" ${ENABLE_NETCDF_4}) -IF(ENABLE_FILTER_TESTING AND NOT ENABLE_NETCDF_4) - MESSAGE(WARNING "ENABLE_FILTER_TESTING requires netCDF-4. Disabling.") +OPTION(ENABLE_FILTER_TESTING "Enable filter testing. Ignored if shared libraries or netCDF4 are not enabled" ${ENABLE_HDF5}) +IF(ENABLE_FILTER_TESTING AND NOT ENABLE_HDF5) + MESSAGE(WARNING "ENABLE_FILTER_TESTING requires HDF5. Disabling.") SET(ENABLE_FILTER_TESTING OFF) ENDIF() IF(NOT BUILD_SHARED_LIBS) @@ -1859,7 +1861,7 @@ IF(ENABLE_TESTS) ADD_SUBDIRECTORY(nctest) ENDIF() ADD_SUBDIRECTORY(nc_test) - IF(USE_NETCDF4) + IF(USE_HDF5) INCLUDE_DIRECTORIES(h5_test) ADD_SUBDIRECTORY(nc_test4) IF(BUILD_BENCHMARKS) @@ -2034,7 +2036,7 @@ is_enabled(BUILD_SHARED_LIBS enable_shared) is_enabled(ENABLE_V2_API HAS_NC2) is_enabled(ENABLE_NETCDF_4 HAS_NC4) is_enabled(ENABLE_HDF4 HAS_HDF4) -is_enabled(ENABLE_NETCDF_4 HAS_HDF5) +is_enabled(USE_HDF5 HAS_HDF5) is_enabled(USE_SZIP HAS_SZIP) is_enabled(USE_SZIP HAS_SZIP_WRITE) is_enabled(STATUS_PNETCDF HAS_PNETCDF) @@ -2053,6 +2055,7 @@ is_enabled(ENABLE_ERANGE_FILL HAS_ERANGE_FILL) is_enabled(HAVE_H5Z_SZIP HAS_SZLIB) is_enabled(HDF5_HAS_PAR_FILTERS HAS_PAR_FILTERS) is_enabled(ENABLE_NCZARR HAS_NCZARR) +is_enabled(ENABLE_S3_TESTS DO_S3_TESTS) # Generate file from template. CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/libnetcdf.settings.in" diff --git a/Makefile.am b/Makefile.am index 8b10ed444..0008d1e75 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,7 +53,7 @@ endif if USE_HDF5 H5_TEST_DIR = h5_test LIBHDF5 = libhdf5 -if USE_NETCDF4 +if USE_HDF5 NC_TEST4 = nc_test4 endif endif diff --git a/configure.ac b/configure.ac index 80b032f19..35212641e 100644 --- a/configure.ac +++ b/configure.ac @@ -76,7 +76,7 @@ AC_CONFIG_SRCDIR([include/netcdf.h]) AC_MSG_NOTICE([checking supported formats]) -# An explicit setting of netcdf-4 | netcdf4 is treated as if it was enable-hdf5 +# An explicit disable of netcdf-4 | netcdf4 is treated as if it was disable-hdf5 AC_MSG_CHECKING([whether we should build with netcdf4 (alias for HDF5)]) AC_ARG_ENABLE([netcdf4], [AS_HELP_STRING([--disable-netcdf4], [(synonym for --enable-hdf5)])]) @@ -87,6 +87,7 @@ AC_ARG_ENABLE([netcdf-4], [AS_HELP_STRING([--disable-netcdf-4], [(synonym for --disable-netcdf4)])]) test "x$enable_netcdf_4" = xno || enable_netcdf_4=yes AC_MSG_RESULT([$enable_netcdf_4]) +# Propagate the alias if test "x$enable_netcdf_4" = xno ; then enable_netcdf4=no; fi if test "x$enable_netcdf4" = xno ; then enable_netcdf_4=no; fi @@ -96,7 +97,7 @@ AC_ARG_ENABLE([hdf5], [AS_HELP_STRING([--disable-hdf5], [do not build with HDF5])]) test "x$enable_hdf5" = xno || enable_hdf5=yes if test "x$enable_netcdf4" = xno ; then enable_hdf5=no ; fi -# netcdf4 is synonym for setting hdf5 +# disable-netcdf4 is synonym for disable-hdf5 AC_MSG_RESULT([$enable_hdf5]) # Check whether we want to enable CDF5 support. @@ -623,8 +624,8 @@ AC_ARG_ENABLE([benchmarks], are timed. We use these tests to check netCDF performance.])]) test "x$enable_benchmarks" = xyes || enable_benchmarks=no AC_MSG_RESULT($enable_benchmarks) -if test "x$enable_netcdf4" = xno -a "x$enable_benchmarks" = xyes; then -AC_MSG_ERROR([Can't use benchmarks if netCDF-4 is disabled.]) +if test "x$enable_HDF5" = xno -a "x$enable_benchmarks" = xyes; then +AC_MSG_ERROR([Can't use benchmarks if HDF5 is disabled.]) fi AM_CONDITIONAL(BUILD_BENCHMARKS, [test x$enable_benchmarks = xyes]) @@ -1102,10 +1103,10 @@ AC_CHECK_SIZEOF(ssize_t) $SLEEPCMD AC_CHECK_SIZEOF([void*]) -if test "x$enable_netcdf_4" = xyes || test "x$enable_dap" = xyes; then +if test "x$enable_hdf5" = xyes || test "x$enable_dap" = xyes; then AC_SEARCH_LIBS([deflate], [zlibwapi zlibstat zlib zlib1 z], [], [ AC_MSG_ERROR([Can't find or link to the z library. Turn off netCDF-4 and \ - DAP clients with --disable-netcdf-4 --disable-dap, or see config.log for errors.])]) + DAP clients with --disable-hdf5 --disable-dap, or see config.log for errors.])]) AC_SEARCH_LIBS([dlopen], [dl dld], [], []) fi @@ -1130,9 +1131,9 @@ if test "x$enable_hdf5" = xyes; then # Check for the main hdf5 and hdf5_hl library. AC_SEARCH_LIBS([H5Fflush], [hdf5dll hdf5], [], - [AC_MSG_ERROR([Can't find or link to the hdf5 library. Use --disable-netcdf-4, or see config.log for errors.])]) + [AC_MSG_ERROR([Can't find or link to the hdf5 library. Use --disable-hdf5, or see config.log for errors.])]) AC_SEARCH_LIBS([H5DSis_scale], [hdf5_hldll hdf5_hl], [], - [AC_MSG_ERROR([Can't find or link to the hdf5 high-level. Use --disable-netcdf-4, or see config.log for errors.])]) + [AC_MSG_ERROR([Can't find or link to the hdf5 high-level. Use --disable-hdf5, or see config.log for errors.])]) AC_CHECK_HEADERS([hdf5.h], [], [AC_MSG_ERROR([Compiling a test with HDF5 failed. Either hdf5.h cannot be found, or config.log should be checked for other reason.])]) @@ -1472,48 +1473,6 @@ AC_ARG_ENABLE([filter-testing], test "x$enable_filter_testing" = xno || enable_filter_testing=yes AC_MSG_RESULT($enable_filter_testing) -# Control client filters -AC_MSG_CHECKING([whether client filters should be enabled]) -AC_ARG_ENABLE([client-filters], - [AS_HELP_STRING([--enable-clientfilters], - [Enable client side filters; default off])]) -test "x$enable_client_filters" = xyes || enable_client_filters=no -AC_MSG_RESULT($enable_client_filters) - -if test "x$enable_netcdf_4" = xno ; then -AC_MSG_WARN([netCDF-4 disabled => --disable-filter-testing && --disable-client-filters]) -enable_filter_testing=no -enable_client_filters=no -fi - -if test "x$enable_hdf5" = xno ; then -AC_MSG_WARN([HDF5 disabled => --disable-filter-testing]) -enable_filter_testing=no -fi - -if test "x$enable_shared" = xno ; then -AC_MSG_WARN([Shared libraries are disabled => --disable-filter-testing]) -enable_filter_testing=no -fi -AM_CONDITIONAL(ENABLE_CLIENT_FILTERS, [test x$enable_client_filters = xyes]) - -if test "x$enable_netcdf_4" = xno ; then -AC_MSG_WARN([netCDF-4 disabled => --disable-filter-testing && --disable-client-filters]) -enable_filter_testing=no -enable_client_filters=no -fi - -if test "x$enable_hdf5" = xno ; then -AC_MSG_WARN([HDF5 disabled => --disable-filter-testing]) -enable_filter_testing=no -fi - -if test "x$enable_shared" = xno ; then -AC_MSG_WARN([Shared libraries are disabled => --disable-filter-testing]) -enable_filter_testing=no -fi -AM_CONDITIONAL(ENABLE_FILTER_TESTING, [test x$enable_filter_testing = xyes]) - # Enable client side filter registration AC_MSG_CHECKING([If client-side filters are enabled (default off)]) AC_ARG_ENABLE([clientside-filters], @@ -1526,7 +1485,20 @@ AC_MSG_RESULT($enable_clientside_filters) if test "x$enable_clientside_filters" = xyes ; then AC_DEFINE([ENABLE_CLIENTSIDE_FILTERS], [1], [if true, enable client-side filters]) fi + +if test "x$enable_hdf5" = xno ; then +AC_MSG_WARN([HDF5 disabled => --disable-filter-testing && --disable-client-filters]) +enable_filter_testing=no +enable_clientside_filters=no +fi + AM_CONDITIONAL(ENABLE_CLIENTSIDE_FILTERS, [test x$enable_clientside_filters = xyes]) +AM_CONDITIONAL(ENABLE_FILTER_TESTING, [test x$enable_filter_testing = xyes]) + +if test "x$enable_shared" = xno ; then +AC_MSG_WARN([Shared libraries are disabled => --disable-filter-testing]) +enable_filter_testing=no +fi AC_SUBST(NC_LIBS,[$NC_LIBS]) AC_SUBST(HAS_DAP,[$enable_dap]) @@ -1551,6 +1523,7 @@ AC_SUBST(HAS_BYTERANGE,[$enable_byterange]) AC_SUBST(RELAX_COORD_BOUND,[yes]) AC_SUBST([HAS_PAR_FILTERS], [$hdf5_supports_par_filters]) AC_SUBST(HAS_NCZARR,[$enable_nczarr]) +AC_SUBST(DO_S3_TESTS,[$enable_s3_tests]) # Include some specifics for netcdf on windows. #AH_VERBATIM([_WIN32_STRICMP], @@ -1607,7 +1580,7 @@ AC_SUBST([NC_VERSION]) NC_VERSION=$VERSION AX_SET_META([NC_HAS_NC2],[$nc_build_v2],[yes]) AX_SET_META([NC_HAS_NC4],[$enable_netcdf_4],[yes]) AX_SET_META([NC_HAS_HDF4],[$enable_hdf4],[yes]) -AX_SET_META([NC_HAS_HDF5],[$enable_netcdf_4],[yes]) +AX_SET_META([NC_HAS_HDF5],[$enable_hdf5],[yes]) AX_SET_META([NC_HAS_SZIP],[$ac_cv_func_H5Z_SZIP],[yes]) AX_SET_META([NC_HAS_DAP2],[$enable_dap],[yes]) AX_SET_META([NC_HAS_DAP4],[$enable_dap4],[yes]) diff --git a/include/hdf5dispatch.h b/include/hdf5dispatch.h index e8f374172..1e57eb1e9 100644 --- a/include/hdf5dispatch.h +++ b/include/hdf5dispatch.h @@ -53,6 +53,15 @@ extern "C" { NC4_HDF5_set_var_chunk_cache(int ncid, int varid, size_t size, size_t nelems, float preemption); + EXTERNL int + HDF5_def_dim(int ncid, const char *name, size_t len, int *idp); + + EXTERNL int + HDF5_inq_dim(int ncid, int dimid, char *name, size_t *lenp); + + EXTERNL int + HDF5_rename_dim(int ncid, int dimid, const char *name); + #if defined(__cplusplus) } #endif diff --git a/include/nc4dispatch.h b/include/nc4dispatch.h index 8fb4a41dd..48462d4d3 100644 --- a/include/nc4dispatch.h +++ b/include/nc4dispatch.h @@ -63,21 +63,12 @@ extern "C" { /* Begin _dim */ - EXTERNL int - NC4_def_dim(int ncid, const char *name, size_t len, int *idp); - EXTERNL int NC4_inq_dimid(int ncid, const char *name, int *idp); - EXTERNL int - NC4_inq_dim(int ncid, int dimid, char *name, size_t *lenp); - EXTERNL int NC4_inq_unlimdim(int ncid, int *unlimdimidp); - EXTERNL int - NC4_rename_dim(int ncid, int dimid, const char *name); - /* End _dim */ /* Begin _att */ diff --git a/include/nc_logging.h b/include/nc_logging.h index 6b4522788..beaa3e463 100644 --- a/include/nc_logging.h +++ b/include/nc_logging.h @@ -51,7 +51,7 @@ void nc_log_hdf5(void); #define BAIL_QUIET BAIL -#ifdef USE_NETCDF_4 +#ifdef USE_NETCDF4 #ifndef ENABLE_SET_LOG_LEVEL /* Define away any calls to nc_set_log_level(), if its not enabled. */ #define nc_set_log_level(e) diff --git a/include/ncdispatch.h b/include/ncdispatch.h index 7d9b2f687..1219027e7 100644 --- a/include/ncdispatch.h +++ b/include/ncdispatch.h @@ -55,9 +55,7 @@ #define T_uint NC_UINT #define T_longlong NC_INT64 #define T_ulonglong NC_UINT64 -#ifdef USE_NETCDF4 #define T_string NC_STRING -#endif /* Synthetic type to handle special memtypes */ #define T_uchar NC_UBYTE diff --git a/libdap2/CMakeLists.txt b/libdap2/CMakeLists.txt index 126385c97..44f9bb282 100644 --- a/libdap2/CMakeLists.txt +++ b/libdap2/CMakeLists.txt @@ -20,9 +20,9 @@ set(man_MANS netcdf.3) set(ARGS_MANPAGE -DAPI=C) -IF (USE_NETCDF4) +IF (USE_HDF5) SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE) -ENDIF(USE_NETCDF4) +ENDIF(USE_HDF5) IF (BUILD_DAP) SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE) diff --git a/libdap2/Makefile.am b/libdap2/Makefile.am index 765a2f2fc..135390339 100644 --- a/libdap2/Makefile.am +++ b/libdap2/Makefile.am @@ -24,11 +24,6 @@ HDRS= nccommon.h constraints.h ncd2dispatch.h dapincludes.h \ dapodom.h getvara.h dapnc.h daputil.h dapdebug.h dapdump.h \ dceconstraints.h dcetab.h dceparselex.h -if USE_NETCDF4 -#SRC += cdf4.c constraints4.c ncd4dispatch.c ncdap4.c getvara4.c -#HDRS +=constraints4.h ncd4dispatch.h ncdap4.h -endif - if ENABLE_DAP if USE_NETCDF4 diff --git a/libdap4/CMakeLists.txt b/libdap4/CMakeLists.txt index 0eb4e173c..fdc5c17a2 100644 --- a/libdap4/CMakeLists.txt +++ b/libdap4/CMakeLists.txt @@ -20,9 +20,9 @@ set(man_MANS netcdf.3) set(ARGS_MANPAGE -DAPI=C) -IF (USE_NETCDF4) +IF (USE_HDf5) SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE) -ENDIF(USE_NETCDF4) +ENDIF(USE_HDF5) IF (BUILD_DAP) SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE) diff --git a/libhdf4/hdf4dispatch.c b/libhdf4/hdf4dispatch.c index e95af5ecd..f9a8faf95 100644 --- a/libhdf4/hdf4dispatch.c +++ b/libhdf4/hdf4dispatch.c @@ -12,6 +12,7 @@ #include #include "hdf4dispatch.h" #include "nc4dispatch.h" +#include "hdf5dispatch.h" /* This is the dispatch object that holds pointers to all the * functions that make up the HDF4 dispatch interface. */ @@ -37,7 +38,7 @@ static const NC_Dispatch HDF4_dispatcher = { NC_RO_def_dim, NC4_inq_dimid, - NC4_inq_dim, + HDF5_inq_dim, NC4_inq_unlimdim, NC_RO_rename_dim, diff --git a/libhdf5/hdf5dim.c b/libhdf5/hdf5dim.c index 99df8735a..fd93bf9b2 100644 --- a/libhdf5/hdf5dim.c +++ b/libhdf5/hdf5dim.c @@ -38,7 +38,7 @@ * @author Ed Hartnett */ int -NC4_def_dim(int ncid, const char *name, size_t len, int *idp) +HDF5_def_dim(int ncid, const char *name, size_t len, int *idp) { NC *nc; NC_GRP_INFO_T *grp; @@ -132,7 +132,7 @@ NC4_def_dim(int ncid, const char *name, size_t len, int *idp) * @author Ed Hartnett */ int -NC4_inq_dim(int ncid, int dimid, char *name, size_t *lenp) +HDF5_inq_dim(int ncid, int dimid, char *name, size_t *lenp) { NC *nc; NC_FILE_INFO_T *h5; @@ -217,7 +217,7 @@ NC4_inq_dim(int ncid, int dimid, char *name, size_t *lenp) * @author Ed Hartnett */ int -NC4_rename_dim(int ncid, int dimid, const char *name) +HDF5_rename_dim(int ncid, int dimid, const char *name) { NC_GRP_INFO_T *grp; NC_DIM_INFO_T *dim; diff --git a/libhdf5/hdf5dispatch.c b/libhdf5/hdf5dispatch.c index e66a910bc..07bbe20be 100644 --- a/libhdf5/hdf5dispatch.c +++ b/libhdf5/hdf5dispatch.c @@ -35,11 +35,11 @@ static const NC_Dispatch HDF5_dispatcher = { NC4_inq, NC4_inq_type, - NC4_def_dim, + HDF5_def_dim, NC4_inq_dimid, - NC4_inq_dim, + HDF5_inq_dim, NC4_inq_unlimdim, - NC4_rename_dim, + HDF5_rename_dim, NC4_HDF5_inq_att, NC4_HDF5_inq_attid, diff --git a/libhdf5/hdf5type.c b/libhdf5/hdf5type.c index 8c15e15b7..f1661100e 100644 --- a/libhdf5/hdf5type.c +++ b/libhdf5/hdf5type.c @@ -94,84 +94,6 @@ NC4_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, return NC_NOERR; } -/** - * @internal Get the id of a type from the name. - * - * @param ncid File and group ID. - * @param name Name of type. - * @param typeidp Pointer that will get the type ID. - * - * @return ::NC_NOERR No error. - * @return ::NC_ENOMEM Out of memory. - * @return ::NC_EINVAL Bad size. - * @return ::NC_ENOTNC4 User types in netCDF-4 files only. - * @return ::NC_EBADTYPE Type not found. - * @author Ed Hartnett - */ -EXTERNL int -NC4_inq_typeid(int ncid, const char *name, nc_type *typeidp) -{ - NC_GRP_INFO_T *grp; - NC_GRP_INFO_T *grptwo; - NC_FILE_INFO_T *h5; - NC_TYPE_INFO_T *type = NULL; - char *norm_name; - int i, retval; - - /* Handle atomic types. */ - for (i = 0; i < NUM_ATOMIC_TYPES; i++) - if (!strcmp(name, nc4_atomic_name[i])) - { - if (typeidp) - *typeidp = i; - return NC_NOERR; - } - - /* Find info for this file and group, and set pointer to each. */ - if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) - return retval; - assert(h5 && grp); - - /* If the first char is a /, this is a fully-qualified - * name. Otherwise, this had better be a local name (i.e. no / in - * the middle). */ - if (name[0] != '/' && strstr(name, "/")) - return NC_EINVAL; - - /* Normalize name. */ - if (!(norm_name = (char*)malloc(strlen(name) + 1))) - return NC_ENOMEM; - if ((retval = nc4_normalize_name(name, norm_name))) { - free(norm_name); - return retval; - } - /* Is the type in this group? If not, search parents. */ - for (grptwo = grp; grptwo; grptwo = grptwo->parent) { - type = (NC_TYPE_INFO_T*)ncindexlookup(grptwo->type,norm_name); - if(type) - { - if (typeidp) - *typeidp = type->hdr.id; - break; - } - } - - /* Still didn't find type? Search file recursively, starting at the - * root group. */ - if (!type) - if ((type = nc4_rec_find_named_type(grp->nc4_info->root_grp, norm_name))) - if (typeidp) - *typeidp = type->hdr.id; - - free(norm_name); - - /* OK, I give up already! */ - if (!type) - return NC_EBADTYPE; - - return NC_NOERR; -} - /** * @internal This internal function adds a new user defined type to * the metadata of a group of an open file. diff --git a/libhdf5/hdf5var.c b/libhdf5/hdf5var.c index b2ca30c91..b2c473895 100644 --- a/libhdf5/hdf5var.c +++ b/libhdf5/hdf5var.c @@ -1910,7 +1910,7 @@ NC4_get_vars(int ncid, int varid, const size_t *startp, const size_t *countp, /* We can't go beyond the largest current extent of the unlimited dim. */ - if ((retval = NC4_inq_dim(ncid, dim->hdr.id, NULL, &ulen))) + if ((retval = HDF5_inq_dim(ncid, dim->hdr.id, NULL, &ulen))) BAIL(retval); /* Check for out of bound requests. */ diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index 0c59cc0c9..3c56caf83 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -2234,78 +2234,6 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp) return retval; } -/** - * @internal Get the class of a type - * - * @param h5 Pointer to the HDF5 file info struct. - * @param xtype NetCDF type ID. - * @param type_class Pointer that gets class of type, NC_INT, - * NC_FLOAT, NC_CHAR, or NC_STRING, NC_ENUM, NC_VLEN, NC_COMPOUND, or - * NC_OPAQUE. - * - * @return ::NC_NOERR No error. - * @author Ed Hartnett - */ -int -nc4_get_typeclass(const NC_FILE_INFO_T *h5, nc_type xtype, int *type_class) -{ - int retval = NC_NOERR; - - LOG((4, "%s xtype: %d", __func__, xtype)); - assert(type_class); - - /* If this is an atomic type, the answer is easy. */ - if (xtype <= NC_STRING) - { - switch (xtype) - { - case NC_BYTE: - case NC_UBYTE: - case NC_SHORT: - case NC_USHORT: - case NC_INT: - case NC_UINT: - case NC_INT64: - case NC_UINT64: - /* NC_INT is class used for all integral types */ - *type_class = NC_INT; - break; - - case NC_FLOAT: - case NC_DOUBLE: - /* NC_FLOAT is class used for all floating-point types */ - *type_class = NC_FLOAT; - break; - - case NC_CHAR: - *type_class = NC_CHAR; - break; - - case NC_STRING: - *type_class = NC_STRING; - break; - - default: - BAIL(NC_EBADTYPE); - } - } - else - { - NC_TYPE_INFO_T *type; - - /* See if it's a used-defined type */ - if ((retval = nc4_find_type(h5, xtype, &type))) - BAIL(retval); - if (!type) - BAIL(NC_EBADTYPE); - - *type_class = type->nc_type_class; - } - -exit: - return retval; -} - /** * @internal Report information about an open HDF5 object. This is * called on any still-open objects when a HDF5 file close is diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt index c656b0085..1d9a27ac8 100644 --- a/liblib/CMakeLists.txt +++ b/liblib/CMakeLists.txt @@ -10,10 +10,11 @@ SET(liblib_LIBS dispatch netcdf3) # Add target objects/modules based on options. ##### -IF(USE_HDF5 OR USE_NETCDF4) +IF(USE_NETCDF4) SET(liblib_LIBS ${liblib_LIBS} netcdf4) +ENDIF() +IF(USE_HDF5) SET(liblib_LIBS ${liblib_LIBS} netcdfhdf5) - ENDIF() IF(USE_PNETCDF) @@ -71,7 +72,7 @@ IF(HAVE_LIBDL) SET(TLL_LIBS ${LIBDL} ${TLL_LIBS}) ENDIF() -IF(USE_HDF5 OR USE_NETCDF4) +IF(USE_HDF5) IF(NOT MSVC) # Some version of cmake define HDF5_hdf5_LIBRARY instead of # HDF5_LIBRARY. Same with HDF5_HL_LIBRARIES diff --git a/liblib/Makefile.am b/liblib/Makefile.am index 4a77989e0..a1577b68c 100644 --- a/liblib/Makefile.am +++ b/liblib/Makefile.am @@ -44,7 +44,7 @@ endif # USE_PNETCDF if USE_HDF5 AM_CPPFLAGS += -I${top_srcdir}/libhdf5 libnetcdf_la_LIBADD += ${top_builddir}/libhdf5/libnchdf5.la -endif # USE_NETCDF4 +endif # USE_HDF5 # + hdf4 if USE_HDF4 diff --git a/libnczarr/zdim.c b/libnczarr/zdim.c index 519f8119c..738297220 100644 --- a/libnczarr/zdim.c +++ b/libnczarr/zdim.c @@ -271,4 +271,3 @@ NCZ_inq_unlimdims(int ncid, int *ndimsp, int *unlimdimidsp) if(ndimsp) *ndimsp = 0; return NC_NOERR; } - diff --git a/libnczarr/zdispatch.c b/libnczarr/zdispatch.c index a5ce4ad4a..8706b1617 100644 --- a/libnczarr/zdispatch.c +++ b/libnczarr/zdispatch.c @@ -38,7 +38,7 @@ static const NC_Dispatch NCZ_dispatcher = { NCZ_def_dim, NC4_inq_dimid, - NC4_inq_dim, + NCZ_inq_dim, NC4_inq_unlimdim, NCZ_rename_dim, diff --git a/libnczarr/zfilter.c b/libnczarr/zfilter.c index 240dafd3d..b430509f1 100644 --- a/libnczarr/zfilter.c +++ b/libnczarr/zfilter.c @@ -21,7 +21,7 @@ /* WARNING: GLOBAL VARIABLE */ -#ifdef ENABLE_CLIENT_FILTERS +#ifdef ENABLE_CLIENTSIDE_FILTERS /* Define list of registered filters */ static NClist* NCZ_registeredfilters = NULL; /** List */ diff --git a/libnczarr/zinternal.h b/libnczarr/zinternal.h index 68753e209..a507ef53e 100644 --- a/libnczarr/zinternal.h +++ b/libnczarr/zinternal.h @@ -204,7 +204,7 @@ int ncz_find_default_chunksizes2(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var); /* zfilter.c */ int NCZ_filter_actions(int ncid, int varid, int op, void* args); -#ifdef ENABLE_CLIENT_FILTERS +#ifdef ENABLE_CLIENTSIDE_FILTERS int NCZ_global_filter_action(int op, unsigned int id, NC_FILTER_OBJ_HDF5* infop); #endif diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt index 65a3f8745..3913956ae 100644 --- a/libsrc/CMakeLists.txt +++ b/libsrc/CMakeLists.txt @@ -40,9 +40,9 @@ SET(MAN_FILES netcdf.3) set(ARGS_MANPAGE -DAPI=C) -IF (USE_NETCDF4) +IF (USE_HDF5) SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE) -ENDIF(USE_NETCDF4) +ENDIF(USE_HDF5) IF (BUILD_DAP) SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE) diff --git a/libsrc4/CMakeLists.txt b/libsrc4/CMakeLists.txt index f40fba5f0..7f970aae2 100644 --- a/libsrc4/CMakeLists.txt +++ b/libsrc4/CMakeLists.txt @@ -31,9 +31,9 @@ set(man_MANS netcdf.3) set(ARGS_MANPAGE -DAPI=C) -IF (USE_NETCDF4) +IF (USE_HDF5) SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DNETCDF4=TRUE) -ENDIF(USE_NETCDF4) +ENDIF(USE_HDF5) IF (BUILD_DAP) SET(ARGS_MANPAGE ${ARGS_MANPAGE} -DDAP=TRUE) diff --git a/libsrc4/nc4type.c b/libsrc4/nc4type.c index f7ae87850..12deea9d4 100644 --- a/libsrc4/nc4type.c +++ b/libsrc4/nc4type.c @@ -532,3 +532,153 @@ NC4_inq_enum_member(int ncid, nc_type typeid1, int idx, char *identifier, return NC_NOERR; } + +/** + * @internal Get the id of a type from the name. + * + * @param ncid File and group ID. + * @param name Name of type. + * @param typeidp Pointer that will get the type ID. + * + * @return ::NC_NOERR No error. + * @return ::NC_ENOMEM Out of memory. + * @return ::NC_EINVAL Bad size. + * @return ::NC_ENOTNC4 User types in netCDF-4 files only. + * @return ::NC_EBADTYPE Type not found. + * @author Ed Hartnett + */ +EXTERNL int +NC4_inq_typeid(int ncid, const char *name, nc_type *typeidp) +{ + NC_GRP_INFO_T *grp; + NC_GRP_INFO_T *grptwo; + NC_FILE_INFO_T *h5; + NC_TYPE_INFO_T *type = NULL; + char *norm_name; + int i, retval; + + /* Handle atomic types. */ + for (i = 0; i < NUM_ATOMIC_TYPES; i++) + if (!strcmp(name, nc4_atomic_name[i])) + { + if (typeidp) + *typeidp = i; + return NC_NOERR; + } + + /* Find info for this file and group, and set pointer to each. */ + if ((retval = nc4_find_grp_h5(ncid, &grp, &h5))) + return retval; + assert(h5 && grp); + + /* If the first char is a /, this is a fully-qualified + * name. Otherwise, this had better be a local name (i.e. no / in + * the middle). */ + if (name[0] != '/' && strstr(name, "/")) + return NC_EINVAL; + + /* Normalize name. */ + if (!(norm_name = (char*)malloc(strlen(name) + 1))) + return NC_ENOMEM; + if ((retval = nc4_normalize_name(name, norm_name))) { + free(norm_name); + return retval; + } + /* Is the type in this group? If not, search parents. */ + for (grptwo = grp; grptwo; grptwo = grptwo->parent) { + type = (NC_TYPE_INFO_T*)ncindexlookup(grptwo->type,norm_name); + if(type) + { + if (typeidp) + *typeidp = type->hdr.id; + break; + } + } + + /* Still didn't find type? Search file recursively, starting at the + * root group. */ + if (!type) + if ((type = nc4_rec_find_named_type(grp->nc4_info->root_grp, norm_name))) + if (typeidp) + *typeidp = type->hdr.id; + + free(norm_name); + + /* OK, I give up already! */ + if (!type) + return NC_EBADTYPE; + + return NC_NOERR; +} + +/** + * @internal Get the class of a type + * + * @param h5 Pointer to the HDF5 file info struct. + * @param xtype NetCDF type ID. + * @param type_class Pointer that gets class of type, NC_INT, + * NC_FLOAT, NC_CHAR, or NC_STRING, NC_ENUM, NC_VLEN, NC_COMPOUND, or + * NC_OPAQUE. + * + * @return ::NC_NOERR No error. + * @author Ed Hartnett + */ +int +nc4_get_typeclass(const NC_FILE_INFO_T *h5, nc_type xtype, int *type_class) +{ + int retval = NC_NOERR; + + LOG((4, "%s xtype: %d", __func__, xtype)); + assert(type_class); + + /* If this is an atomic type, the answer is easy. */ + if (xtype <= NC_STRING) + { + switch (xtype) + { + case NC_BYTE: + case NC_UBYTE: + case NC_SHORT: + case NC_USHORT: + case NC_INT: + case NC_UINT: + case NC_INT64: + case NC_UINT64: + /* NC_INT is class used for all integral types */ + *type_class = NC_INT; + break; + + case NC_FLOAT: + case NC_DOUBLE: + /* NC_FLOAT is class used for all floating-point types */ + *type_class = NC_FLOAT; + break; + + case NC_CHAR: + *type_class = NC_CHAR; + break; + + case NC_STRING: + *type_class = NC_STRING; + break; + + default: + BAIL(NC_EBADTYPE); + } + } + else + { + NC_TYPE_INFO_T *type; + + /* See if it's a used-defined type */ + if ((retval = nc4_find_type(h5, xtype, &type))) + BAIL(retval); + if (!type) + BAIL(NC_EBADTYPE); + + *type_class = type->nc_type_class; + } + +exit: + return retval; +} diff --git a/nc_test/CMakeLists.txt b/nc_test/CMakeLists.txt index 13c84404f..c1da27435 100644 --- a/nc_test/CMakeLists.txt +++ b/nc_test/CMakeLists.txt @@ -60,8 +60,8 @@ IF(LARGE_FILE_TESTS) ENDIF() -SET(TESTFILES ${TESTFILES} tst_diskless tst_diskless3 tst_diskless4 tst_diskless5 tst_inmemory tst_open_mem) -IF(USE_NETCDF4) +SET(TESTFILES ${TESTFILES} tst_diskless tst_diskless3 tst_diskless4 tst_diskless5 tst_inmemory tst_open_mem) +IF(USE_HDF5) SET(TESTFILES ${TESTFILES} tst_diskless2) SET(TESTS ${TESTS} tst_diskless6) ENDIF() diff --git a/nc_test/run_diskless.sh b/nc_test/run_diskless.sh index 7156beff3..f31ced70c 100755 --- a/nc_test/run_diskless.sh +++ b/nc_test/run_diskless.sh @@ -17,18 +17,16 @@ FILE3=tst_diskless3.nc echo "" echo "*** Testing in-memory (diskless) files with and without persistence" -HASHDF5=`${top_builddir}/nc-config --has-hdf5` - echo "**** Test diskless netCDF classic file without persistence" ${execdir}/tst_diskless echo "PASS: diskless netCDF classic file without persistence" -if test "x$HASHDF5" = "xyes" ; then +if test "x$FEATURE_HDF5" = "xyes" ; then echo "" echo "**** Test diskless netCDF enhanced file without persistence" ${execdir}/tst_diskless netcdf4 echo "PASS: diskless netCDF enhanced file without persistence" -fi #HASHDF5 +fi #FEATURE_HDF5 echo "" echo "**** Test diskless netCDF classic file with persistence" @@ -43,7 +41,7 @@ echo "#### $FILE1 not created" echo "FAIL: diskless netCDF classic file with persistence" fi -if test "x$HASHDF5" = "xyes" ; then +if test "x$FEATURE_HDF5" = "xyes" ; then echo "" echo "**** Test diskless netCDF enhanced file with persistence" rm -f $FILE1 @@ -57,10 +55,10 @@ echo "$FILE1 not created" echo "FAIL: diskless netCDF enhanced file with persistence" fi -fi #HASHDF5 +fi #FEATURE_HDF5 # Do extended netcdf enhanced test -if test "x$HASHDF5" = "xyes" ; then +if test "x$FEATURE_HDF5" = "xyes" ; then ok="" echo "" @@ -91,7 +89,7 @@ else echo "FAIL: extended enhanced diskless netCDF with persistence" fi -fi #HASHDF5 +fi #FEATURE_HDF5 echo "" echo "**** Testing nc_open in-memory (diskless) files" diff --git a/nc_test/run_inmemory.sh b/nc_test/run_inmemory.sh index c02f99d84..7ea1066f2 100755 --- a/nc_test/run_inmemory.sh +++ b/nc_test/run_inmemory.sh @@ -1,6 +1,5 @@ #!/bin/sh - if test "x$srcdir" = x ; then srcdir=`pwd`; fi . ../test_common.sh @@ -22,20 +21,19 @@ OMEMFILE=f03tst_open_mem.nc echo "" echo "*** Testing in-memory operations" -HASHDF5=`${top_builddir}/nc-config --has-hdf5` - # Execute the core of the inmemory tests ${execdir}/tst_inmemory -if test "x$HASNC4" = xyes ; then +if test "x$FEATURE_HDF5" = "xyes" ; then ${execdir}/tst_open_mem ${srcdir}/${OMEMFILE} fi -echo "**** Test ncdump of the resulting inmemory data" +echo "**** Test ncdump of the resulting inmemory data: netcdf-3" ${NCDUMP} -n "${FILE3}" ${FILE3}.nc > ${FILE3}.cdl ${NCDUMP} -n "${FILE3}" ${CREATE3}.nc > ${CREATE3}.cdl diff -wb ${FILE3}.cdl ${CREATE3}.cdl -if test "x$HASHDF5" = "xyes" ; then +if test "x$FEATURE_HDF5" = "xyes" ; then +echo "**** Test ncdump of the resulting inmemory data: netcdf-4" ${NCDUMP} ${FILE4}.nc > ${FILE4}.cdl ${NCDUMP} -n ${FILE4} ${CREATE4}.nc > ${CREATE4}.cdl diff -wb ${FILE4}.cdl ${CREATE4}.cdl diff --git a/nc_test/test_byterange.sh b/nc_test/test_byterange.sh index ff39f6210..a6d568e31 100755 --- a/nc_test/test_byterange.sh +++ b/nc_test/test_byterange.sh @@ -9,10 +9,6 @@ set -e URL3="https://remotetest.unidata.ucar.edu/thredds/fileServer/testdata/2004050300_eta_211.nc#bytes" URL4="https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadC/2017/059/03/OR_ABI-L1b-RadC-M3C13_G16_s20170590337505_e20170590340289_c20170590340316.nc#mode=bytes" -# See if netcdf-4 support is enabled -HAVENC4=`cat ${TOPBUILDDIR}/libnetcdf.settings | sed -e '/NetCDF-4[ ]*API:[ ]*yes/p' -e d` -if test "x$HAVENC4" = x ; then HAVENC4=no; else HAVENC4=yes; fi - rm -f tst_http_nc3.cdl tst_http_nc4.cdl echo "" @@ -30,7 +26,7 @@ ${NCDUMP} -h "$URL3" >tst_http_nc3.cdl # compare diff tst_http_nc3.cdl ${srcdir}/ref_tst_http_nc3.cdl -if test "x$HAVENC4" = xyes ; then +if test "x$FEATURE_HDF5" = xyes ; then echo "*** Testing reading NetCDF-4 file with http" # Test using -k flag K=`${NCDUMP} -k "$URL4"` diff --git a/nc_test/tst_big_rvar.c b/nc_test/tst_big_rvar.c index 28c27097b..dd885120a 100644 --- a/nc_test/tst_big_rvar.c +++ b/nc_test/tst_big_rvar.c @@ -22,7 +22,7 @@ /* Test with both classic and 64-bit offset files. If netcdf-4 is * included, test with both netCDF-4 format variants also. */ -/* #ifdef USE_NETCDF4 */ +/* #ifdef USE_HDF5 */ /* #define NUM_FORMATS (4) */ /* #else */ /* #define NUM_FORMATS (2) */ diff --git a/nc_test/tst_big_var.c b/nc_test/tst_big_var.c index b3b5bd994..98dc8dfc6 100644 --- a/nc_test/tst_big_var.c +++ b/nc_test/tst_big_var.c @@ -19,7 +19,7 @@ /* Test with both classic and 64-bit offset files. If netcdf-4 is * included, test with both netCDF-4 format variants also. */ -#ifdef USE_NETCDF4 +#ifdef USE_HDF5 #define NUM_FORMATS (4) #else #define NUM_FORMATS (2) diff --git a/nc_test/tst_big_var2.c b/nc_test/tst_big_var2.c index 362efa557..f3c2cf316 100644 --- a/nc_test/tst_big_var2.c +++ b/nc_test/tst_big_var2.c @@ -22,7 +22,7 @@ /* Test with both classic and 64-bit offset files. If netcdf-4 is * included, test with both netCDF-4 format variants also. */ -#ifdef USE_NETCDF4 +#ifdef USE_HDF5 #define NUM_FORMATS (4) #else #define NUM_FORMATS (2) diff --git a/nc_test/tst_big_var6.c b/nc_test/tst_big_var6.c index 04f6e9d7a..b237a5031 100644 --- a/nc_test/tst_big_var6.c +++ b/nc_test/tst_big_var6.c @@ -21,7 +21,7 @@ /* Test with both classic and 64-bit offset files. If netcdf-4 is * included, test with both netCDF-4 format variants also. */ -#ifdef USE_NETCDF4 +#ifdef USE_HDF5 #define NUM_FORMATS (4) #else #define NUM_FORMATS (2) diff --git a/nc_test/tst_byterange.c b/nc_test/tst_byterange.c index 89b5b804e..6600a0b7b 100644 --- a/nc_test/tst_byterange.c +++ b/nc_test/tst_byterange.c @@ -34,7 +34,7 @@ struct TESTURLS { const char* url; } testurls[] = { {NC_FORMAT_CLASSIC,"https://remotetest.unidata.ucar.edu/thredds/fileServer/testdata/2004050300_eta_211.nc#bytes"}, -#ifdef USE_NETCDF4 +#ifdef USE_HDF5 {NC_FORMAT_NETCDF4,"https://noaa-goes16.s3.amazonaws.com/ABI-L1b-RadC/2017/059/03/OR_ABI-L1b-RadC-M3C13_G16_s20170590337505_e20170590340289_c20170590340316.nc#mode=bytes"}, #endif {0,NULL} diff --git a/nc_test/tst_def_var_fill.c b/nc_test/tst_def_var_fill.c index 14f97a9ac..5c3248542 100644 --- a/nc_test/tst_def_var_fill.c +++ b/nc_test/tst_def_var_fill.c @@ -57,7 +57,7 @@ int main(int argc, char** argv) { #ifndef ENABLE_CDF5 if (formats[k] == NC_FORMAT_CDF5) continue; #endif -#ifndef USE_NETCDF4 +#ifndef USE_HDF5 if (formats[k] == NC_FORMAT_NETCDF4 || formats[k] == NC_FORMAT_NETCDF4_CLASSIC) continue; diff --git a/nc_test/tst_default_format_pnetcdf.c b/nc_test/tst_default_format_pnetcdf.c index 7dff98003..e96653112 100644 --- a/nc_test/tst_default_format_pnetcdf.c +++ b/nc_test/tst_default_format_pnetcdf.c @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) __FILE__, __LINE__, err); nerrs++; } -#ifdef USE_NETCDF4 +#ifdef USE_HDF5 /* check illegal cmode */ cmode = NC_NETCDF4 | NC_64BIT_OFFSET; err = nc_create_par(fname, cmode, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid); diff --git a/nc_test/tst_diskless.c b/nc_test/tst_diskless.c index ed9d8d7fa..13ae21b35 100644 --- a/nc_test/tst_diskless.c +++ b/nc_test/tst_diskless.c @@ -105,7 +105,7 @@ main(int argc, char **argv) /* ignore anything not recognized */ } -#ifndef USE_NETCDF4 +#ifndef USE_HDF5 fprintf(stderr,"netcdf-4 not supported; ignored\n"); usenetcdf4 = 0; #endif diff --git a/nc_test/tst_large.c b/nc_test/tst_large.c index 7cc9f15f2..f9f643f3a 100644 --- a/nc_test/tst_large.c +++ b/nc_test/tst_large.c @@ -17,7 +17,7 @@ /* Test with both classic and 64-bit offset files. If netcdf-4 is * included, test with both netCDF-4 format variants also. */ -#ifdef USE_NETCDF4 +#ifdef USE_HDF5 #define NUM_FORMATS (4) #else #define NUM_FORMATS (2) diff --git a/nc_test/tst_large_cdf5.c b/nc_test/tst_large_cdf5.c index 106d4f002..8ae0b2a2e 100644 --- a/nc_test/tst_large_cdf5.c +++ b/nc_test/tst_large_cdf5.c @@ -20,7 +20,7 @@ /* Test with both classic and 64-bit offset files. If netcdf-4 is * included, test with both netCDF-4 format variants also. */ -#ifdef USE_NETCDF4 +#ifdef USE_HDF5 #define NUM_FORMATS (4) #else #define NUM_FORMATS (2) diff --git a/nc_test/tst_misc.c b/nc_test/tst_misc.c index 097d0357c..7c55a1ddf 100644 --- a/nc_test/tst_misc.c +++ b/nc_test/tst_misc.c @@ -61,7 +61,7 @@ main(int argc, char **argv) } SUMMARIZE_ERR; -#ifndef USE_NETCDF4 +#ifndef USE_HDF5 printf("*** Trying to create netCDF-4 file without netCDF-4..."); { int ncid; @@ -70,7 +70,7 @@ main(int argc, char **argv) ERR; } SUMMARIZE_ERR; -#endif /* USE_NETCDF4 undefined */ +#endif /* USE_HDF5 undefined */ #ifdef TEST_PNETCDF MPI_Finalize(); diff --git a/nc_test/tst_names.c b/nc_test/tst_names.c index 0c4cabad9..49c31a409 100644 --- a/nc_test/tst_names.c +++ b/nc_test/tst_names.c @@ -234,7 +234,7 @@ main(int argc, char **argv) NC_FORMAT_NETCDF4 , NC_FORMAT_NETCDF4_CLASSIC -#endif /* USE_NETCDF4 */ +#endif /* USE_HDF5 */ }; int num_formats = (sizeof formats) / (sizeof formats[0]); char *format_names[] = { diff --git a/nc_test/tst_open_mem.c b/nc_test/tst_open_mem.c index 4bd2d58e0..94edfbb04 100644 --- a/nc_test/tst_open_mem.c +++ b/nc_test/tst_open_mem.c @@ -21,7 +21,7 @@ See \ref copyright file for more info. #include "ncbytes.h" #include "nc_tests.h" -#ifdef USE_NETCDF4 +#ifdef USE_HDF5 #include extern int H5Eprint1(FILE * stream); #endif diff --git a/nc_test4/findplugin.in b/nc_test4/findplugin.in index 06568234e..1253f41bb 100644 --- a/nc_test4/findplugin.in +++ b/nc_test4/findplugin.in @@ -28,9 +28,6 @@ FP_NAME="$1" FP_ISCMAKE=@ISCMAKE@ FP_ISMSVC=@MSVC@ -# And topsrcdir -topbuilddir='@abs_top_builddir@' - # Are we operating under OS-X? (test using uname) FP_OS=`uname | cut -d '_' -f 1` if test "x$FP_OS" = xDarwin ; then FP_ISOSX=1; fi @@ -39,7 +36,7 @@ if test "x$FP_OS" = xDarwin ; then FP_ISOSX=1; fi FP_OS=`uname | cut -d '_' -f 1` if test "x$FP_OS" = xCYGWIN ; then FP_ISCYGWIN=1; fi -FP_PLUGINS="$topbuilddir/plugins" +FP_PLUGINS="$TOPBUILDDIR/plugins" FP_PLUGIN_LIB= FP_PLUGIN_PATH= @@ -99,9 +96,3 @@ HDF5_PLUGIN_PATH="$FP_PLUGIN_PATH" return 0 } - -# debug -if test "x$1" != x ; then -findplugin -echo "HDF5_PLUGIN_PATH=|$FP_PLUGIN_PATH|" -fi diff --git a/nc_test4/tst_converts.c b/nc_test4/tst_converts.c index 43507e87e..15a230d2b 100644 --- a/nc_test4/tst_converts.c +++ b/nc_test4/tst_converts.c @@ -44,11 +44,11 @@ determine_test_formats(int *num_formats, int *format) format[ind++] = NC_FORMAT_64BIT_OFFSET; /* Do we have netCDF-4 and netCDF-4 classic? */ -#ifdef USE_NETCDF4 +#ifdef USE_HDF5 num += 2; format[ind++] = NC_FORMAT_NETCDF4_CLASSIC; format[ind++] = NC_FORMAT_NETCDF4; -#endif /* USE_NETCDF4 */ +#endif /* USE_HDF5 */ /* Do we have CDF5? */ #ifdef ENABLE_CDF5 diff --git a/nc_test4/tst_udf.c b/nc_test4/tst_udf.c index 9f74cfe2d..6b079bc16 100644 --- a/nc_test4/tst_udf.c +++ b/nc_test4/tst_udf.c @@ -12,6 +12,7 @@ #include "err_macros.h" #include "netcdf.h" #include "nc4dispatch.h" +#include "hdf5dispatch.h" #include "netcdf_dispatch.h" #define FILE_NAME "tst_udf.nc" @@ -86,7 +87,7 @@ static NC_Dispatch tst_dispatcher = { NC_RO_def_dim, NC4_inq_dimid, - NC4_inq_dim, + HDF5_inq_dim, NC4_inq_unlimdim, NC_RO_rename_dim, @@ -181,7 +182,7 @@ static NC_Dispatch tst_dispatcher_bad_version = { NC_RO_def_dim, NC4_inq_dimid, - NC4_inq_dim, + HDF5_inq_dim, NC4_inq_unlimdim, NC_RO_rename_dim, diff --git a/ncdap_test/t_dap.c b/ncdap_test/t_dap.c index 5c45e69e7..f1ad2ea76 100644 --- a/ncdap_test/t_dap.c +++ b/ncdap_test/t_dap.c @@ -39,16 +39,6 @@ See \ref copyright file for more info. #define DIMSIZE 25 #define STRLEN 64 -#ifndef USE_NETCDF4 -#define NC_UBYTE 7 /* unsigned 1 byte int */ -#define NC_USHORT 8 /* unsigned 2-byte int */ -#define NC_UINT 9 /* unsigned 4-byte int */ -#define NC_INT64 10 /* signed 8-byte int */ -#define NC_UINT64 11 /* unsigned 8-byte int */ -#define NC_STRING 12 /* string */ -#endif - - #define CHECK(expr) check(expr,__FILE__,__LINE__); #define COMMA (i==0?"":",") diff --git a/ncdap_test/t_dap3a.c b/ncdap_test/t_dap3a.c index f043e2885..bbfd36252 100644 --- a/ncdap_test/t_dap3a.c +++ b/ncdap_test/t_dap3a.c @@ -40,16 +40,6 @@ See \ref copyright file for more info. #define DIMSIZE 25 #define STRLEN 64 -#ifndef USE_NETCDF4 -#define NC_UBYTE 7 /* unsigned 1 byte int */ -#define NC_USHORT 8 /* unsigned 2-byte int */ -#define NC_UINT 9 /* unsigned 4-byte int */ -#define NC_INT64 10 /* signed 8-byte int */ -#define NC_UINT64 11 /* unsigned 8-byte int */ -#define NC_STRING 12 /* string */ -#endif - - #define CHECK(expr) check(expr,__FILE__,__LINE__); #define COMMA (i==0?"":",") diff --git a/ncdap_test/test_cvt.c b/ncdap_test/test_cvt.c index 24915c49e..46f52de2a 100644 --- a/ncdap_test/test_cvt.c +++ b/ncdap_test/test_cvt.c @@ -39,16 +39,6 @@ See \ref copyright file for more info. #define DIMSIZE 25 #define STRLEN 64 -#ifndef USE_NETCDF4 -#define NC_UBYTE 7 /* unsigned 1 byte int */ -#define NC_USHORT 8 /* unsigned 2-byte int */ -#define NC_UINT 9 /* unsigned 4-byte int */ -#define NC_INT64 10 /* signed 8-byte int */ -#define NC_UINT64 11 /* unsigned 8-byte int */ -#define NC_STRING 12 /* string */ -#endif - - #define CHECK(expr) check(expr,__FILE__,__LINE__); #define COMMA (i==0?"":",") diff --git a/ncdump/CMakeLists.txt b/ncdump/CMakeLists.txt index 04f3f876d..eb8858f82 100644 --- a/ncdump/CMakeLists.txt +++ b/ncdump/CMakeLists.txt @@ -86,7 +86,7 @@ IF(ENABLE_TESTS) TARGET_LINK_LIBRARIES(bom netcdf) TARGET_LINK_LIBRARIES(tst_dimsizes netcdf) - IF(USE_NETCDF4) + IF(USE_HDF5) ADD_EXECUTABLE(tst_fileinfo tst_fileinfo.c) TARGET_LINK_LIBRARIES(tst_fileinfo netcdf) ENDIF() @@ -120,7 +120,7 @@ IF(ENABLE_TESTS) SET_TARGET_PROPERTIES(nctrunc PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}) - IF(USE_NETCDF4) + IF(USE_HDF5) SET_TARGET_PROPERTIES(tst_fileinfo PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) SET_TARGET_PROPERTIES(tst_fileinfo PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG @@ -128,7 +128,7 @@ IF(ENABLE_TESTS) SET_TARGET_PROPERTIES(tst_fileinfo PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}) - ENDIF(USE_NETCDF4) + ENDIF(USE_HDF5) ENDIF(MSVC) # Base tests @@ -146,11 +146,11 @@ ENDIF(MSVC) add_sh_test(ncdump tst_calendars) build_bin_test_no_prefix(tst_utf8) add_sh_test(ncdump run_utf8_tests) - IF(USE_NETCDF4) + IF(USE_HDF5) add_sh_test(ncdump run_utf8_nc4_tests) add_sh_test(ncdump tst_fileinfo) add_sh_test(ncdump tst_hdf5_offset) - ENDIF(USE_NETCDF4) + ENDIF(USE_HDF5) add_sh_test(ncdump test_unicode_directory) add_sh_test(ncdump tst_null_byte_padding) @@ -180,12 +180,12 @@ ENDIF(MSVC) add_sh_test(ncdump tst_inmemory_nc3) add_sh_test(ncdump tst_nccopy_w3) - IF(USE_NETCDF4) + IF(USE_HDF5) add_sh_test(ncdump tst_inmemory_nc4) add_sh_test(ncdump tst_nccopy_w4) - ENDIF(USE_NETCDF4) + ENDIF(USE_HDF5) - IF(USE_NETCDF4) + IF(USE_HDF5) build_bin_test_no_prefix(tst_create_files) build_bin_test_no_prefix(tst_group_data) build_bin_test_no_prefix(tst_enum_data) @@ -237,9 +237,9 @@ ENDIF(MSVC) # only ran after ncdump was built. ### add_sh_test(ncdump run_ncgen_tests) - IF(USE_NETCDF4) + IF(USE_HDF5) add_sh_test(ncdump run_ncgen_nc4_tests) - ENDIF(USE_NETCDF4) + ENDIF(USE_HDF5) add_sh_test(ncdump tst_grp_spec) add_sh_test(ncdump tst_mud) @@ -255,14 +255,14 @@ ENDIF(MSVC) SET_TESTS_PROPERTIES(ncdump_tst_nccopy5 PROPERTIES RUN_SERIAL TRUE) ENDIF(HAVE_BASH) - IF(USE_NETCDF4) + IF(USE_HDF5) add_sh_test(ncdump tst_ncgen4) - ENDIF(USE_NETCDF4) + ENDIF(USE_HDF5) add_sh_test(ncdump tst_inttags) - IF(USE_NETCDF4) + IF(USE_HDF5) add_sh_test(ncdump tst_inttags4) - ENDIF(USE_NETCDF4) + ENDIF(USE_HDF5) add_sh_test(ncdump test_radix) diff --git a/ncdump/Makefile.am b/ncdump/Makefile.am index ef64bd5a9..c35cd6830 100644 --- a/ncdump/Makefile.am +++ b/ncdump/Makefile.am @@ -84,7 +84,7 @@ TESTS += tst_iter.sh endif if USE_HDF5 -# NetCDF-4 has some extra C programs to build. These will be run by +# HDF5 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 \ diff --git a/ncgen/CMakeLists.txt b/ncgen/CMakeLists.txt index e52d38c88..14153adf6 100644 --- a/ncgen/CMakeLists.txt +++ b/ncgen/CMakeLists.txt @@ -34,7 +34,7 @@ TARGET_LINK_LIBRARIES(ncgen netcdf ${ALL_TLL_LIBS}) # Given a netcdf4 file, dump the actual chunk contents. # Used to validate nczarr chunking code. -IF(USE_NETCDF4) +IF(USE_HDF5) IF(NOT MSVC) SET(ncdumpchunks_FILES ncdumpchunks.c) ADD_EXECUTABLE(ncdumpchunks ${ncdumpchunks_FILES}) diff --git a/ncgen/Makefile.am b/ncgen/Makefile.am index 19ba138f0..95e080aee 100644 --- a/ncgen/Makefile.am +++ b/ncgen/Makefile.am @@ -45,9 +45,9 @@ tst_gattenum.cdl tst_usuffix.cdl # Moved to ncdump as these tests rely on ncdump having been built. ## #TESTS = run_tests.sh -#if USE_NETCDF4 +#if USE_HDF5 #TESTS += run_nc4_tests.sh -#endif # USE_NETCDF4 +#endif # USE_HDF5 #endif # !BUILD_DLL CLEANFILES = c0.nc c0_64.nc c0_4.nc c0_4c.nc ref_camrun.c \ diff --git a/ncgen3/CMakeLists.txt b/ncgen3/CMakeLists.txt index 3a9ed4699..355d289bb 100644 --- a/ncgen3/CMakeLists.txt +++ b/ncgen3/CMakeLists.txt @@ -53,7 +53,7 @@ ENDIF() IF(ENABLE_TESTS) SET(NCGEN3_TESTS run_tests) - IF(USE_NETCDF4) + IF(USE_HDF5) SET(NCGEN3_TESTS ${NCGEN3_TESTS} run_nc4_tests) ENDIF() diff --git a/nczarr_test/CMakeLists.txt b/nczarr_test/CMakeLists.txt index 7ceccd09e..fc2a00470 100644 --- a/nczarr_test/CMakeLists.txt +++ b/nczarr_test/CMakeLists.txt @@ -53,12 +53,14 @@ IF(ENABLE_TESTS) TARGET_INCLUDE_DIRECTORIES(zs3parse PUBLIC ../libnczarr) IF(BUILD_UTILITIES) - add_sh_test(nczarr_test run_ut_map ${ENABLE_S3_TESTS}) - add_sh_test(nczarr_test run_ut_mapapi ${ENABLE_S3_TESTS}) - add_sh_test(nczarr_test run_ut_misc ${ENABLE_S3_TESTS}) - add_sh_test(nczarr_test run_ut_chunk ${ENABLE_S3_TESTS}) - add_sh_test(nczarr_test run_it_test1 ${ENABLE_S3_TESTS}) - add_sh_test(nczarr_test run_it_test2 ${ENABLE_S3_TESTS}) + add_sh_test(nczarr_test run_ut_map) + add_sh_test(nczarr_test run_ut_mapapi) + add_sh_test(nczarr_test run_ut_misc) + add_sh_test(nczarr_test run_ut_chunk) + IF(USE_HDF5) + add_sh_test(nczarr_test run_it_test1) + ENDIF() + add_sh_test(nczarr_test run_it_test2) ENDIF(BUILD_UTILITIES) ENDIF(ENABLE_TESTS) diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am index 10c7de93e..e8b007570 100644 --- a/nczarr_test/Makefile.am +++ b/nczarr_test/Makefile.am @@ -15,10 +15,6 @@ TESTS_ENVIRONMENT = #LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose #TESTS_ENVIRONMENT = export SETX=1; -if ENABLE_S3_TESTS -TESTS_ENVIRONMENT += export ENABLE_S3_TESTS=1; -endif - AM_CFLAGS += -I${top_srcdir} -I${top_srcdir}/libnczarr AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la LDADD = ${top_builddir}/liblib/libnetcdf.la @@ -47,7 +43,10 @@ TESTS += run_ut_map.sh TESTS += run_ut_mapapi.sh TESTS += run_ut_misc.sh TESTS += run_ut_chunk.sh -TESTS += run_it_test1.sh run_it_test2.sh +TESTS += run_it_test2.sh +if USE_HDF5 +TESTS += run_it_test1.sh +endif ignorec = ut_allslices.c ut_transfer.c ut_vars.c ut_walk.c ignoresh = run_meta_tests.sh run_unittests.sh diff --git a/nczarr_test/run_it_test1.sh b/nczarr_test/run_it_test1.sh index 6dbddb870..87cce3e4b 100755 --- a/nczarr_test/run_it_test1.sh +++ b/nczarr_test/run_it_test1.sh @@ -1,7 +1,5 @@ #!/bin/sh -ENABLE_S3_TESTS=$1 - if test "x$srcdir" = x ; then srcdir=`pwd`; fi . ../test_common.sh @@ -75,9 +73,11 @@ cd .. } main() { -ittest nz4 ittest nzf -if test "x$ENABLE_S3_TESTS" != x ; then +if test "x$FEATURE_HDF5" = xyes ; then +ittest nz4 +fi +if test "x$FEATURE_S3TESTS" = xyes ; then ittest s3 'https://stratus.ucar.edu/unidata-netcdf-zarr-testing' fi } diff --git a/nczarr_test/run_it_test2.sh b/nczarr_test/run_it_test2.sh index 9a4971e07..d5fb9687b 100755 --- a/nczarr_test/run_it_test2.sh +++ b/nczarr_test/run_it_test2.sh @@ -1,7 +1,5 @@ #!/bin/sh -ENABLE_S3_TESTS=$1 - if test "x$srcdir" = x ; then srcdir=`pwd`; fi . ../test_common.sh @@ -53,9 +51,11 @@ ${execdir}/tst_chunks2 -e $1 $CLOUD } main() { -ittest nz4 ittest nzf -if test "x$ENABLE_S3_TESTS" != x ; then +if test "xFEATURE_HDF5" = xyes ; then +ittest nz4 +fi +if test "x$FEATURE_S3TESTS" = xyes ; then ittest s3 'https://stratus.ucar.edu/unidata-netcdf-zarr-testing' fi } diff --git a/nczarr_test/run_ut_map.sh b/nczarr_test/run_ut_map.sh index 4edf393b9..7a515111e 100755 --- a/nczarr_test/run_ut_map.sh +++ b/nczarr_test/run_ut_map.sh @@ -93,9 +93,12 @@ echo "" echo "*** Map Unit Testing" -echo ""; echo "*** Test zmap_nz4" -testmapcreate nz4; testmapmeta nz4; testmapdata nz4; testmapsearch nz4 echo ""; echo "*** Test zmap_nzf" testmapcreate nzf; testmapmeta nzf; testmapdata nzf; testmapsearch nzf +if test "x$FEATURE_HDF5" = xyes ; then +echo ""; echo "*** Test zmap_nz4" +testmapcreate nz4; testmapmeta nz4; testmapdata nz4; testmapsearch nz4 +fi + exit 0 diff --git a/nczarr_test/run_ut_mapapi.sh b/nczarr_test/run_ut_mapapi.sh index f41b4b10d..0d309a8d8 100755 --- a/nczarr_test/run_ut_mapapi.sh +++ b/nczarr_test/run_ut_mapapi.sh @@ -1,7 +1,5 @@ #!/bin/sh -ENABLE_S3_TESTS=$1 - if test "x$srcdir" = x ; then srcdir=`pwd`; fi . ../test_common.sh @@ -77,11 +75,13 @@ testmapsearch() { main() { echo "" echo "*** Map Unit Testing" -echo ""; echo "*** Test zmap_nz4" -testmapcreate nz4; testmapmeta nz4; testmapdata nz4; testmapsearch nz4 echo ""; echo "*** Test zmap_nzf" testmapcreate nzf; testmapmeta nzf; testmapdata nzf; testmapsearch nzf -if test "x$ENABLE_S3_TESTS" != x ; then +if test "x$FEATURE_HDF5" = xyes ; then +echo ""; echo "*** Test zmap_nz4" +testmapcreate nz4; testmapmeta nz4; testmapdata nz4; testmapsearch nz4 +fi +if test "x$FEATURE_S3TESTS" = xyes ; then echo ""; echo "*** Test zmap_s3sdk" testmapcreate s3; testmapmeta s3; testmapdata s3; testmapsearch s3 fi diff --git a/test_common.in b/test_common.in index 67f7cc1c0..3d9f7d845 100644 --- a/test_common.in +++ b/test_common.in @@ -5,9 +5,14 @@ # See netcdf-c/COPYRIGHT file for more info. +# Define location of execution TOPSRCDIR='@abs_top_srcdir@' TOPBUILDDIR='@abs_top_builddir@' +# Define selected features of the build +FEATURE_HDF5=@HAS_HDF5@ +FEATURE_S3TESTS=@DO_S3_TESTS@ + set -e # Figure out various locations in the src/build tree.