diff --git a/libnczarr/zattr.c b/libnczarr/zattr.c index 26e4fb9613..c3a658c453 100644 --- a/libnczarr/zattr.c +++ b/libnczarr/zattr.c @@ -1249,7 +1249,6 @@ NCZ_computeattrdata(nc_type typehint, nc_type* typeidp, const NCjson* values, si size_t typelen; nc_type typeid = NC_NAT; NCjson* jtext = NULL; - int reclaimvalues = 0; int isjson = 0; /* 1 => json valued attribute */ int count = 0; /* no. of attribute values */ @@ -1270,16 +1269,16 @@ NCZ_computeattrdata(nc_type typehint, nc_type* typeidp, const NCjson* values, si /* Apply the JSON attribute convention and convert to JSON string */ typeid = NC_CHAR; if((stat = NCZ_json_convention_read(values,&jtext))) goto done; - values = jtext; jtext = NULL; - reclaimvalues = 1; + /* Convert the JSON attribute values to the actual netcdf attribute bytes */ + if((stat = NCZ_attr_convert(jtext,typeid,typelen,&count,buf))) goto done; + } else { + /* Convert the JSON attribute values to the actual netcdf attribute bytes */ + if((stat = NCZ_attr_convert(values,typeid,typelen,&count,buf))) goto done; } if((stat = NC4_inq_atomic_type(typeid, NULL, &typelen))) goto done; - /* Convert the JSON attribute values to the actual netcdf attribute bytes */ - if((stat = NCZ_attr_convert(values,typeid,typelen,&count,buf))) goto done; - if(typelenp) *typelenp = typelen; if(typeidp) *typeidp = typeid; /* return possibly inferred type */ if(countp) *countp = count; @@ -1287,7 +1286,7 @@ NCZ_computeattrdata(nc_type typehint, nc_type* typeidp, const NCjson* values, si done: ncbytesfree(buf); - if(reclaimvalues) NCJreclaim((NCjson*)values); /* we created it */ + NCJreclaim(jtext); /* we created it */ return ZUNTRACEX(THROW(stat),"typelen=%d count=%u",(typelenp?*typelenp:0),(countp?*countp:-1)); } diff --git a/libnczarr/zformat2.c b/libnczarr/zformat2.c index 940d1c9d89..42db78656b 100644 --- a/libnczarr/zformat2.c +++ b/libnczarr/zformat2.c @@ -27,7 +27,7 @@ static int ZF2_codec2hdf(const NC_FILE_INFO_T* file, const NC_VAR_INFO_T* var, c static int write_grp(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_GRP_INFO_T* grp); static int write_var_meta(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_VAR_INFO_T* var); static int write_var(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_VAR_INFO_T* var); -static int build_atts(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_OBJ* container, NCindex* attlist, NCjson**, NCjson**); +static int build_atts(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_OBJ* container, NCindex* attlist, NCjson**); static int read_superblock(NC_FILE_INFO_T* file, int* nczarrvp); static int read_grp(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp); @@ -143,7 +143,6 @@ write_grp(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_GRP_INFO NCjson* jsuper = NULL; NCjson* jtmp = NULL; NCjson* jatts = NULL; - NCjson* jtypes = NULL; ZTRACE(3,"file=%s grp=%s isclose=%d",file->controller->path,grp->hdr.name,isclose); @@ -218,7 +217,7 @@ write_grp(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_GRP_INFO /* Build and write the Z2ATTRS object */ assert(grp->att); - if((stat = build_atts(file,zfile,map,(NC_OBJ*)grp, grp->att,&jatts,&jtypes)))goto done; + if((stat = build_atts(file,zfile,map,(NC_OBJ*)grp, grp->att,&jatts)))goto done; /* write .zattrs path */ if((stat = nczm_concat(fullpath,Z2ATTRS,&key))) goto done; /* Write to map */ @@ -276,7 +275,6 @@ write_var_meta(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_VAR NCjson* jtmp = NULL; NCjson* jfill = NULL; NCjson* jatts = NULL; - NCjson* jtypes = NULL; char* dtypename = NULL; int purezarr = 0; size64_t shape[NC_MAX_VAR_DIMS]; @@ -505,7 +503,7 @@ write_var_meta(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_VAR /* Build and write .zattrs object */ assert(var->att); - if((stat = build_atts(file,zfile,map,(NC_OBJ*)var, var->att,&jatts,&jtypes)))goto done; + if((stat = build_atts(file,zfile,map,(NC_OBJ*)var, var->att,&jatts)))goto done; /* write .zattrs path */ if((stat = nczm_concat(fullpath,Z2ATTRS,&key))) goto done; /* Write to map */ @@ -567,7 +565,7 @@ write_var(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_VAR_INFO * @author Dennis Heimbigner */ static int -build_atts(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_OBJ* container, NCindex* attlist, NCjson** jattsp, NCjson** jtypesp) +build_atts(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_OBJ* container, NCindex* attlist, NCjson** jattsp) { int i,stat = NC_NOERR; NCjson* jatts = NULL; @@ -744,7 +742,7 @@ build_atts(NC_FILE_INFO_T* file, NCZ_FILE_INFO_T* zfile, NCZMAP* map, NC_OBJ* co } if(jattsp) {*jattsp = jatts; jatts = NULL;} - if(jtypesp) {*jtypesp = jtypes; jtypes = NULL;} +// if(jtypesp) {*jtypesp = jtypes; jtypes = NULL;} done: nullfree(fullpath); nullfree(key); diff --git a/libnczarr/zformat3.c b/libnczarr/zformat3.c index f513d60ac6..a9db10d2f6 100644 --- a/libnczarr/zformat3.c +++ b/libnczarr/zformat3.c @@ -825,6 +825,7 @@ ZF3_readmeta(NC_FILE_INFO_T* file) goto done; done: + NCJreclaim(jrootgrp); nullfree(rootkey); nclistfreeall(paths); return ZUNTRACE(THROW(stat)); @@ -865,8 +866,8 @@ ZF3_readattrs(NC_FILE_INFO_T* file, NC_OBJ* container, const NCjson* jatts, cons jkey = NCJdictkey(jatts,i); assert(jkey != NULL && NCJisatomic(jkey)); jvalue = NCJdictvalue(jatts,i); - ainfo[i].name = NCJstring(jkey); - ainfo[i].values = jvalue; + ainfo[i].name = strdup(NCJstring(jkey)); + NCJcheck(NCJclone(jvalue,&ainfo[i].values)); ainfo[i].nctype = NC_NAT; /* not yet known */ } @@ -1056,7 +1057,7 @@ read_grp(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp) /* Pull out lists about groups and vars */ if(purezarr) {if((stat = subobjects_pure(zfile,grp,subvars,subgrps))) goto done;} - else + else if(jnczgrp != NULL) {if((stat = subobjects(zfile,grp,jnczgrp,subvars,subgrps))) goto done;} /* Define vars */ @@ -1770,6 +1771,7 @@ subobjects(NCZ_FILE_INFO_T* zfile, NC_GRP_INFO_T* parent, const NCjson* jnczgrp, const NCjson* jsubgrps = NULL; const NCjson* jarrays = NULL; + assert(jnczgrp != NULL); NCJcheck(NCJdictget(jnczgrp,"arrays",&jarrays)); NCJcheck(NCJdictget(jnczgrp,"subgroups",&jsubgrps)); @@ -2297,16 +2299,20 @@ getnextlevel(NCZ_FILE_INFO_T* zfile, NC_GRP_INFO_T* parent, NClist* varnames, NC const NCjson* jnodetype; if(strcmp(name,Z3OBJECT)==0) {continue;} /* See if name/zarr.json exists */ + nullfree(subkey); subkey = NULL; if((stat = nczm_concat(grpkey,name,&subkey))) goto done; + nullfree(zobject); zobject = NULL; if((stat = nczm_concat(subkey,Z3OBJECT,&zobject))) goto done; switch(stat = nczmap_len(zfile->map,zobject,&zjlen)) { case NC_NOERR: break; case NC_ENOOBJECT: nclistpush(subgrpnames,name); continue; /* assume a virtual group */ default: goto done; } + nullfree(content); content = NULL; if((content = malloc(zjlen))==NULL) {stat = NC_ENOMEM; goto done;} if((stat = nczmap_read(zfile->map,zobject,0,zjlen,content))) goto done; /* read the zarr.json */ /* parse it */ + NCJreclaim(jzarrjson); jzarrjson = NULL; NCJcheck(NCJparsen((size_t)zjlen,(char*)content,0,&jzarrjson)); if(jzarrjson == NULL) {stat = NC_ENOTZARR; goto done;} /* See what the node_type says */ diff --git a/libsrc4/nc4internal.c b/libsrc4/nc4internal.c index d63a1fbcfe..531e3e0b86 100644 --- a/libsrc4/nc4internal.c +++ b/libsrc4/nc4internal.c @@ -795,8 +795,10 @@ nc4_var_set_ndims(NC_VAR_INFO_T *var, int ndims) /* Allocate space for dimension information. */ if (ndims) { + if(var->dim != NULL) free(var->dim); if (!(var->dim = calloc(ndims, sizeof(NC_DIM_INFO_T *)))) return NC_ENOMEM; + if(var->dimids != NULL) free(var->dimids); if (!(var->dimids = calloc(ndims, sizeof(int)))) return NC_ENOMEM; diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am index 34b6fcae91..55f4e53a02 100644 --- a/nczarr_test/Makefile.am +++ b/nczarr_test/Makefile.am @@ -8,14 +8,14 @@ BUILT_SOURCES = EXTRA_DIST = DISTCLEANFILES = TESTS = +check_PROGRAMS = include $(top_srcdir)/nczarr_test/Makefile.files BUILT_SOURCES += ${ALLBUILTSCRIPTS} - # V2 specific files -EXTRA_DIST = CMakeLists.txt Makefile.core Makefile.files ${ALLV2BASELINE} ${ALLV2SCRIPTS} +EXTRA_DIST += CMakeLists.txt Makefile.core Makefile.files ${ALLV2BASELINE} ${ALLV2SCRIPTS} include $(top_srcdir)/nczarr_test/Makefile.core diff --git a/nczarr_test/ref_tst_nans.dmp b/nczarr_test/ref_tst_nans.dmp new file mode 100644 index 0000000000..861db8dda1 --- /dev/null +++ b/nczarr_test/ref_tst_nans.dmp @@ -0,0 +1,16 @@ +netcdf ref_tst_nans { +dimensions: + dim = 3 ; +variables: + float fvar(dim) ; + fvar:_FillValue = NaNf ; + fvar:att = -Infinityf, NaNf, Infinityf ; + double dvar(dim) ; + dvar:_FillValue = NaN ; + dvar:att = -Infinity, NaN, Infinity ; +data: + + fvar = -Infinityf, _, Infinityf ; + + dvar = -Infinity, _, Infinity ; +} diff --git a/nczarr_test/run_nan.sh b/nczarr_test/run_nan.sh index 96dc1ef783..17862b946f 100755 --- a/nczarr_test/run_nan.sh +++ b/nczarr_test/run_nan.sh @@ -19,7 +19,7 @@ set -e # Location constants cdl="$srcdir/../ncdump/cdl" -expected="$srcdir/../ncdump/expected" +expected="$srcdir" # Functions diff --git a/v3_tests/CMakeLists.txt b/v3_tests/CMakeLists.txt new file mode 100644 index 0000000000..6483f46444 --- /dev/null +++ b/v3_tests/CMakeLists.txt @@ -0,0 +1,241 @@ +# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, +# 2015, 2016, 2017, 2018 +# University Corporation for Atmospheric Research/Unidata. + +# See netcdf-c/COPYRIGHT file for more info. + +SET(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR}) + +remove_definitions(-DDLL_EXPORT) + + +# Create nczarr tests from nc_test4 tests +macro(NCZARR_SH_TEST basename src) +FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/../${src}/tst_${basename}.sh SHSOURCE) +# Make sure the order of prepended lines is correct +STRING(PREPEND SHSOURCE "TESTNCZARR=1\n") +STRING(PREPEND SHSOURCE "#!/bin/bash\n") +# Replace with FILE(CONFIGURE) when cmake 3.18 is in common use +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/run_${basename}.1 "${SHSOURCE}") +CONFIGURE_FILE(${CMAKE_CURRENT_BINARY_DIR}/run_${basename}.1 ${CMAKE_CURRENT_BINARY_DIR}/run_${basename}.sh FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE @ONLY NEWLINE_STYLE LF) +FILE(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/run_${basename}.1) +endmacro(NCZARR_SH_TEST) + +macro(NCZARR_C_TEST basename newname src) +FILE(READ ${CMAKE_CURRENT_SOURCE_DIR}/../${src}/${basename}.c CSOURCE) +STRING(PREPEND CSOURCE "#define TESTNCZARR\n") +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${newname}.c "${CSOURCE}") +endmacro(NCZARR_C_TEST) + +NCZARR_C_TEST(tst_quantize test_quantize nc_test4) +NCZARR_C_TEST(tst_filter_vlen test_filter_vlen nc_test4) +NCZARR_C_TEST(tst_unlim_vars test_unlim_vars nc_test4) +NCZARR_C_TEST(tst_h5_endians test_endians nc_test4) +NCZARR_C_TEST(tst_put_vars_two_unlim_dim test_put_vars_two_unlim_dim nc_test4) +NCZARR_C_TEST(tst_chunking test_chunking ncdump) + +NCZARR_SH_TEST(specific_filters nc_test4) +NCZARR_SH_TEST(unknown nc_test4) +NCZARR_SH_TEST(filter_vlen nc_test4) + +# Unlimited tests +NCZARR_SH_TEST(mud ncdump) +NCZARR_SH_TEST(nccopy5 ncdump) + +FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh +${CMAKE_CURRENT_SOURCE_DIR}/ref*.cdl +${CMAKE_CURRENT_SOURCE_DIR}/ref*.txt +${CMAKE_CURRENT_SOURCE_DIR}/ref*.zmap) + +FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE) + +IF(USE_X_GETOPT) +SET(XGETOPTSRC "${CMAKE_CURRENT_SOURCE_DIR}/../libdispatch/XGetopt.c") +ENDIF() + +IF(ENABLE_TESTS) + + add_library(ut_util STATIC ut_util.c ut_test.c ut_includes.h ut_test.h ${XGETOPTSRC}) + IF(ENABLE_DLL) + target_compile_definitions(ut_util PUBLIC -DDLL_EXPORT -DDLL_NETCDF) + ENDIF(ENABLE_DLL) + target_include_directories(ut_util PUBLIC ../libnczarr ../plugins ${CMAKE_CURRENT_LIST_DIR}) + target_link_libraries(ut_util PUBLIC netcdf ${ALL_TLL_LIBS}) + + add_library(test_utils STATIC test_utils.c test_utils.h ${XGETOPTSRC}) + IF(ENABLE_DLL) + target_compile_definitions(test_utils PUBLIC -DDLL_EXPORT -DDLL_NETCDF) + ENDIF(ENABLE_DLL) + target_include_directories(test_utils PUBLIC ../libnczarr ../plugins ${CMAKE_CURRENT_LIST_DIR}) + target_link_libraries(test_utils PUBLIC netcdf ${ALL_TLL_LIBS}) + + set_target_properties(ut_util test_utils PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR} + RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR} + ) + + macro(build_bin_test_with_util_lib F UTIL_LIB) + build_bin_test(${F}) + IF(ENABLE_DLL) + target_compile_definitions(${F} PUBLIC -DDLL_NETCDF) + ENDIF(ENABLE_DLL) + target_link_libraries(${F} ${UTIL_LIB} ${ALL_TLL_LIBS}) + endmacro() + + macro(add_bin_test_with_util_lib PREFIX F UTIL_LIB) + add_bin_test(${PREFIX} ${F}) + IF(ENABLE_DLL) + target_compile_definitions(${PREFIX}_${F} PUBLIC -DDLL_NETCDF) + ENDIF(ENABLE_DLL) + target_link_libraries(${PREFIX}_${F} ${UTIL_LIB} ${ALL_TLL_LIBS}) + + endmacro() + + # Base tests + # The tests are set up as a combination of shell scripts and executables that + # must be run in a particular order. It is painful but will use macros to help + # keep it from being too bad. + + build_bin_test_with_util_lib(ut_map ut_util) + build_bin_test_with_util_lib(ut_mapapi ut_util) + build_bin_test_with_util_lib(ut_json ut_util) + + build_bin_test_with_util_lib(test_fillonlyz test_utils) + build_bin_test_with_util_lib(test_quantize test_utils) + build_bin_test_with_util_lib(test_notzarr test_utils) + +# ADD_BIN_TEST(nczarr_test test_endians ${TSTCOMMONSRC}) + + # Unlimited Tests + IF(USE_HDF5) + add_bin_test_with_util_lib(nczarr_test test_unlim_vars test_utils) + add_bin_test_with_util_lib(nczarr_test test_put_vars_two_unlim_dim test_utils) + build_bin_test_with_util_lib(test_zchunks ut_util) + build_bin_test_with_util_lib(test_zchunks2 ut_util) + build_bin_test_with_util_lib(test_zchunks3 ut_util) + build_bin_test_with_util_lib(test_unlim_io test_utils) + build_bin_test_with_util_lib(test_chunking test_utils) + ADD_SH_TEST(nczarr_test run_nccopyz) + ADD_SH_TEST(nczarr_test run_unlim_io) + ADD_SH_TEST(nczarr_test run_nccopy5) + ADD_SH_TEST(nczarr_test run_mud) + ENDIF() + + IF(FALSE) # Obsolete tests + BUILD_BIN_TEST(ut_projections ${COMMONSRC}) + BUILD_BIN_TEST(ut_chunking ${COMMONSRC}) + BUILD_BIN_TEST(ut_walk ${COMMONSRC}) + ENDIF() + + # Helper programs for testing + BUILD_BIN_TEST(zhex) + build_bin_test_with_util_lib(zisjson ut_util) + TARGET_INCLUDE_DIRECTORIES(zisjson PUBLIC ../libnczarr) + build_bin_test_with_util_lib(zs3parse ut_util) + TARGET_INCLUDE_DIRECTORIES(zs3parse PUBLIC ../libnczarr) + build_bin_test_with_util_lib(zmapio ut_util) + + IF(ENABLE_S3 AND NOT WITH_S3_TESTING STREQUAL "NO") + # Helper programs for testing + BUILD_BIN_TEST(s3util ${COMMONSRC}) + # Pure AWS Test + IF(ENABLE_S3_AWS) + SET(TMP_CMAKE_CXX_STANDARD ${MAKE_CXX_STANDARD}) + SET(CMAKE_CXX_STANDARD 11) + ADD_EXECUTABLE(tst_pure_awssdk tst_pure_awssdk.cpp) + TARGET_LINK_LIBRARIES(tst_pure_awssdk ${AWSSDK_CORE_LIB_FILE}) + ADD_TEST(tst_pure_awssdk ${EXECUTABLE_PUTPUT_PATH}/tst_pure_awssdk) + SET(F tst_pure_awssdk) + IF(MSVC) + SET_PROPERTY(TEST ${F} PROPERTY FOLDER "tests/") + SET_TARGET_PROPERTIES(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY + ${CMAKE_CURRENT_BINARY_DIR}) + SET_TARGET_PROPERTIES(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG + ${CMAKE_CURRENT_BINARY_DIR}) + SET_TARGET_PROPERTIES(${F} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE + ${CMAKE_CURRENT_BINARY_DIR}) + ENDIF(MSVC) + + SET(CMAKE_CXX_STANDARD ${TMP_CMAKE_CXX_STANDARD}) + ENDIF(ENABLE_S3_AWS) + TARGET_INCLUDE_DIRECTORIES(s3util PUBLIC ../libnczarr) + endif() + + if(ENABLE_NCDUMPCHUNKS) + build_bin_test_with_util_lib(ncdumpchunks ut_util) + endif() + + IF(BUILD_UTILITIES) + 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_ncgen4) + if(LARGE_FILE_TESTS) + BUILD_BIN_TEST(test_readcaching) + BUILD_BIN_TEST(test_writecaching) + BUILD_BIN_TEST(test_chunkcases ${TSTCOMMONSRC}) + add_sh_test(nczarr_test run_cachetest) + add_sh_test(nczarr_test run_chunkcases) + ENDIF() + + add_sh_test(nczarr_test run_purezarr) + add_sh_test(nczarr_test run_misc) + add_sh_test(nczarr_test run_nczarr_fill) + add_sh_test(nczarr_test run_jsonconvention) + add_sh_test(nczarr_test run_strings) + add_sh_test(nczarr_test run_scalar) + add_sh_test(nczarr_test run_nulls) + add_sh_test(nczarr_test run_external) + add_sh_test(nczarr_test run_quantize) + add_sh_test(nczarr_test run_notzarr) + + # This has timeout under CMake +# if(NOT ISCMAKE) + add_sh_test(nczarr_test run_interop) +# ENDIF() + + IF(USE_HDF5) + add_sh_test(nczarr_test run_fillonlyz) + ENDIF() + + IF(ENABLE_NCZARR_FILTERS) + IF(ENABLE_FILTER_TESTING) + build_bin_test(test_nczfilter) + build_bin_test(test_filter_vlen) + build_bin_test(testfilter) + build_bin_test_with_util_lib(testfilter_misc test_utils) + build_bin_test(testfilter_multi) + build_bin_test(testfilter_order) + build_bin_test(testfilter_repeat) + ADD_SH_TEST(nczarr_test run_nczfilter) + ADD_SH_TEST(nczarr_test run_filter) + ADD_SH_TEST(nczarr_test run_specific_filters) + ADD_SH_TEST(nczarr_test run_filter_vlen) + IF(FALSE) + # This test is too dangerous to run in a parallel make environment. + # It causes race conditions. So suppress and only test by hand. + ADD_SH_TEST(nczarr_test run_unknown) + ENDIF(FALSE) + ENDIF(ENABLE_FILTER_TESTING) + ENDIF(ENABLE_NCZARR_FILTERS) + + if(ENABLE_NCZARR_ZIP) + add_sh_test(nczarr_test run_newformat) + # Test various corrupted files + ADD_SH_TEST(nczarr_test run_corrupt.sh) + endif() + + IF(FALSE) # Obsolete tests + add_sh_test(nczarr_test run_ut_chunk) + ENDIF() + + ENDIF(BUILD_UTILITIES) + +ENDIF(ENABLE_TESTS) + +## 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 ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl) +SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am zmapio.c zhex.c ncdumpchunks.c) +ADD_EXTRA_DIST("${CUR_EXTRA_DIST}") diff --git a/v3_tests/Makefile.am b/v3_tests/Makefile.am index 079c971397..d2e41696aa 100644 --- a/v3_tests/Makefile.am +++ b/v3_tests/Makefile.am @@ -8,6 +8,7 @@ BUILT_SOURCES = EXTRA_DIST = DISTCLEANFILES = TESTS = +check_PROGRAMS = # Following files are V3 specific versions V3FILES = ${ALLV3BASELINE} ${ALLV3SCRIPTS} @@ -26,7 +27,7 @@ DISTCLEANFILES += ${FILES} ${ALLBUILTSRC} ${ALLBUILTSCRIPTS} BUILT_SOURCES += ${FILES} ${FILES}: - for u in $@ ; do cp -f ${top_srcdir}/nczarr_test/$$u $(srcdir) ; done + for u in $@ ; do cp -f ${top_srcdir}/nczarr_test/$$u $(top_srcdir)/v3_tests ; done # If valgrind is present, add valgrind targets. @VALGRIND_CHECK_RULES@ diff --git a/v3_tests/run_nan.sh b/v3_tests/run_nan.sh index 2f7bddfa6d..17862b946f 100755 --- a/v3_tests/run_nan.sh +++ b/v3_tests/run_nan.sh @@ -23,6 +23,13 @@ expected="$srcdir" # Functions +# Remove fillvalue attribute since zarr generates it when hdf5 does not +fvclean() { + cat $1 \ + | sed -e '/:_FillValue/d' \ + | cat > $2 +} + difftest() { echo ""; echo "*** Test zext=$zext" for t in tst_nans ; do