diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2015-09-14 20:22:39 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2015-09-14 20:22:39 (GMT) |
commit | 81e4ce7805a034e7684f48a208621180cc168921 (patch) | |
tree | c6f3187d6a49a314674d642eabda0554386c90b9 /test | |
parent | c3649ea51764b1e7d2b82ca3d5a2ba4053f34a6d (diff) | |
parent | b2f94f9faf805035e4d0e9cb76007204c8250e58 (diff) | |
download | hdf5-81e4ce7805a034e7684f48a208621180cc168921.zip hdf5-81e4ce7805a034e7684f48a208621180cc168921.tar.gz hdf5-81e4ce7805a034e7684f48a208621180cc168921.tar.bz2 |
[svn-r27777] merge from trunk.
Diffstat (limited to 'test')
61 files changed, 1035 insertions, 753 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 29d0ac5..b35ce10 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -58,6 +58,12 @@ if (BUILD_SHARED_LIBS) INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) + if (HDF5_ENABLE_THREADSAFE) + set_property (TARGET ${HDF5_TEST_LIBSH_TARGET} + APPEND PROPERTY COMPILE_DEFINITIONS + "H5_HAVE_THREADSAFE" + ) + endif (HDF5_ENABLE_THREADSAFE) endif (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- @@ -103,7 +109,7 @@ endif (BUILD_SHARED_LIBS) TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different + ARGS -E copy_if_different "$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>" "${CMAKE_BINARY_DIR}/testdir1/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>" ) @@ -134,7 +140,7 @@ endif (BUILD_SHARED_LIBS) TARGET ${HDF5_TEST_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different + ARGS -E copy_if_different "$<TARGET_FILE:${HDF5_TEST_PLUGIN_LIB_TARGET}>" "${CMAKE_BINARY_DIR}/testdir2/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_LIB_TARGET}>" ) @@ -249,7 +255,7 @@ set (H5_TESTS #cache_api #cache_tagging pool - hyperslab + #hyperslab istore bittests dt_arith @@ -349,6 +355,26 @@ if (BUILD_SHARED_LIBS) set_target_properties (cache_tagging-shared PROPERTIES FOLDER test) endif (BUILD_SHARED_LIBS) +#-- Adding test for hyperslab +add_executable (hyperslab ${HDF5_TEST_SOURCE_DIR}/hyperslab.c) +TARGET_NAMING (hyperslab STATIC) +TARGET_C_PROPERTIES (hyperslab STATIC " " " ") +target_link_libraries (hyperslab ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +set_target_properties (hyperslab PROPERTIES FOLDER test) +if (BUILD_SHARED_LIBS) + add_executable (hyperslab-shared ${HDF5_TEST_SOURCE_DIR}/hyperslab.c) + TARGET_NAMING (hyperslab-shared SHARED) + TARGET_C_PROPERTIES (hyperslab-shared SHARED " " " ") + target_link_libraries (hyperslab-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (hyperslab-shared PROPERTIES FOLDER test) + if (HDF5_ENABLE_THREADSAFE) + set_property (TARGET hyperslab-shared + APPEND PROPERTY COMPILE_DEFINITIONS + "H5_HAVE_THREADSAFE" + ) + endif (HDF5_ENABLE_THREADSAFE) +endif (BUILD_SHARED_LIBS) + #-- Adding test for ttsafe add_executable (ttsafe ${HDF5_TEST_SOURCE_DIR}/ttsafe.c @@ -373,6 +399,12 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (ttsafe-shared SHARED " " " ") target_link_libraries (ttsafe-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (ttsafe-shared PROPERTIES FOLDER test) + if (HDF5_ENABLE_THREADSAFE) + set_property (TARGET ttsafe-shared + APPEND PROPERTY COMPILE_DEFINITIONS + "H5_HAVE_THREADSAFE" + ) + endif (HDF5_ENABLE_THREADSAFE) endif (BUILD_SHARED_LIBS) #-- Adding test for err_compat @@ -421,7 +453,7 @@ endif (BUILD_SHARED_LIBS) #-- Adding test for libinfo set (GREP_RUNNER ${PROJECT_BINARY_DIR}/GrepRunner.cmake) -file (WRITE ${GREP_RUNNER} +file (WRITE ${GREP_RUNNER} "file (STRINGS \${TEST_PROGRAM} TEST_RESULT REGEX \"SUMMARY OF THE HDF5 CONFIGURATION\") if (\${TEST_RESULT} STREQUAL \"0\") message (FATAL_ERROR \"Failed: The output: \${TEST_RESULT} of \${TEST_PROGRAM} did not contain SUMMARY OF THE HDF5 CONFIGURATION\") diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 5fe51ed..10f4ccf 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -451,6 +451,7 @@ set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-testmeta PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800) +set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT 2400) if (BUILD_SHARED_LIBS) # Remove any output file left over from previous test run @@ -541,6 +542,7 @@ if (BUILD_SHARED_LIBS) set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-testmeta PROPERTIES TIMEOUT 1800) set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800) + set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT 2400) endif (BUILD_SHARED_LIBS) ############################################################################## @@ -562,9 +564,10 @@ if (NOT CYGWIN) add_test (NAME H5TEST-cache COMMAND $<TARGET_FILE:cache>) set_tests_properties (H5TEST-cache PROPERTIES DEPENDS H5TEST-clear-cache-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=2" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) + set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT 2400) endif (NOT CYGWIN) #-- Adding test for cache_api @@ -725,9 +728,10 @@ if (BUILD_SHARED_LIBS) add_test (NAME H5TEST-shared-cache COMMAND $<TARGET_FILE:cache-shared>) set_tests_properties (H5TEST-shared-cache PROPERTIES DEPENDS H5TEST-shared-clear-cache-objects - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=2" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) + set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT 2400) endif (NOT CYGWIN) #-- Adding test for cache_api @@ -1052,7 +1056,7 @@ if (HDF5_TEST_VFD) -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=2" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) @@ -1068,7 +1072,7 @@ if (HDF5_TEST_VFD) -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=2" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) endif (BUILD_SHARED_LIBS) @@ -1136,7 +1140,7 @@ if (HDF5_TEST_VFD) ) set_tests_properties (VFD-${vfdname}-fheap PROPERTIES TIMEOUT 1800 - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=2" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) if (BUILD_SHARED_LIBS) @@ -1153,7 +1157,7 @@ if (HDF5_TEST_VFD) ) set_tests_properties (VFD-${vfdname}-fheap-shared PROPERTIES TIMEOUT 1800 - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=2" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared ) endif (BUILD_SHARED_LIBS) diff --git a/test/H5srcdir.h b/test/H5srcdir.h index 4f0f439..81624d8 100644 --- a/test/H5srcdir.h +++ b/test/H5srcdir.h @@ -32,11 +32,7 @@ static char srcdir_path[1024] = ""; static char srcdir_testpath[1024] = ""; /* Append the test file name to the srcdir path and return the whole string */ -#ifdef H5_VMS -static const char *H5_get_srcdir_filename(char *filename) -#else static const char *H5_get_srcdir_filename(const char *filename) -#endif { const char *srcdir = HDgetenv("srcdir"); @@ -46,19 +42,7 @@ static const char *H5_get_srcdir_filename(const char *filename) /* Build path to test file */ if((HDstrlen(srcdir) + HDstrlen(filename) + 2) < sizeof(srcdir_testpath)) { -#ifdef H5_VMS - HDstrcpy(srcdir_testpath, srcdir); - if(filename[0] == '[') { - char *tmp = filename; - - srcdir_testpath[HDstrlen(srcdir) - 1] = '\0'; - HDstrcat(srcdir_testpath, ++tmp); - } /* end if */ - else - HDstrcat(srcdir_testpath, filename); -#else HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s/%s", srcdir, filename); -#endif return(srcdir_testpath); } /* end if */ else diff --git a/test/Makefile.in b/test/Makefile.in index 027d96a..0b6b803 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -122,7 +122,8 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aclocal_cxx.m4 \ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/src/H5config.h +CONFIG_HEADER = $(top_builddir)/src/H5config.h \ + $(top_builddir)/fortran/src/H5config_f.inc CONFIG_CLEAN_FILES = testcheck_version.sh testerror.sh H5srcdir_str.h \ testlibinfo.sh testlinks_env.sh test_plugin.sh \ test_vol_plugin.sh @@ -557,7 +558,7 @@ AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src -I$(top_builddir)/fortran/src depcomp = $(SHELL) $(top_srcdir)/bin/depcomp am__depfiles_maybe = depfiles am__mv = mv -f @@ -880,14 +881,22 @@ F9XMODEXT = @F9XMODEXT@ F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ -FC2003 = @FC2003@ FCFLAGS = @FCFLAGS@ FCFLAGS_f90 = @FCFLAGS_f90@ FCLIBS = @FCLIBS@ FC_VERSION = @FC_VERSION@ FGREP = @FGREP@ +FORTRAN_C_LONG_DOUBLE_IS_UNIQUE = @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ +FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ +FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ +Fortran_COMPILER_ID = @Fortran_COMPILER_ID@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ @@ -897,13 +906,12 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ -HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@ +HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ HDF_CXX = @HDF_CXX@ HDF_FORTRAN = @HDF_FORTRAN@ -HDF_FORTRAN2003 = @HDF_FORTRAN2003@ HID_T = @HID_T@ HL = @HL@ HL_FOR = @HL_FOR@ @@ -945,9 +953,20 @@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PAC_C_MAX_REAL_PRECISION = @PAC_C_MAX_REAL_PRECISION@ +PAC_FC_ALL_INTEGER_KINDS = @PAC_FC_ALL_INTEGER_KINDS@ +PAC_FC_ALL_INTEGER_KINDS_SIZEOF = @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@ +PAC_FC_ALL_REAL_KINDS = @PAC_FC_ALL_REAL_KINDS@ +PAC_FC_ALL_REAL_KINDS_SIZEOF = @PAC_FC_ALL_REAL_KINDS_SIZEOF@ +PAC_FC_MAX_REAL_PRECISION = @PAC_FC_MAX_REAL_PRECISION@ +PAC_FORTRAN_NATIVE_DOUBLE_KIND = @PAC_FORTRAN_NATIVE_DOUBLE_KIND@ +PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF = @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@ +PAC_FORTRAN_NATIVE_INTEGER_KIND = @PAC_FORTRAN_NATIVE_INTEGER_KIND@ +PAC_FORTRAN_NATIVE_INTEGER_SIZEOF = @PAC_FORTRAN_NATIVE_INTEGER_SIZEOF@ +PAC_FORTRAN_NATIVE_REAL_KIND = @PAC_FORTRAN_NATIVE_REAL_KIND@ +PAC_FORTRAN_NATIVE_REAL_SIZEOF = @PAC_FORTRAN_NATIVE_REAL_SIZEOF@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ RANLIB = @RANLIB@ ROOT = @ROOT@ RUNPARALLEL = @RUNPARALLEL@ diff --git a/test/accum.c b/test/accum.c index b76f92f..6561a8a 100644 --- a/test/accum.c +++ b/test/accum.c @@ -17,7 +17,7 @@ */ #include "h5test.h" -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" #include "H5FDprivate.h" #include "H5Iprivate.h" diff --git a/test/app_ref.c b/test/app_ref.c index 3052df7..4b72bcb 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -185,6 +185,10 @@ main (void) PASSED(); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + + /* Clean up any file(s) created */ h5_reset(); fapl = H5Pcreate (H5P_FILE_ACCESS); h5_cleanup (FILENAME, fapl); @@ -618,7 +618,7 @@ test_sec2(hid_t fapl) quit: /* End with normal return code */ /* Clean up the test file */ - if(h5_cleanup(FILENAME, fapl)) + if(h5_clean_files(FILENAME, fapl)) HDremove(DNAME); return 0; @@ -655,7 +655,7 @@ test_stdio(hid_t fapl) quit: /* End with normal return code */ /* Clean up the test file */ - if(h5_cleanup(FILENAME, fapl)) + if(h5_clean_files(FILENAME, fapl)) HDremove(DNAME); HDfflush(stdout); return 0; @@ -716,7 +716,7 @@ test_family(hid_t fapl) quit: /* End with normal return code */ /* Clean up the test file */ - if(h5_cleanup(FILENAME, fapl)) + if(h5_clean_files(FILENAME, fapl)) HDremove(DNAME); return 0; diff --git a/test/bittests.c b/test/bittests.c index c527bb8..c4dfe4c 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -21,7 +21,7 @@ */ #include "h5test.h" -#define H5T_PACKAGE +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" #define NTESTS 100000 diff --git a/test/btree2.c b/test/btree2.c index 0fad793..0934ad6 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -22,7 +22,7 @@ * This file needs to access private datatypes from the H5B2 package. * This file also needs to access the v2 B-tree testing code. */ -#define H5B2_PACKAGE +#define H5B2_FRIEND /*suppress error about including H5B2pkg */ #define H5B2_TESTING #include "H5B2pkg.h" @@ -30,7 +30,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ diff --git a/test/cache_common.c b/test/cache_common.c index b87b736..33fa466 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3061,7 +3061,7 @@ setup_cache(size_t max_cache_size, if ( pass ) { /* allocate space for test entries */ - actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, + actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); if ( actual_base_addr == HADDR_UNDEF ) { @@ -3171,7 +3171,7 @@ takedown_cache(H5F_t * file_ptr, HDassert ( file_ptr ); } - H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DEFAULT, saved_actual_base_addr, + H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, saved_actual_base_addr, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); saved_actual_base_addr = HADDR_UNDEF; } diff --git a/test/cache_common.h b/test/cache_common.h index 737c53f..9e8c5ba 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -22,8 +22,8 @@ #ifndef _CACHE_COMMON_H #define _CACHE_COMMON_H -#define H5C_PACKAGE /*suppress error about including H5Cpkg */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5C_FRIEND /*suppress error about including H5Cpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ /* Include library header files */ #include "H5ACprivate.h" diff --git a/test/cache_tagging.c b/test/cache_tagging.c index bc44f23..34c391f 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -1113,6 +1113,7 @@ check_dense_attribute_tags(void) /* Create dataset */ if ( (did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* get dataset object header */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -2025,6 +2026,7 @@ check_dataset_creation_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* =================================== */ /* Verification of Metadata Tag Values */ @@ -2159,6 +2161,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) if ( (sid = H5Screate_simple(2, dims1, maxdims)) < 0 ) TEST_ERROR; if (( did = H5Dcreate2(fid, DATASETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* =================================== */ /* Verification of Metadata Tag Values */ @@ -2287,6 +2290,7 @@ check_dataset_open_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -2419,6 +2423,7 @@ check_dataset_write_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -2709,6 +2714,7 @@ check_dataset_read_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -2847,6 +2853,7 @@ check_dataset_size_retrieval(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -2986,6 +2993,7 @@ check_dataset_extend_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -3367,6 +3375,7 @@ check_link_removal_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; @@ -3526,6 +3535,7 @@ check_link_getname_tags(hid_t fcpl, int type) /* Create Dataset */ if (( did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; + if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; /* Retrieve tag associated with this dataset */ if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 5c591f8..22bf3a2 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -21,7 +21,7 @@ /* See H5private.h for how to include headers */ #undef NDEBUG -#define H5T_PACKAGE +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" /*to turn off hardware conversions*/ #include "H5Iprivate.h" diff --git a/test/dsets.c b/test/dsets.c index e6b2ee4..4d20023 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -26,7 +26,7 @@ /* * This file needs to access private information from the H5Z package. */ -#define H5Z_PACKAGE +#define H5Z_FRIEND #include "h5test.h" @@ -7567,7 +7567,7 @@ test_chunk_expand(hid_t fapl) if(TRUE != H5Zfilter_avail(H5Z_FILTER_EXPAND)) FAIL_STACK_ERROR /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR diff --git a/test/dt_arith.c b/test/dt_arith.c index b3f5cad..102f217 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -45,7 +45,7 @@ /* Alignment test stuff */ #ifdef TEST_ALIGNMENT -#define H5T_PACKAGE +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" #endif #define SET_ALIGNMENT(TYPE,VAL) \ @@ -58,10 +58,9 @@ const char *FILENAME[] = { }; /* - * Count up or down depending on whether the machine is big endian, little - * endian, or VAX (OpenVMS). If local variable `endian' is H5T_ORDER_BE then - * the result will be I, otherwise the result will be Z-(I+1). VAX is printed - * as little endian. + * Count up or down depending on whether the machine is big endian or little + * endian. If local variable `endian' is H5T_ORDER_BE then the result will + * be I, otherwise the result will be Z-(I+1). */ #define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1)) @@ -88,11 +87,6 @@ static int skip_overflow_tests_g = 0; #define HANDLE_SIGFPE #endif -/* OpenVMS doesn't have this feature. Make sure to disable it*/ -#ifdef H5_VMS -#undef HANDLE_SIGFPE -#endif - /* * Decide what values of floating-point number we want to test. They are * 1 - normalized; 2 - denormalized; 3 - special. @@ -651,11 +645,18 @@ test_hard_query(void) } PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 1; } @@ -877,7 +878,11 @@ error: if(saved_buf2) HDfree(saved_buf2); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_this_test, 1); } @@ -1296,6 +1301,10 @@ test_derived_flt(void) } /* end if */ PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ return 0; @@ -1311,7 +1320,12 @@ test_derived_flt(void) H5Pclose (dxpl_id); H5Fclose (file); } H5E_END_TRY; + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_this_test, 1); } @@ -1598,6 +1612,10 @@ test_derived_integer(void) HDfree(saved_buf); PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ return 0; @@ -1612,7 +1630,12 @@ test_derived_integer(void) H5Pclose (dxpl_id); H5Fclose (file); } H5E_END_TRY; + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_this_test, 1); } @@ -2607,7 +2630,12 @@ done: if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return (int)fails_all_tests; error: @@ -2615,7 +2643,12 @@ error: if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ + return MAX((int)fails_all_tests, 1); } @@ -2740,24 +2773,6 @@ my_isnan(dtype_t type, void *val) retval = 1; } -#ifdef H5_VMS - /* For "float" and "double" on OpenVMS/Alpha, NaN is - * actually a valid value of maximal value.*/ - if(!retval) { - if (FLT_FLOAT==type) { - float x; - HDmemcpy(&x, val, sizeof(float)); - retval = (x==FLT_MAX || x==-FLT_MAX); - } else if (FLT_DOUBLE==type) { - double x; - HDmemcpy(&x, val, sizeof(double)); - retval = (x==DBL_MAX || x==-DBL_MAX); - } else { - return 0; - } - } -#endif /*H5_VMS*/ - return retval; } @@ -2786,23 +2801,8 @@ my_isinf(int endian, unsigned char *val, size_t size, bits = (unsigned char*)HDcalloc((size_t)1, size); -#ifdef H5_VMS - if(H5T_ORDER_VAX==endian) { - for (i = 0; i < size; i += 4) { - bits[i] = val[(size-2)-i]; - bits[i+1] = val[(size-1)-i]; - - bits[(size-2)-i] = val[i]; - bits[(size-1)-i] = val[i+1]; - } - } else { - for (i=0; i<size; i++) - bits[size-(i+1)] = *(val + ENDIAN(size,i,endian)); - } -#else /*H5_VMS*/ for (i=0; i<size; i++) bits[size-(i+1)] = *(val + ENDIAN(size, i, endian)); -#endif /*H5_VMS*/ if(H5T__bit_find(bits, mpos, msize, H5T_BIT_LSB, 1) < 0 && H5T__bit_find(bits, epos, esize, H5T_BIT_LSB, 0) < 0) @@ -2860,9 +2860,6 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) unsigned char *hw=NULL; /*ptr to hardware-conv'd*/ int underflow; /*underflow occurred */ int overflow; /*overflow occurred */ -#ifdef H5_VMS - int maximal; /*maximal value occurred, for VMS only. */ -#endif /* H5_VMS */ int uflow=0; /*underflow debug counters*/ size_t j, k; /*counters */ int sendian; /* source type endianess */ @@ -2913,9 +2910,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) * The remainder of this function is executed only by the child if * HANDLE_SIGFPE is defined. */ -#ifndef H5_VMS HDsignal(SIGFPE,fpe_handler); -#endif /* What are the names of the source and destination types */ if (H5Tequal(src, H5T_NATIVE_FLOAT)) { @@ -3013,47 +3008,19 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) switch (run_test) { case TEST_NOOP: case TEST_NORMAL: -#ifdef H5_VMS if(src_type == FLT_FLOAT) { INIT_FP_NORM(float, FLT_MAX, FLT_MIN, FLT_MAX_10_EXP, FLT_MIN_10_EXP, src_size, dst_size, buf, saved, nelmts); - } else if(src_type == FLT_DOUBLE && dst_type == FLT_FLOAT) { - /*Temporary solution for VMS. Cap double values between maximal and minimal - *destination values because VMS return exception when overflows or underflows. - *Same below.*/ - INIT_FP_NORM(double, FLT_MAX, FLT_MIN, FLT_MAX_10_EXP, FLT_MIN_10_EXP, - src_size, dst_size, buf, saved, nelmts); } else if(src_type == FLT_DOUBLE) { INIT_FP_NORM(double, DBL_MAX, DBL_MIN, DBL_MAX_10_EXP, DBL_MIN_10_EXP, src_size, dst_size, buf, saved, nelmts); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 - } else if(src_type == FLT_LDOUBLE && dst_type == FLT_FLOAT) { - INIT_FP_NORM(long double, FLT_MAX, FLT_MIN, FLT_MAX_10_EXP, FLT_MIN_10_EXP, - src_size, dst_size, buf, saved, nelmts); - } else if(src_type == FLT_LDOUBLE && dst_type == FLT_DOUBLE) { - INIT_FP_NORM(long double, DBL_MAX, DBL_MIN, DBL_MAX_10_EXP, DBL_MIN_10_EXP, - src_size, dst_size, buf, saved, nelmts); } else if(src_type == FLT_LDOUBLE) { INIT_FP_NORM(long double, LDBL_MAX, LDBL_MIN, LDBL_MAX_10_EXP, LDBL_MIN_10_EXP, src_size, dst_size, buf, saved, nelmts); #endif } else goto error; -#else /*H5_VMS*/ - if(src_type == FLT_FLOAT) { - INIT_FP_NORM(float, FLT_MAX, FLT_MIN, FLT_MAX_10_EXP, FLT_MIN_10_EXP, - src_size, dst_size, buf, saved, nelmts); - } else if(src_type == FLT_DOUBLE) { - INIT_FP_NORM(double, DBL_MAX, DBL_MIN, DBL_MAX_10_EXP, DBL_MIN_10_EXP, - src_size, dst_size, buf, saved, nelmts); -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 - } else if(src_type == FLT_LDOUBLE) { - INIT_FP_NORM(long double, LDBL_MAX, LDBL_MIN, LDBL_MAX_10_EXP, LDBL_MIN_10_EXP, - src_size, dst_size, buf, saved, nelmts); -#endif - } else - goto error; -#endif /*H5_VMS*/ break; case TEST_DENORM: @@ -3129,9 +3096,6 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) hw = (unsigned char*)&hw_f; underflow = HDfabs(*((double*)aligned)) < FLT_MIN; overflow = HDfabs(*((double*)aligned)) > FLT_MAX; -#ifdef H5_VMS - maximal = HDfabs(*((double*)aligned)) == FLT_MAX; -#endif } else if (FLT_DOUBLE==dst_type) { hw_d = *((double*)aligned); hw = (unsigned char*)&hw_d; @@ -3149,17 +3113,11 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) hw = (unsigned char*)&hw_f; underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN; overflow = HDfabsl(*((long double*)aligned)) > FLT_MAX; -#ifdef H5_VMS - maximal = HDfabs(*((long double*)aligned)) == FLT_MAX; -#endif } else if (FLT_DOUBLE==dst_type) { hw_d = *((long double*)aligned); hw = (unsigned char*)&hw_d; underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN; overflow = HDfabsl(*((long double*)aligned)) > DBL_MAX; -#ifdef H5_VMS - maximal = HDfabs(*((long double*)aligned)) == DBL_MAX; -#endif } else { hw_ld = *((long double*)aligned); hw = (unsigned char*)&hw_ld; @@ -3194,17 +3152,6 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) if (k==dst_size) continue; /*no error*/ -#ifdef H5_VMS - /* For "float" and "double" on OpenVMS/Alpha, NaN is - * a valid value of maximal value.*/ - if (FLT_FLOAT==src_type && - my_isnan(src_type, saved+j*sizeof(float))) { - continue; - } else if (FLT_DOUBLE==src_type && - my_isnan(src_type, saved+j*sizeof(double))) { - continue; - } -#endif /*H5_VMS*/ /* * Assume same if both results are NaN. There are many NaN bit @@ -3262,11 +3209,6 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) if (overflow && my_isinf(dendian, buf+j*sizeof(float), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) continue; /* all overflowed, no error */ -#ifdef H5_VMS - if (maximal && my_isinf(dendian, buf+j*sizeof(float), - dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) - continue; /* maximal value, no error */ -#endif /*H5_VMS*/ check_mant[0] = HDfrexpf(x, check_expo+0); check_mant[1] = HDfrexpf(hw_f, check_expo+1); } else if (FLT_DOUBLE==dst_type) { @@ -3278,11 +3220,6 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) if (overflow && my_isinf(dendian, buf+j*sizeof(double), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) continue; /* all overflowed, no error */ -#ifdef H5_VMS - if (maximal && my_isinf(dendian, buf+j*sizeof(double), - dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) - continue; /* maximal value, no error */ -#endif /*H5_VMS*/ check_mant[0] = HDfrexp(x, check_expo+0); check_mant[1] = HDfrexp(hw_d, check_expo+1); #if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE) @@ -3409,6 +3346,9 @@ done: HDassert(0 && "Should not reach this point!"); return 1; #else + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /* If the source is normalized values, treat the failures as error; @@ -3432,7 +3372,11 @@ error: HDassert(0 && "Should not reach this point!"); return 1; #else + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + if(run_test==TEST_NOOP || run_test==TEST_NORMAL) return MAX((int)fails_all_tests, 1); else if(run_test==TEST_DENORM || run_test==TEST_SPECIAL) @@ -4606,6 +4550,9 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ /* If the source is normalized floating values, treat the failures as error; @@ -4620,6 +4567,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) if (saved) aligned_free(saved); if (aligned) HDfree(aligned); HDfflush(stdout); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /*print statistics*/ if(run_test==TEST_NORMAL) @@ -4924,7 +4875,6 @@ run_fp_tests(const char *name) nerrors += test_conv_flt_1(name, TEST_NORMAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); #endif -#ifndef H5_VMS /*Test denormalized values. TEST_DENORM indicates denormalized values.*/ nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE); nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_DOUBLE, H5T_NATIVE_FLOAT); @@ -4944,7 +4894,6 @@ run_fp_tests(const char *name) nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT); nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); #endif -#endif /*H5_VMS*/ done: return nerrors; @@ -5085,11 +5034,7 @@ run_fp_int_conv(const char *name) int nerrors = 0; int test_values; -#ifdef H5_VMS - test_values = TEST_NORMAL; -#else for(test_values = TEST_NORMAL; test_values <= TEST_SPECIAL; test_values++) { -#endif /*H5_VMS*/ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_SCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR); @@ -5194,9 +5139,7 @@ run_fp_int_conv(const char *name) #endif /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ #endif #endif -#ifndef H5_VMS } /* end for */ -#endif /* H5_VMS */ return nerrors; } @@ -5248,10 +5191,8 @@ main(void) * for user-defined integer types */ nerrors += test_derived_integer(); -#ifndef H5_VMS /* Does floating point overflow generate a SIGFPE? */ generates_sigfpe(); -#endif /* Test degenerate cases */ nerrors += run_fp_tests("noop"); @@ -5276,6 +5217,10 @@ main(void) *---------------------------------------------------------------------- */ without_hardware_g = TRUE; + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); /* Test software floating-point conversion functions */ @@ -5291,8 +5236,14 @@ main(void) /* Test software integer-float conversion functions */ nerrors += run_int_fp_conv("soft"); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + if (nerrors) { printf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); @@ -5301,3 +5252,4 @@ main(void) printf("All data type tests passed.\n"); return 0; } + diff --git a/test/dtypes.c b/test/dtypes.c index 59cf000..6fe455d 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -47,7 +47,7 @@ /* Alignment test stuff */ #ifdef TEST_ALIGNMENT -#define H5T_PACKAGE +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" #endif #define SET_ALIGNMENT(TYPE,VAL) \ @@ -769,11 +769,20 @@ test_compound_2(void) CHECK_NMEMBS(nmembs , st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -888,11 +897,19 @@ test_compound_3(void) CHECK_NMEMBS(nmembs, st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -1015,11 +1032,19 @@ test_compound_4(void) CHECK_NMEMBS(nmembs, st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -1226,11 +1251,19 @@ test_compound_6(void) CHECK_NMEMBS(nmembs, st, dt) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -1365,11 +1398,19 @@ test_compound_7(void) } /* end if */ PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -3233,11 +3274,7 @@ test_compound_18(void) /* Open Generated File */ /* (generated with gen_bad_compound.c) */ -#ifdef H5_VMS - if((file = H5Fopen(TESTFILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR -#else if((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR -#endif /* Try to open the datatype */ H5E_BEGIN_TRY { @@ -4233,6 +4270,10 @@ test_conv_str_1(void) HDfree(buf); PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; @@ -4245,7 +4286,11 @@ error: if(buf) HDfree(buf); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -4308,7 +4353,11 @@ error: if(buf) HDfree(buf); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return ret_value; } @@ -4422,7 +4471,11 @@ error: if(tag) H5free_memory(tag); /* Technically allocated by API call */ + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return ret_value; /* Number of errors */ } @@ -4494,7 +4547,11 @@ error: if(buf) HDfree(buf); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return ret_value; } @@ -4661,13 +4718,22 @@ test_conv_bitfield(void) H5Tclose(st); H5Tclose(dt); PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); return 0; - error: +error: H5Tclose(st); H5Tclose(dt); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return 1; } @@ -4785,14 +4851,18 @@ test_bitfield_funcs(void) retval = 0; - error: - +error: if (retval == -1) retval = 1; H5free_memory(tag); H5Tclose(ntype); H5Tclose(type); if (retval == 0) PASSED(); + + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + reset_hdf5(); + return retval; } @@ -7297,6 +7367,7 @@ main(void) #ifndef H5_NO_DEPRECATED_SYMBOLS nerrors += test_deprec(fapl); #endif /* H5_NO_DEPRECATED_SYMBOLS */ + h5_cleanup(FILENAME, fapl); /*must happen before first reset*/ reset_hdf5(); diff --git a/test/earray.c b/test/earray.c index 2131c15..c71e53b 100644 --- a/test/earray.c +++ b/test/earray.c @@ -22,7 +22,7 @@ * This file needs to access private datatypes from the H5EA package. * This file also needs to access the extensible array testing code. */ -#define H5EA_PACKAGE +#define H5EA_FRIEND /*suppress error about including H5EApkg */ #define H5EA_TESTING #include "H5EApkg.h" /* Extensible Arrays */ @@ -30,7 +30,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ @@ -2902,7 +2902,7 @@ main(void) init_cparam(&cparam); /* Iterate over the testing parameters */ - for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; curr_test++) { + for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; H5_INC_ENUM(earray_test_type_t, curr_test)) { /* Initialize the testing parameters */ init_tparam(&tparam, &cparam); @@ -2934,7 +2934,7 @@ main(void) nerrors += test_flush_depend(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ - for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; curr_iter++) { + for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; H5_INC_ENUM(earray_iter_type_t, curr_iter)) { hsize_t sblk; /* Super block index */ hsize_t dblk; /* Data block index */ hsize_t nelmts; /* # of elements to test */ @@ -18,7 +18,7 @@ #include "h5test.h" -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" #include "H5Iprivate.h" @@ -3200,7 +3200,7 @@ main(void) puts("All external file cache tests passed."); - h5_cleanup(FILENAME, fapl_id); + h5_clean_files(FILENAME, fapl_id); return 0; diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 4832767..4f0147e 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -122,10 +122,18 @@ main(void) printf("Encode/Decode DCPLs\n"); /******* ENCODE/DECODE DCPLS *****/ - TESTING("DCPL Encoding/Decoding"); + TESTING("Default DCPL Encoding/Decoding"); if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(dcpl) < 0) + FAIL_PUTS_ERROR("Default DCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("DCPL Encoding/Decoding"); + if((H5Pset_chunk(dcpl, 2, chunk_size)) < 0) FAIL_STACK_ERROR @@ -161,10 +169,18 @@ main(void) /******* ENCODE/DECODE DAPLS *****/ - TESTING("DAPL Encoding/Decoding"); + TESTING("Default DAPL Encoding/Decoding"); if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(dapl) < 0) + FAIL_PUTS_ERROR("Default DAPL encoding/decoding failed\n") + + PASSED(); + + TESTING("DAPL Encoding/Decoding"); + if((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0) FAIL_STACK_ERROR @@ -180,10 +196,18 @@ main(void) /******* ENCODE/DECODE OCPLS *****/ - TESTING("OCPL Encoding/Decoding"); + TESTING("Default OCPL Encoding/Decoding"); if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(ocpl) < 0) + FAIL_PUTS_ERROR("Default OCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("OCPL Encoding/Decoding"); + if((H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0) FAIL_STACK_ERROR @@ -205,9 +229,18 @@ main(void) /******* ENCODE/DECODE DXPLS *****/ - TESTING("DXPL Encoding/Decoding"); + TESTING("Default DXPL Encoding/Decoding"); if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) FAIL_STACK_ERROR + + /* Test encoding & decoding default property list */ + if(test_encode_decode(dxpl) < 0) + FAIL_PUTS_ERROR("Default DXPL encoding/decoding failed\n") + + PASSED(); + + TESTING("DXPL Encoding/Decoding"); + if((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0) FAIL_STACK_ERROR if((H5Pset_hyper_vector_size(dxpl, 5)) < 0) @@ -241,10 +274,18 @@ main(void) /******* ENCODE/DECODE GCPLS *****/ - TESTING("GCPL Encoding/Decoding"); + TESTING("Default GCPL Encoding/Decoding"); if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(gcpl) < 0) + FAIL_PUTS_ERROR("Default GCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("GCPL Encoding/Decoding"); + if((H5Pset_local_heap_size_hint(gcpl, 256)) < 0) FAIL_STACK_ERROR @@ -273,10 +314,18 @@ main(void) /******* ENCODE/DECODE LCPLS *****/ - TESTING("LCPL Encoding/Decoding"); + TESTING("Default LCPL Encoding/Decoding"); if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(lcpl) < 0) + FAIL_PUTS_ERROR("Default LCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("LCPL Encoding/Decoding"); + if((H5Pset_create_intermediate_group(lcpl, TRUE)) < 0) FAIL_STACK_ERROR @@ -292,10 +341,18 @@ main(void) /******* ENCODE/DECODE LAPLS *****/ - TESTING("LAPL Encoding/Decoding"); + TESTING("Default LAPL Encoding/Decoding"); if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(lapl) < 0) + FAIL_PUTS_ERROR("Default LAPL encoding/decoding failed\n") + + PASSED(); + + TESTING("LAPL Encoding/Decoding"); + if((H5Pset_nlinks(lapl, (size_t)134)) < 0) FAIL_STACK_ERROR @@ -330,10 +387,18 @@ main(void) /******* ENCODE/DECODE OCPYPLS *****/ - TESTING("OCPYPL Encoding/Decoding"); + TESTING("Default OCPYPL Encoding/Decoding"); if((ocpypl = H5Pcreate(H5P_OBJECT_COPY)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(ocpypl) < 0) + FAIL_PUTS_ERROR("Default OCPYPL encoding/decoding failed\n") + + PASSED(); + + TESTING("OCPYPL Encoding/Decoding"); + if((H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG)) < 0) FAIL_STACK_ERROR @@ -354,10 +419,18 @@ main(void) /******* ENCODE/DECODE FAPLS *****/ - TESTING("FAPL Encoding/Decoding"); + TESTING("Default FAPL Encoding/Decoding"); if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(fapl) < 0) + FAIL_PUTS_ERROR("Default FAPL encoding/decoding failed\n") + + PASSED(); + + TESTING("FAPL Encoding/Decoding"); + if((H5Pset_family_offset(fapl, 1024)) < 0) FAIL_STACK_ERROR if((H5Pset_meta_block_size(fapl, 2098452)) < 0) @@ -397,11 +470,19 @@ main(void) /******* ENCODE/DECODE FCPLS *****/ - TESTING("FCPL Encoding/Decoding"); + TESTING("Default FCPL Encoding/Decoding"); if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(fcpl) < 0) + FAIL_PUTS_ERROR("Default FCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("FCPL Encoding/Decoding"); + if((H5Pset_userblock(fcpl, 1024) < 0)) FAIL_STACK_ERROR @@ -435,11 +516,19 @@ main(void) /******* ENCODE/DECODE STRCPLS *****/ - TESTING("STRCPL Encoding/Decoding"); + TESTING("Default STRCPL Encoding/Decoding"); if((strcpl = H5Pcreate(H5P_STRING_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(strcpl) < 0) + FAIL_PUTS_ERROR("Default STRCPL encoding/decoding failed\n") + + PASSED(); + + TESTING("STRCPL Encoding/Decoding"); + if((H5Pset_char_encoding(strcpl, H5T_CSET_UTF8) < 0)) FAIL_STACK_ERROR @@ -455,11 +544,19 @@ main(void) /******* ENCODE/DECODE ACPLS *****/ - TESTING("ACPL Encoding/Decoding"); + TESTING("Default ACPL Encoding/Decoding"); if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0) FAIL_STACK_ERROR + /* Test encoding & decoding default property list */ + if(test_encode_decode(acpl) < 0) + FAIL_PUTS_ERROR("Default ACPL encoding/decoding failed\n") + + PASSED(); + + TESTING("ACPL Encoding/Decoding"); + if((H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0)) FAIL_STACK_ERROR diff --git a/test/err_compat.c b/test/err_compat.c index 576433e..7779ddc 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -500,7 +500,7 @@ main(void) } if(H5Fclose(file) < 0) TEST_ERROR ; - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); printf("All error API tests passed.\n"); return 0; @@ -510,3 +510,4 @@ main(void) return 1; } #endif /* H5_NO_DEPRECATED_SYMBOLS */ + diff --git a/test/error_test.c b/test/error_test.c index e712d86..4e4c0ef 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -756,7 +756,7 @@ main(void) if(test_filter_error(filename) < 0) TEST_ERROR; - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); HDfprintf(stderr, "\nAll error API tests passed.\n"); return 0; diff --git a/test/farray.c b/test/farray.c index cab5540..440dd82 100644 --- a/test/farray.c +++ b/test/farray.c @@ -22,7 +22,7 @@ * This file needs to access private datatypes from the H5FA package. * This file also needs to access the fixed array testing code. */ -#define H5FA_PACKAGE +#define H5FA_FRIEND /*suppress error about including H5FApkg */ #define H5FA_TESTING #include "H5FApkg.h" /* Fixed Arrays */ @@ -30,7 +30,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ @@ -1562,11 +1562,11 @@ main(void) } /* Iterate over the testing parameters */ - for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; curr_test++) { + for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; H5_INC_ENUM(farray_test_type_t, curr_test)) { /* Initialize the testing parameters */ - HDmemset(&tparam, 0, sizeof(tparam)); - tparam.nelmts = TEST_NELMTS; + HDmemset(&tparam, 0, sizeof(tparam)); + tparam.nelmts = TEST_NELMTS; /* Set appropriate testing parameters for each test */ switch(curr_test) { @@ -1597,7 +1597,7 @@ main(void) nerrors += test_delete_open(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ - for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; curr_iter++) { + for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; H5_INC_ENUM(farray_iter_type_t, curr_iter)) { /* Set appropriate parameters for each type of iteration */ switch(curr_iter) { diff --git a/test/fheap.c b/test/fheap.c index 0f2f54f..4df25db 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -22,7 +22,7 @@ * This file needs to access private datatypes from the H5HF package. * This file also needs to access the fractal heap testing code. */ -#define H5HF_PACKAGE +#define H5HF_FRIEND /*suppress error about including H5HFpkg */ #define H5HF_TESTING #include "H5HFpkg.h" /* Fractal heaps */ @@ -16380,7 +16380,7 @@ main(void) /* Iterate over the testing parameters */ #ifndef QAK - for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; curr_test++) { + for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; H5_INC_ENUM(fheap_test_type_t, curr_test)) { #else /* QAK */ HDfprintf(stderr, "Uncomment test loop!\n"); curr_test = FHEAP_TEST_NORMAL; @@ -16418,9 +16418,7 @@ curr_test = FHEAP_TEST_NORMAL; nerrors += test_id_limits(fapl, &small_cparam); nerrors += test_filtered_create(fapl, &small_cparam); nerrors += test_size(fapl, &small_cparam); -#ifndef H5_CANNOT_OPEN_TWICE nerrors += test_reopen_hdr(fapl, &small_cparam); -#endif /*H5_CANNOT_OPEN_TWICE*/ #else /* QAK */ HDfprintf(stderr, "Uncomment tests!\n"); #endif /* QAK */ @@ -16432,7 +16430,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); #ifndef QAK2 /* Filling with different sized objects */ - for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; fill++) { + for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; H5_INC_ENUM(fheap_test_fill_t, fill)) { #else /* QAK2 */ HDfprintf(stderr, "Uncomment test loop!\n"); fill = FHEAP_TEST_FILL_LARGE; @@ -16544,9 +16542,9 @@ HDfprintf(stderr, "Uncomment tests!\n"); fheap_test_del_drain_t drain_half; /* Deletion draining */ /* More complex removal patterns */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { tparam.del_dir = del_dir; - for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; drain_half++) { + for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; H5_INC_ENUM(fheap_test_del_drain_t, drain_half)) { tparam.drain_half = drain_half; #else /* QAK2 */ HDfprintf(stderr, "Uncomment test loops!\n"); @@ -16685,7 +16683,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); } /* end switch */ /* Try several different methods of deleting objects */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { tparam.del_dir = del_dir; /* Test 'huge' object insert & delete */ @@ -16728,7 +16726,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); { fheap_test_del_dir_t del_dir; /* Deletion direction */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { tparam.del_dir = del_dir; /* Controlled tests */ diff --git a/test/file_image.c b/test/file_image.c index b1b9d47..42199cb 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -643,7 +643,7 @@ test_core(void) if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Release resources */ - h5_cleanup(FILENAME, fapl); + h5_clean_files(FILENAME, fapl); HDfree(udata); HDfree(file_image); HDremove(copied_filename); @@ -890,8 +890,8 @@ test_get_file_image(const char * test_banner, VERIFY(err == SUCCEED, "H5Pclose(core_fapl_id) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl); - VERIFY(result != 0, "h5_cleanup() failed."); + result = h5_clean_files(FILENAME2, fapl); + VERIFY(result != 0, "h5_clean_files() failed."); /* discard the image buffer if it exists */ if(image_ptr != NULL) @@ -1039,8 +1039,8 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(file_id) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(1) failed."); + result = h5_clean_files(FILENAME2, fapl_id); + VERIFY(result != 0, "h5_clean_files(1) failed."); /* discard the image buffer if it exists */ if(image_ptr != NULL) @@ -1145,8 +1145,8 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(2) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(2 failed."); + result = h5_clean_files(FILENAME2, fapl_id); + VERIFY(result != 0, "h5_clean_files(2 failed."); /************************** Test #3 **********************************/ /* set up a split file driver test file, and try to get its image @@ -1208,8 +1208,8 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(2) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(2 failed."); + result = h5_clean_files(FILENAME2, fapl_id); + VERIFY(result != 0, "h5_clean_files(2 failed."); /************************** Test #4 **********************************/ /* set up a family file driver test file, and try to get its image @@ -1269,8 +1269,8 @@ test_get_file_image_error_rejection(void) VERIFY(err == SUCCEED, "H5Fclose(2) failed."); /* tidy up */ - result = h5_cleanup(FILENAME2, fapl_id); - VERIFY(result != 0, "h5_cleanup(2 failed."); + result = h5_clean_files(FILENAME2, fapl_id); + VERIFY(result != 0, "h5_clean_files(2 failed."); PASSED(); @@ -1340,6 +1340,8 @@ main(void) errors += test_get_file_image_error_rejection(); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); if(errors) { printf("***** %d File Image TEST%s FAILED! *****\n", diff --git a/test/fillval.c b/test/fillval.c index c791504..b7b2ff5 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -845,7 +845,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, if(datatype==H5T_INTEGER) { /*check for overflow*/ HDassert((nelmts * sizeof(int)) == (hsize_t)((size_t)(nelmts * sizeof(int)))); - buf = HDmalloc((size_t)(nelmts * sizeof(int))); + buf = (int *)HDmalloc((size_t)(nelmts * sizeof(int))); if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0) goto error; diff --git a/test/flush2.c b/test/flush2.c index 28ce41e..e86d646 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -107,7 +107,7 @@ error: static int check_file(char* filename, hid_t fapl, int flag) { - hid_t file, groups, grp; + hid_t file = -1, groups = -1; char name[1024]; int i; @@ -117,6 +117,7 @@ check_file(char* filename, hid_t fapl, int flag) /* Open some groups */ if((groups = H5Gopen2(file, "some_groups", H5P_DEFAULT)) < 0) goto error; for(i = 0; i < 100; i++) { + hid_t grp; sprintf(name, "grp%02u", (unsigned)i); if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error; if(H5Gclose(grp) < 0) goto error; @@ -132,6 +133,11 @@ check_file(char* filename, hid_t fapl, int flag) return 0; error: + H5E_BEGIN_TRY { + H5Gclose(groups); + H5Fclose(file); + } H5E_END_TRY; + return 1; } /* end check_file() */ @@ -184,16 +190,13 @@ main(void) h5_fixname(FILENAME[1], fapl, name, sizeof name); if(check_file(name, fapl, FALSE)) PASSED() - else - { + else { #if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS) - SKIPPED(); - puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); -#elif defined H5_VMS - SKIPPED(); + SKIPPED(); + puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); #else - H5_FAILED() - goto error; + H5_FAILED() + goto error; #endif } H5Eset_auto2(H5E_DEFAULT, func, NULL); @@ -207,19 +210,16 @@ main(void) h5_fixname(FILENAME[2], fapl, name, sizeof name); if(check_file(name, fapl, TRUE)) PASSED() - else - { + else { #if defined H5_HAVE_WIN32_API && !defined (hdf5_EXPORTS) - SKIPPED(); - puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); -#elif defined H5_VMS - SKIPPED(); + SKIPPED(); + puts(" DLL will flush the file even when calling _exit, skip this test temporarily"); #else - H5_FAILED() - goto error; + H5_FAILED() + goto error; #endif - } + H5Eset_auto2(H5E_DEFAULT, func, NULL); h5_cleanup(FILENAME, fapl); diff --git a/test/freespace.c b/test/freespace.c index a7c6760..28cf1de 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -17,13 +17,13 @@ */ #include "h5test.h" -#define H5FS_PACKAGE +#define H5FS_FRIEND /*suppress error about including H5FSpkg */ #define H5FS_TESTING #include "H5FSpkg.h" /* Free space manager */ /* Other private headers that this test requires */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "H5Fpkg.h" #include "H5Iprivate.h" #include "H5VMprivate.h" @@ -2841,6 +2841,8 @@ main(void) if(env_h5_drvr == NULL) env_h5_drvr = "nomatch"; + h5_reset(); + fapl = h5_fileaccess(); /* make sure alignment is not set for tests to succeed */ diff --git a/test/gen_cross.c b/test/gen_cross.c index 1c73016..2d4b788 100644 --- a/test/gen_cross.c +++ b/test/gen_cross.c @@ -22,6 +22,10 @@ * Run it on an OpenVMS, a little-endian, and a big-endian machine. Change the * output file names to vms_data.h5, le_data.h5, and be_data.h5, and put them * under hdf5/test/ directory. + * + * Note that we no longer support OpenVMS. The OpenVMS file will eventually + * have to go away since we won't be able to re-create it but it's probably + * worth keeping around for now. */ #include <stdio.h> diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c index a1312d2..fc044da 100644 --- a/test/gen_udlinks.c +++ b/test/gen_udlinks.c @@ -57,6 +57,10 @@ main (void) strcpy(filename1, NAME_BE_1); strcpy(filename2, NAME_BE_2); break; + case H5T_ORDER_ERROR: + case H5T_ORDER_VAX: + case H5T_ORDER_MIXED: + case H5T_ORDER_NONE: default: goto error; } diff --git a/test/getname.c b/test/getname.c index dc1ddbe..2700b49 100644 --- a/test/getname.c +++ b/test/getname.c @@ -20,8 +20,8 @@ * Purpose: Tests the "ID to name" functionality */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ -#define H5I_PACKAGE /*suppress error about including H5Ipkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5I_FRIEND /*suppress error about including H5Ipkg */ /* Define these macros to indicate that the testing APIs should be available */ #define H5G_TESTING @@ -2995,9 +2995,7 @@ main(void) nerrors += test_main(file_id, fapl); nerrors += test_obj_ref(fapl); nerrors += test_reg_ref(fapl); -#ifndef H5_CANNOT_OPEN_TWICE nerrors += test_elinks(fapl); -#endif /*H5_CANNOT_OPEN_TWICE*/ /* Close file */ H5Fclose(file_id); diff --git a/test/gheap.c b/test/gheap.c index 6233139..e434a7b 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -34,7 +34,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ diff --git a/test/h5test.c b/test/h5test.c index fefacda..51ec2ca 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -28,7 +28,7 @@ #include "H5srcdir.h" /* Necessary for h5_verify_cached_stabs() */ -#define H5G_PACKAGE +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "H5Gpkg.h" @@ -91,6 +91,9 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ */ static const char *multi_letters = "msbrglo"; +/* Previous error reporting function */ +static H5E_auto2_t err_func = NULL; + static herr_t h5_errors(hid_t estack, void *client_data); static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix, char *fullname, size_t size); @@ -120,9 +123,9 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data) return 0; } - + /*------------------------------------------------------------------------- - * Function: h5_cleanup + * Function: h5_clean_files * * Purpose: Cleanup temporary test files. * base_name contains the list of test file names. @@ -130,13 +133,13 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data) * * Return: Non-zero if cleanup actions were performed; zero otherwise. * - * Programmer: Albert Cheng - * May 28, 1998 + * Programmer: Quincey Koziol + * September 13, 2015 * *------------------------------------------------------------------------- */ int -h5_cleanup(const char *base_name[], hid_t fapl) +h5_clean_files(const char *base_name[], hid_t fapl) { int retval = 0; @@ -189,8 +192,61 @@ h5_cleanup(const char *base_name[], hid_t fapl) retval = 1; } /* end if */ + /* Close the FAPL used to access the file */ H5Pclose(fapl); + return retval; +} /* end h5_clean_files() */ + + +/*------------------------------------------------------------------------- + * Function: h5_cleanup + * + * Purpose: Cleanup temporary test files. + * base_name contains the list of test file names. + * The file access property list is also closed. + * + * Return: Non-zero if cleanup actions were performed; zero otherwise. + * + * Programmer: Albert Cheng + * May 28, 1998 + * + *------------------------------------------------------------------------- + */ +int +h5_cleanup(const char *base_name[], hid_t fapl) +{ + int retval = 0; + + /* Clean up the files and the FAPL */ + retval = h5_clean_files(base_name, fapl); + + /* Restore the original error reporting routine */ + h5_restore_err(); + + return retval; +} /* end h5_cleanup() */ + + +/*------------------------------------------------------------------------- + * Function: h5_restore_err + * + * Purpose: Restore the default error handler. + * + * Return: N/A + * + * Programmer: Quincey Koziol + * Sept 10, 2015 + * + *------------------------------------------------------------------------- + */ +void +h5_restore_err(void) +{ + /* Restore the original error reporting routine */ + HDassert(err_func != NULL); + H5Eset_auto2(H5E_DEFAULT, err_func, NULL); + err_func = NULL; } @@ -212,6 +268,10 @@ h5_reset(void) HDfflush(stdout); HDfflush(stderr); H5close(); + + /* Save current error stack reporting routine and redirect to our local one */ + HDassert(err_func == NULL); + H5Eget_auto2(H5E_DEFAULT, &err_func, NULL); H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); /* @@ -233,12 +293,12 @@ h5_reset(void) */ sprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); H5E_BEGIN_TRY { - hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, - H5P_DEFAULT); - hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(grp); - H5Fclose(file); - HDunlink(filename); + hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, + H5P_DEFAULT); + hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Gclose(grp); + H5Fclose(file); + HDunlink(filename); } H5E_END_TRY; } #endif /* OLD_WAY */ diff --git a/test/h5test.h b/test/h5test.h index 5b203c6..615ca4f 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -123,6 +123,7 @@ extern "C" { #endif /* Generally useful testing routines */ +H5TEST_DLL int h5_clean_files(const char *base_name[], hid_t fapl); H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl); H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size); H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size); @@ -130,6 +131,7 @@ H5TEST_DLL hid_t h5_fileaccess(void); H5TEST_DLL void h5_no_hwconv(void); H5TEST_DLL const char *h5_rmprefix(const char *filename); H5TEST_DLL void h5_reset(void); +H5TEST_DLL void h5_restore_err(void); H5TEST_DLL void h5_show_hostname(void); H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl); H5TEST_DLL int print_func(const char *format, ...); diff --git a/test/istore.c b/test/istore.c index d088fe8..ec7542a 100644 --- a/test/istore.c +++ b/test/istore.c @@ -19,7 +19,7 @@ * Purpose: Tests various aspects of indexed raw data storage. */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #include "h5test.h" #include "H5private.h" diff --git a/test/lheap.c b/test/lheap.c index 94af085..f1cad93 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -29,7 +29,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ @@ -187,11 +187,7 @@ main(void) { const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ hid_t dset = -1; -#ifdef H5_VMS - file = H5Fopen(TESTFILE, H5F_ACC_RDONLY, H5P_DEFAULT); -#else file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); -#endif if(file >= 0){ if((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/test/links.c b/test/links.c index cfbc4a1..ce3b658 100644 --- a/test/links.c +++ b/test/links.c @@ -24,7 +24,7 @@ * This file needs to access private information from the H5G package. * This file also needs to access the group testing code. */ -#define H5G_PACKAGE +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "h5test.h" @@ -36,13 +36,8 @@ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" -#ifdef H5_VMS -#define TMPDIR "[.tmp]" -#define TMPDIR2 "[.tmp2]" -#else /* H5_VMS */ #define TMPDIR "tmp/" #define TMPDIR2 "tmp2/" -#endif /* H5_VMS */ /* Symlinks for external link symlink test */ #define SYMLINK1 TMPDIR "sym1.h5" @@ -320,7 +315,7 @@ typedef struct { * Function: fix_ext_filename * * Purpose: Internal function to append path to file name. It handles - * path name of Unix, Windows, and OpenVMS. + * path name of Unix and Windows. * * Return: void * @@ -333,17 +328,8 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) { HDstrcpy(path_name, cwd); -#ifdef H5_VMS - if(file_name[0] == '[') { - char *tmp = file_name; - path_name[strlen(cwd)-1] = '\0'; - HDstrcat(path_name, ++tmp); - } else - HDstrcat(path_name, file_name); -#else HDstrcat(path_name, "/"); HDstrcat(path_name, file_name); -#endif } @@ -2877,7 +2863,6 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) * set up name for main file: * Linux: "/CWD/tmp/extlinks0" * Window: "<cur drive>:/CWD/tmp/extlinks0" - * OpenVMS: "<cur disk>$<partition>:[CWD.tmp]extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -6943,7 +6928,6 @@ external_file_cache(hid_t fapl, hbool_t new_format) /* Verify that all files are now closed */ H5F_sfile_assert_num(0); -#ifndef H5_CANNOT_OPEN_TWICE /* * Test 5: 3 file cycle */ @@ -7045,7 +7029,6 @@ external_file_cache(hid_t fapl, hbool_t new_format) /* Verify that all files are now closed */ H5F_sfile_assert_num(0); -#endif /* H5_CANNOT_OPEN_TWICE */ /* Close fapl */ H5Pclose(my_fapl); @@ -14580,15 +14563,11 @@ main(void) printf("\n---Testing without external file cache---\n"); } /* end else */ -#ifndef H5_CANNOT_OPEN_TWICE nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; -#endif /* H5_CANNOT_OPEN_TWICE */ nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; -#ifndef H5_CANNOT_OPEN_TWICE nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0; -#endif /* H5_CANNOT_OPEN_TWICE */ nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0; @@ -14596,9 +14575,7 @@ main(void) nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0; -#ifndef H5_CANNOT_OPEN_TWICE nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; -#endif /* H5_CANNOT_OPEN_TWICE */ nerrors += external_link_endian(new_format) < 0 ? 1 : 0; nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; @@ -14628,9 +14605,7 @@ main(void) nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; -#ifndef H5_CANNOT_OPEN_TWICE nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; -#endif /* H5_CANNOT_OPEN_TWICE */ } /* end for */ /* These tests assume that external links are a form of UD links, @@ -14654,9 +14629,7 @@ main(void) nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0; nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0; nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0; -#ifndef H5_CANNOT_OPEN_TWICE nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0; -#endif /* H5_CANNOT_OPEN_TWICE */ /* Keep this test last, it's testing files that are used above */ /* do not do this for files used by external link tests */ diff --git a/test/links_env.c b/test/links_env.c index 308d562..b3fec38 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -17,7 +17,7 @@ * Purpose: Tests hard, soft (symbolic) & external links. */ -#define H5G_PACKAGE +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "h5test.h" @@ -25,11 +25,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ -#ifdef H5_VMS -#define TMPDIR "[.tmp]" -#else /* H5_VMS */ #define TMPDIR "tmp/" -#endif /* H5_VMS */ #define NAME_BUF_SIZE 1024 const char *FILENAME[] = { @@ -24,13 +24,13 @@ #include "h5test.h" -#define H5MF_PACKAGE +#define H5MF_FRIEND /*suppress error about including H5MFpkg */ #include "H5MFpkg.h" -#define H5FS_PACKAGE +#define H5FS_FRIEND /*suppress error about including H5FSpkg */ #include "H5FSpkg.h" -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" @@ -6843,7 +6843,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_gone(fapl_new, fcpl); ret += test_mf_fs_persist(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* STDIO */ @@ -6857,7 +6857,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_gone(fapl_new, fcpl); ret += test_mf_fs_persist(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* CORE */ HDputs("Testing free-space managers with core driver"); @@ -6871,7 +6871,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_gone(fapl_new, fcpl); ret += test_mf_fs_persist(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* FAMILY */ HDputs("Testing free-space managers with family driver"); @@ -6883,7 +6883,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_persist(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* SPLIT */ HDputs("Testing free-space managers with split driver"); @@ -6896,7 +6896,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_persist(fapl_new, fcpl); ret += test_mf_fs_split(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* MULTI */ HDputs("Testing free-space managers with multi driver"); @@ -6910,7 +6910,7 @@ test_mf_fs_drivers(hid_t fapl) ret += test_mf_fs_multi(fapl_new, fcpl); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); } /* end for new_format */ @@ -7262,7 +7262,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* STDIO */ HDputs("Testing file space management with stdio driver"); @@ -7275,7 +7275,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* CORE */ HDputs("Testing file space management with core driver"); @@ -7289,7 +7289,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* FAMILY */ HDputs("Testing file space managers with family driver"); @@ -7302,7 +7302,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* SPLIT */ @@ -7316,7 +7316,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); /* MULTI */ HDputs("Testing file space managers with multi driver"); @@ -7331,7 +7331,7 @@ test_filespace_drivers(hid_t fapl) ret += test_filespace_strategy_threshold(fapl_new); ret += test_filespace_gone(fapl_new); - h5_cleanup(FILENAME, fapl_new); + h5_clean_files(FILENAME, fapl_new); } /* end for new_format */ @@ -7456,6 +7456,8 @@ main(void) if(env_h5_drvr == NULL) env_h5_drvr = "nomatch"; + h5_reset(); + fapl = h5_fileaccess(); /* Make a copy of the FAPL before adjusting the alignment */ diff --git a/test/objcopy.c b/test/objcopy.c index e84e70c..6607f4e 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -28,7 +28,7 @@ * This file needs to access private information from the H5S package. * This file also needs to access the dataspace testing code. */ -#define H5S_PACKAGE +#define H5S_FRIEND /*suppress error about including H5Spkg */ #define H5S_TESTING #include "H5Spkg.h" /* Dataspaces */ @@ -36,7 +36,7 @@ * This file needs to access private information from the H5P package. * This file also needs to access the property list testing code. */ -#define H5P_PACKAGE +#define H5P_FRIEND /*suppress error about including H5Ppkg */ #define H5P_TESTING #include "H5Ppkg.h" /* Property Lists */ @@ -12276,9 +12276,7 @@ main(void) nerrors += test_copy_group_wide_loop(fcpl_src, fcpl_dst, src_fapl, dst_fapl); nerrors += test_copy_group_links(fcpl_src, fcpl_dst, src_fapl, dst_fapl); nerrors += test_copy_soft_link(fcpl_src, fcpl_dst, src_fapl, dst_fapl); -#ifndef H5_CANNOT_OPEN_TWICE nerrors += test_copy_ext_link(fcpl_src, fcpl_dst, src_fapl, dst_fapl); -#endif /* H5_CANNOT_OPEN_TWICE */ nerrors += test_copy_exist(fcpl_src, fcpl_dst, src_fapl, dst_fapl); nerrors += test_copy_path(fcpl_src, fcpl_dst, src_fapl, dst_fapl); diff --git a/test/ohdr.c b/test/ohdr.c index 4857356..ba632c2 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -24,14 +24,14 @@ * This file needs to access private datatypes from the H5O package. * This file also needs to access the object header testing code. */ -#define H5O_PACKAGE +#define H5O_FRIEND /*suppress error about including H5Opkg */ #define H5O_TESTING #include "H5Opkg.h" /* * This file needs to access private datatypes from the H5G package. */ -#define H5G_PACKAGE +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #include "H5Gpkg.h" const char *FILENAME[] = { diff --git a/test/plugin.c b/test/plugin.c index 74a8f4b..e34c691 100644 --- a/test/plugin.c +++ b/test/plugin.c @@ -26,7 +26,7 @@ /* * This file needs to access private datatypes from the H5Z package. */ -#define H5Z_PACKAGE +#define H5Z_FRIEND #include "H5Zpkg.h" /* Filters for HDF5 internal test */ @@ -768,6 +768,9 @@ main(void) if(H5Pclose(fapl2) < 0) TEST_ERROR if(H5Pclose(fapl) < 0) TEST_ERROR + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + puts("\nTesting reading data with with dynamic plugin filters:"); /* Close the library so that all loaded plugin libraries are unloaded */ @@ -784,6 +787,9 @@ main(void) /* Open the groups with filters */ nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0); + /* Restore the default error handler (set in h5_reset()) */ + h5_restore_err(); + /* Close the library so that all loaded plugin libraries are unloaded */ h5_reset(); fapl = h5_fileaccess(); diff --git a/test/pool.c b/test/pool.c index 916d45e..83c862b 100644 --- a/test/pool.c +++ b/test/pool.c @@ -22,7 +22,7 @@ * This file needs to access private datatypes from the H5MP package. * This file also needs to access the memory pool testing code. */ -#define H5MP_PACKAGE +#define H5MP_FRIEND /*suppress error about including H5MPpkg */ #define H5MP_TESTING #include "H5MPpkg.h" /* Memory Pools */ diff --git a/test/stab.c b/test/stab.c index 48b58b1..7db1feb 100644 --- a/test/stab.c +++ b/test/stab.c @@ -18,7 +18,7 @@ * Tuesday, November 24, 1998 */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5G_TESTING @@ -57,8 +57,6 @@ const char *FILENAME[] = { /* The group_old.h5 is generated from gen_old_fill.c in HDF5 'test' directory * for version 1.6. To get this data file, simply compile gen_old_group.c with * the HDF5 library in that branch and run it. */ -/* I changed the name "group_old.h5.copy" to "group_old_copy.h5" because OpenVMS - * doesn't like any file name with more than one ".". SLU 2010/12/13 */ #define FILE_OLD_GROUPS "group_old.h5" #define FILE_OLD_GROUPS_COPY "group_old_copy.h5" diff --git a/test/tattr.c b/test/tattr.c index 137c7c9..7e64c13 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -29,7 +29,7 @@ * This file needs to access private information from the H5O package. * This file also needs to access the object header testing code. */ -#define H5O_PACKAGE +#define H5O_FRIEND /*suppress error about including H5Opkg */ #define H5O_TESTING #include "H5Opkg.h" /* Object headers */ @@ -37,7 +37,7 @@ * This file needs to access private information from the H5A package. * This file also needs to access the attribute testing code. */ -#define H5A_PACKAGE +#define H5A_FRIEND /*suppress error about including H5Apkg */ #define H5A_TESTING #include "H5Apkg.h" /* Attributes */ @@ -45,7 +45,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ @@ -5919,9 +5919,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -6868,9 +6868,9 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) iter_info.visited = visited; /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -7223,9 +7223,9 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ diff --git a/test/tconfig.c b/test/tconfig.c index f3ac242..14c863e 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -60,13 +60,6 @@ void test_exit_definitions(void); * Programmer: Albert Cheng * September 25, 2001 * - * Modifications: - * Raymond Lu - * 16 Dec 2009 - * On Boeing's OpenVMS, the value of EXIT_FAILURE is 268435458. - * (The test is in test_exit_definitions.) Their document says - * it's supposed to be 2. I commented it out for OpenVMS for - * further consideration. *------------------------------------------------------------------------- */ void @@ -75,9 +68,7 @@ test_configure(void) /* Output message about test being performed */ MESSAGE(5, ("Testing configure definitions\n")); test_config_ctypes(); -#ifndef H5_VMS test_exit_definitions(); -#endif } diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in index a6d8c50..43e76c4 100644 --- a/test/test_plugin.sh.in +++ b/test/test_plugin.sh.in @@ -36,7 +36,7 @@ case $(uname) in *) PLUGIN_LIB1="$FROM_DIR/libdynlib1.* $FROM_DIR/libdynlib3.*" PLUGIN_LIB2="$FROM_DIR/libdynlib2.*" - :: + ;; esac PLUGIN_LIBDIR1=testdir1 PLUGIN_LIBDIR2=testdir2 diff --git a/test/tfile.c b/test/tfile.c index 4d3903c..12b27cf 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -32,7 +32,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ @@ -181,19 +181,15 @@ test_file_create(void) * try to create the same file with H5F_ACC_TRUNC. This should fail * because fid1 is the same file and is currently open. */ -#ifndef H5_HAVE_FILE_VERSIONS fid2 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); VERIFY(fid2, FAIL, "H5Fcreate"); -#endif /*H5_DONT_HAVE_FILE_VERSIONS*/ /* Close all files */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); -#ifndef H5_HAVE_FILE_VERSIONS ret = H5Fclose(fid2); VERIFY(ret, FAIL, "H5Fclose"); /*file should not have been open */ -#endif /*H5_HAVE_FILE_VERSIONS*/ /* * Try again with H5F_ACC_EXCL. This should fail because the file already @@ -206,7 +202,6 @@ test_file_create(void) fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid1, FAIL, "H5Fcreate"); -#ifndef H5_HAVE_FILE_VERSIONS /* * Try to truncate first file again. This should fail because fid1 is the * same file and is currently open. @@ -220,7 +215,6 @@ test_file_create(void) */ fid2 = H5Fcreate(FILE1, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT); VERIFY(fid2, FAIL, "H5Fcreate"); -#endif /*H5_HAVE_FILE_VERSIONS*/ /* Get the file-creation template */ tmpl1 = H5Fget_create_plist(fid1); @@ -833,7 +827,9 @@ test_file_close(void) ret = H5Gclose(group_id3); CHECK(ret, FAIL, "H5Gclose"); break; - default: + + case H5F_CLOSE_DEFAULT: + default: CHECK(fc_degree, H5F_CLOSE_DEFAULT, "H5Pget_fclose_degree"); break; } @@ -1320,6 +1316,19 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, VERIFY(oid_list[i], did, "H5Fget_obj_ids"); break; + case H5I_UNINIT: + case H5I_BADID: + case H5I_DATATYPE: + case H5I_DATASPACE: + case H5I_ATTR: + case H5I_REFERENCE: + case H5I_VFL: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: default: ERROR("H5Fget_obj_ids"); } /* end switch */ @@ -1370,7 +1379,6 @@ test_file_perm(void) ret = H5Dclose(dset); CHECK(ret, FAIL, "H5Dclose"); -#ifndef H5_CANNOT_OPEN_TWICE /* Open the file (with read-only permission) */ filero = H5Fopen(FILE2, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(filero, FAIL, "H5Fopen"); @@ -1387,7 +1395,6 @@ test_file_perm(void) ret = H5Fclose(filero); CHECK(ret, FAIL, "H5Fclose"); -#endif /*H5_CANNOT_OPEN_TWICE*/ ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); @@ -2390,7 +2397,7 @@ test_rw_noupdate(void) /* Check That Timestamps Are Equal */ if(diff > 0.0F) { /* Output message about test being performed */ - MESSAGE(1, ("Testing to verify that nothing is written if nothing is changed: This test is skipped on this system because the modification time from stat is the same as the last access time (We know OpenVMS behaves in this way).\n")); + MESSAGE(1, ("Testing to verify that nothing is written if nothing is changed: This test is skipped on this system because the modification time from stat is the same as the last access time.\n")); } /* end if */ else { hid_t file_id; /* HDF5 File ID */ @@ -2979,7 +2986,7 @@ test_filespace_sects(void) test_free_sections(fapl_sec2, filename); /* close fapl_sec2 and remove the file */ - h5_cleanup(FILENAME, fapl_sec2); + h5_clean_files(FILENAME, fapl_sec2); /* SPLIT */ @@ -2998,7 +3005,7 @@ test_filespace_sects(void) test_free_sections(fapl_split, filename); /* close fapl and remove the file */ - h5_cleanup(FILENAME, fapl_split); + h5_clean_files(FILENAME, fapl_split); /* STDIO */ @@ -3017,7 +3024,7 @@ test_filespace_sects(void) test_free_sections(fapl_stdio, filename); /* close fapl and remove the file */ - h5_cleanup(FILENAME, fapl_stdio); + h5_clean_files(FILENAME, fapl_stdio); /* CORE */ MESSAGE(5, ("Testing File free space information for a core file\n")); @@ -3035,7 +3042,7 @@ test_filespace_sects(void) test_free_sections(fapl_core, filename); /* close fapl_ and remove the file */ - h5_cleanup(FILENAME, fapl_core); + h5_clean_files(FILENAME, fapl_core); /* FAMILY */ @@ -3054,7 +3061,7 @@ test_filespace_sects(void) test_free_sections(fapl_family, filename); /* close fapl and remove the file */ - h5_cleanup(FILENAME, fapl_family); + h5_clean_files(FILENAME, fapl_family); } /* end test_filespace_sects() */ @@ -3113,67 +3120,68 @@ test_filespace_info(void) my_fapl = fapl; } /* end else */ - /* Test with different sized free space section threshold */ - for(fs_size = 0; fs_size <= TEST_THRESHOLD10; fs_size++) { + /* Test with different sized free space section threshold */ + for(fs_size = 0; fs_size <= TEST_THRESHOLD10; fs_size++) { - /* Test with different file space handling strategies */ - for(fs_type = 0; fs_type < H5F_FILE_SPACE_NTYPES; H5_INC_ENUM(H5F_file_space_type_t, fs_type)) { + /* Test with different file space handling strategies */ + for(fs_type = H5F_FILE_SPACE_DEFAULT; fs_type < H5F_FILE_SPACE_NTYPES; H5_INC_ENUM(H5F_file_space_type_t, fs_type)) { - /* Get a copy of the default file creation property */ - fcpl1 = H5Pcopy(fcpl); - CHECK(fcpl1, FAIL, "H5Pcopy"); + /* Get a copy of the default file creation property */ + fcpl1 = H5Pcopy(fcpl); + CHECK(fcpl1, FAIL, "H5Pcopy"); - /* Set file space strategy and free space section threshold */ - ret = H5Pset_file_space(fcpl1, fs_type, fs_size); - CHECK(ret, FAIL, "H5Pget_file_space"); + /* Set file space strategy and free space section threshold */ + ret = H5Pset_file_space(fcpl1, fs_type, fs_size); + CHECK(ret, FAIL, "H5Pget_file_space"); - /* Get the file space info from the creation property */ - ret = H5Pget_file_space(fcpl1, &strategy, &threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); + /* Get the file space info from the creation property */ + ret = H5Pget_file_space(fcpl1, &strategy, &threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); - /* A 0 value for strategy retains existing strategy in use */ - VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space"); - /* A 0 value for threshold retains existing threshold in use */ - VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space"); + /* A 0 value for strategy retains existing strategy in use */ + VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space"); + /* A 0 value for threshold retains existing threshold in use */ + VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space"); - /* Create the file with the specified file space info */ - fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl1, my_fapl); - CHECK(ret, FAIL, "H5Fcreate"); + /* Create the file with the specified file space info */ + fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl1, my_fapl); + CHECK(ret, FAIL, "H5Fcreate"); - /* Close the file */ - ret = H5Fclose(fid1); - CHECK(ret, FAIL, "H5Fclose"); + /* Close the file */ + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); - /* Re-open the file */ - fid2 = H5Fopen(filename, H5F_ACC_RDWR, my_fapl); - CHECK(ret, FAIL, "H5Fopen"); + /* Re-open the file */ + fid2 = H5Fopen(filename, H5F_ACC_RDWR, my_fapl); + CHECK(ret, FAIL, "H5Fopen"); - /* Get the file's creation property */ - fcpl2 = H5Fget_create_plist(fid2); - CHECK(fcpl2, FAIL, "H5Fget_create_plist"); + /* Get the file's creation property */ + fcpl2 = H5Fget_create_plist(fid2); + CHECK(fcpl2, FAIL, "H5Fget_create_plist"); - strategy = threshold = 0; + strategy = H5F_FILE_SPACE_DEFAULT; + threshold = 0; - /* Get the file space info from the creation property list */ - ret = H5Pget_file_space(fcpl2, &strategy, &threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); + /* Get the file space info from the creation property list */ + ret = H5Pget_file_space(fcpl2, &strategy, &threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space"); - VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space"); + VERIFY(strategy, (H5F_file_space_type_t)(fs_type ? fs_type : def_type), "H5Pget_file_space"); + VERIFY(threshold, (hsize_t)(fs_size ? fs_size : def_size), "H5Pget_file_space"); - /* Close the file */ - ret = H5Fclose(fid2); - CHECK(ret, FAIL, "H5Fclose"); + /* Close the file */ + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); - /* Release file-creation template */ - ret = H5Pclose(fcpl1); - CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pclose(fcpl2); - CHECK(ret, FAIL, "H5Pclose"); - } /* end for file space strategy type */ - } /* end for free space threshold */ + /* Release file-creation template */ + ret = H5Pclose(fcpl1); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(fcpl2); + CHECK(ret, FAIL, "H5Pclose"); + } /* end for file space strategy type */ + } /* end for free space threshold */ - h5_cleanup(FILESPACE_NAME, my_fapl); + h5_clean_files(FILESPACE_NAME, my_fapl); } /* end for new/old format */ @@ -3686,16 +3694,12 @@ test_file(void) test_file_freespace(); /* Test file free space information */ test_file_isaccessible(); /* Test detecting HDF5 files correctly */ test_file_open_dot(); /* Test opening objects with "." for a name */ -#ifndef H5_CANNOT_OPEN_TWICE test_file_open_overlap(); /* Test opening files in an overlapping manner */ -#endif /*H5_CANNOT_OPEN_TWICE*/ test_file_getname(); /* Test basic H5Fget_name() functionality */ -#ifndef H5_CANNOT_OPEN_TWICE test_file_double_root_open(); /* Test opening root group from two files works properly */ test_file_double_group_open(); /* Test opening same group from two files works properly */ test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */ test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */ -#endif /*H5_CANNOT_OPEN_TWICE*/ test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */ test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */ test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */ diff --git a/test/tgenprop.c b/test/tgenprop.c index 10cae6d..f35505f 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -21,7 +21,7 @@ * *************************************************************/ -#define H5P_PACKAGE /*suppress error about including H5Ppkg */ +#define H5P_FRIEND /*suppress error about including H5Ppkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5P_TESTING @@ -61,6 +61,18 @@ double prop4_def=1.41F; /* Property 4 default value */ #define PROP4_SIZE sizeof(prop4_def) #define PROP4_DEF_VALUE (&prop4_def) +/* Structs used during iteration */ +typedef struct iter_data_t { + int iter_count; + char **names; +} iter_data_t; + +typedef struct count_data_t { + int count; + hid_t id; +} count_data_t; + + /**************************************************************** ** ** test_genprop_basic_class(): Test basic generic property list code. @@ -284,17 +296,12 @@ test_genprop_basic_class_prop(void) ** ****************************************************************/ static int -test_genprop_iter1(hid_t id, const char *name, void *iter_data) +test_genprop_iter1(hid_t H5_ATTR_UNUSED id, const char *name, + void *iter_data) { - struct { /* Struct for iterations */ - int iter_count; - const char **names; - } *iter_struct = iter_data; - - /* Shut compiler up */ - id = id; + iter_data_t *idata = (iter_data_t *)iter_data; - return(HDstrcmp(name,iter_struct->names[iter_struct->iter_count++])); + return HDstrcmp(name,idata->names[idata->iter_count++]); } /**************************************************************** @@ -373,43 +380,34 @@ test_genprop_class_iter(void) static herr_t test_genprop_cls_crt_cb1(hid_t list_id, void *create_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=create_data; + count_data_t *cdata = (count_data_t *)create_data; - count_struct->count++; - count_struct->id=list_id; + cdata->count++; + cdata->id = list_id; - return(SUCCEED); + return SUCCEED; } static herr_t test_genprop_cls_cpy_cb1(hid_t new_list_id, hid_t H5_ATTR_UNUSED old_list_id, void *copy_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=copy_data; + count_data_t *cdata = (count_data_t *)copy_data; - count_struct->count++; - count_struct->id=new_list_id; + cdata->count++; + cdata->id = new_list_id; - return(SUCCEED); + return SUCCEED; } static herr_t test_genprop_cls_cls_cb1(hid_t list_id, void *create_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=create_data; + count_data_t *cdata = (count_data_t *)create_data; - count_struct->count++; - count_struct->id=list_id; + cdata->count++; + cdata->id = list_id; - return(SUCCEED); + return SUCCEED; } /**************************************************************** @@ -843,17 +841,12 @@ test_genprop_basic_list_prop(void) ** ****************************************************************/ static int -test_genprop_iter2(hid_t id, const char *name, void *iter_data) +test_genprop_iter2(hid_t H5_ATTR_UNUSED id, const char *name, + void *iter_data) { - struct { /* Struct for iterations */ - int iter_count; - const char **names; - } *iter_struct=iter_data; - - /* Shut compiler up */ - id=id; + iter_data_t *idata = (iter_data_t *)iter_data; - return(HDstrcmp(name,iter_struct->names[iter_struct->iter_count++])); + return HDstrcmp(name,idata->names[idata->iter_count++]); } /**************************************************************** @@ -995,15 +988,12 @@ prop_cb_info prop3_cb_info; /* Callback statistics for property #3 */ static herr_t test_genprop_cls_cpy_cb2(hid_t new_list_id, hid_t H5_ATTR_UNUSED old_list_id, void *create_data) { - struct { /* Struct for iterations */ - int count; - hid_t id; - } *count_struct=create_data; + count_data_t *cdata = (count_data_t *)create_data; - count_struct->count++; - count_struct->id=new_list_id; + cdata->count++; + cdata->id = new_list_id; - return(SUCCEED); + return SUCCEED; } /**************************************************************** diff --git a/test/th5o.c b/test/th5o.c index be3b4ab..40844fa 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -1355,9 +1355,7 @@ test_h5o(void) test_h5o_link(); /* Test object link routine */ test_h5o_comment(); /* Test routines for comment */ test_h5o_comment_by_name(); /* Test routines for comment by name */ -#ifndef H5_CANNOT_OPEN_TWICE /* OpenVMS can't open a file twice */ test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ -#endif /* H5_CANNOT_OPEN_TWICE */ } /* test_h5o() */ diff --git a/test/th5s.c b/test/th5s.c index 1560ef4..a478803 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -565,7 +565,7 @@ test_h5s_zero_dim(void) wdata_real[i][j][k] = i + j + k; /* Test with different space allocation times */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { /* Make sure we can create the space with the dimension size 0 (starting from v1.8.7). * The dimension doesn't need to be unlimited. */ @@ -2326,6 +2326,48 @@ test_h5s_extent_copy(void) /**************************************************************** ** +** test_h5s_bug1(): Test Creating dataspace with H5Screate then +* setting extent with H5Sextent_copy. +** +****************************************************************/ +static void +test_h5s_bug1(void) +{ + hid_t space1; /* Dataspace to copy extent to */ + hid_t space2; /* Scalar dataspace */ + hsize_t dims[2] = {10, 10}; /* Dimensions */ + hsize_t start[2] = {0, 0}; /* Hyperslab start */ + htri_t select_valid; /* Whether the dataspace selection is valid */ + herr_t ret; /* Generic error return */ + + /* Create dataspaces */ + space1 = H5Screate(H5S_SIMPLE); + CHECK(space1, FAIL, "H5Screate"); + space2 = H5Screate_simple(2, dims, NULL); + CHECK(space2, FAIL, "H5Screate"); + + /* Copy extent to space1 */ + ret = H5Sextent_copy(space1, space2); + CHECK(ret, FAIL, "H5Sextent_copy"); + + /* Select hyperslab in space1 containing entire extent */ + ret = H5Sselect_hyperslab(space1, H5S_SELECT_SET, start, NULL, dims, NULL); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Check that space1's selection is valid */ + select_valid = H5Sselect_valid(space1); + CHECK(select_valid, FAIL, "H5Sselect_valid"); + VERIFY(select_valid, TRUE, "H5Sselect_valid result"); + + /* Close dataspaces */ + ret = H5Sclose(space1); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Sclose(space2); + CHECK(ret, FAIL, "H5Sclose"); +} /* test_h5s_bug1() */ + +/**************************************************************** +** ** test_h5s(): Main H5S (dataspace) testing routine. ** ****************************************************************/ @@ -2350,6 +2392,7 @@ test_h5s(void) test_h5s_extent_equal(); /* Test extent comparison code */ test_h5s_extent_copy(); /* Test extent copy code */ + test_h5s_bug1(); /* Test bug in offset initialization */ } /* test_h5s() */ @@ -19,7 +19,7 @@ #include "hdf5.h" /* Include H5Ipkg.h to calculate max number of groups */ -#define H5I_PACKAGE +#define H5I_FRIEND /*suppress error about including H5Ipkg */ #include "H5Ipkg.h" /* Test basic functionality of registering and deleting types and IDs */ diff --git a/test/tmisc.c b/test/tmisc.c index 388ced1..61c6fdd 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -23,7 +23,7 @@ * *************************************************************/ -#define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5D_TESTING @@ -713,7 +713,7 @@ create_struct3(void) misc5_struct3_hndl *str3hndl; /* New 'struct3' created */ herr_t ret; /* For error checking */ - str3hndl = HDmalloc(sizeof(misc5_struct3_hndl)); + str3hndl = (misc5_struct3_hndl *)HDmalloc(sizeof(misc5_struct3_hndl)); CHECK(str3hndl,NULL,"malloc"); str3hndl->st3h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct3)); @@ -722,10 +722,10 @@ create_struct3(void) ret = H5Tinsert(str3hndl->st3h_base, "st3_el1", HOFFSET( misc5_struct3, st3_el1), H5T_NATIVE_INT); CHECK(ret,FAIL,"H5Tinsert"); - str3hndl->st3h_id=H5Tvlen_create(str3hndl->st3h_base); + str3hndl->st3h_id = H5Tvlen_create(str3hndl->st3h_base); CHECK(str3hndl->st3h_id,FAIL,"H5Tvlen_create"); - return(str3hndl); + return str3hndl; } static void @@ -733,10 +733,10 @@ delete_struct3(misc5_struct3_hndl *str3hndl) { herr_t ret; /* For error checking */ - ret=H5Tclose(str3hndl->st3h_id); + ret = H5Tclose(str3hndl->st3h_id); CHECK(ret,FAIL,"H5Tclose"); - ret=H5Tclose(str3hndl->st3h_base); + ret = H5Tclose(str3hndl->st3h_base); CHECK(ret,FAIL,"H5Tclose"); HDfree(str3hndl); @@ -756,7 +756,7 @@ create_struct2(void) misc5_struct2_hndl *str2hndl; /* New 'struct2' created */ herr_t ret; /* For error checking */ - str2hndl = HDmalloc(sizeof(misc5_struct2_hndl)); + str2hndl = (misc5_struct2_hndl *)HDmalloc(sizeof(misc5_struct2_hndl)); CHECK(str2hndl, NULL, "malloc"); str2hndl->st2h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct2)); @@ -765,16 +765,16 @@ create_struct2(void) ret = H5Tinsert(str2hndl->st2h_base, "st2_el1", HOFFSET(misc5_struct2, st2_el1), H5T_NATIVE_INT); CHECK(ret, FAIL, "H5Tinsert"); - str2hndl->st2h_st3hndl=create_struct3(); + str2hndl->st2h_st3hndl = create_struct3(); CHECK(str2hndl->st2h_st3hndl,NULL,"create_struct3"); - ret=H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2), str2hndl->st2h_st3hndl->st3h_id); + ret = H5Tinsert(str2hndl->st2h_base, "st2_el2", HOFFSET(misc5_struct2, st2_el2), str2hndl->st2h_st3hndl->st3h_id); CHECK(ret,FAIL,"H5Tinsert"); - str2hndl->st2h_id= H5Tvlen_create(str2hndl->st2h_base); + str2hndl->st2h_id = H5Tvlen_create(str2hndl->st2h_base); CHECK(str2hndl->st2h_id,FAIL,"H5Tvlen_create"); - return(str2hndl); + return str2hndl; } static void @@ -798,10 +798,10 @@ set_struct2(misc5_struct2 *buf) { unsigned i; /* Local index variable */ - buf->st2_el1=MISC5_DBGELVAL2; - buf->st2_el2.len=MISC5_DBGNELM3; + buf->st2_el1 = MISC5_DBGELVAL2; + buf->st2_el2.len = MISC5_DBGNELM3; - buf->st2_el2.p=HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3)); + buf->st2_el2.p = HDmalloc((buf->st2_el2.len)*sizeof(misc5_struct3)); CHECK(buf->st2_el2.p,NULL,"malloc"); for(i=0; i<(buf->st2_el2.len); i++) @@ -822,7 +822,7 @@ create_struct1(void) misc5_struct1_hndl *str1hndl; /* New 'struct1' created */ herr_t ret; /* For error checking */ - str1hndl = HDmalloc(sizeof(misc5_struct1_hndl)); + str1hndl = (misc5_struct1_hndl *)HDmalloc(sizeof(misc5_struct1_hndl)); CHECK(str1hndl, NULL, "malloc"); str1hndl->st1h_base = H5Tcreate(H5T_COMPOUND, sizeof(misc5_struct1)); @@ -834,13 +834,13 @@ create_struct1(void) str1hndl->st1h_st2hndl=create_struct2(); CHECK(str1hndl->st1h_st2hndl,NULL,"create_struct2"); - ret=H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2), str1hndl->st1h_st2hndl->st2h_id); + ret = H5Tinsert(str1hndl->st1h_base, "st1_el2", HOFFSET(misc5_struct1, st1_el2), str1hndl->st1h_st2hndl->st2h_id); CHECK(ret,FAIL,"H5Tinsert"); - str1hndl->st1h_id=H5Tvlen_create(str1hndl->st1h_base); + str1hndl->st1h_id = H5Tvlen_create(str1hndl->st1h_base); CHECK(str1hndl->st1h_id,FAIL,"H5Tvlen_create"); - return(str1hndl); + return str1hndl; } static void @@ -848,12 +848,12 @@ delete_struct1(misc5_struct1_hndl *str1hndl) { herr_t ret; /* For error checking */ - ret=H5Tclose(str1hndl->st1h_id); + ret = H5Tclose(str1hndl->st1h_id); CHECK(ret,FAIL,"H5Tclose"); delete_struct2(str1hndl->st1h_st2hndl); - ret=H5Tclose(str1hndl->st1h_base); + ret = H5Tclose(str1hndl->st1h_base); CHECK(ret,FAIL,"H5Tclose"); HDfree(str1hndl); @@ -1243,10 +1243,10 @@ test_misc8(void) MESSAGE(5, ("Testing dataset storage sizes\n")); /* Allocate space for the data to write & read */ - wdata=HDmalloc(sizeof(int)*MISC8_DIM0*MISC8_DIM1); + wdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1); CHECK(wdata,NULL,"malloc"); #ifdef VERIFY_DATA - rdata=HDmalloc(sizeof(int)*MISC8_DIM0*MISC8_DIM1); + rdata = (int *)HDmalloc(sizeof(int) * MISC8_DIM0 * MISC8_DIM1); CHECK(rdata,NULL,"malloc"); #endif /* VERIFY_DATA */ @@ -1254,7 +1254,7 @@ test_misc8(void) tdata=wdata; for(u=0; u<MISC8_DIM0; u++) for(v=0; v<MISC8_DIM1; v++) - *tdata++=((u*MISC8_DIM1)+v)%13; + *tdata++ = (int)(((u * MISC8_DIM1) + v) % 13); /* Create a file acccess property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); @@ -1310,7 +1310,7 @@ test_misc8(void) /* Check the storage size */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1336,7 +1336,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1361,7 +1361,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1405,7 +1405,7 @@ test_misc8(void) /* Check the storage size */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1432,7 +1432,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1462,7 +1462,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -1486,7 +1486,7 @@ test_misc8(void) /* Check the storage size after only four chunks are written */ storage_size = H5Dget_storage_size(did); - VERIFY(storage_size, 4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(4 * MISC8_CHUNK_DIM0 * MISC8_CHUNK_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Write entire dataset */ ret = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); @@ -1509,7 +1509,7 @@ test_misc8(void) /* Check the storage size after data is written */ storage_size = H5Dget_storage_size(did); CHECK(storage_size, 0, "H5Dget_storage_size"); - VERIFY(storage_size, MISC8_DIM0*MISC8_DIM1*H5Tget_size(H5T_NATIVE_INT), "H5Dget_storage_size"); + VERIFY(storage_size, (hsize_t)(MISC8_DIM0 * MISC8_DIM1 * H5Tget_size(H5T_NATIVE_INT)), "H5Dget_storage_size"); /* Close dataset ID */ ret = H5Dclose(did); @@ -2701,8 +2701,7 @@ test_misc16(void) { hid_t file; /* File ID */ herr_t ret; /* Generic return value */ - const char wdata[MISC16_SPACE_DIM][MISC16_STR_SIZE] = - {"1234567", "1234567\0", "12345678", {NULL}}; + char wdata[MISC16_SPACE_DIM][MISC16_STR_SIZE]; char rdata[MISC16_SPACE_DIM][MISC16_STR_SIZE]; /* Information read in */ hid_t dataset; /* Dataset ID */ hid_t sid; /* Dataspace ID */ @@ -2710,6 +2709,13 @@ test_misc16(void) hsize_t dims[] = {MISC16_SPACE_DIM}; int i; + /* Initialize the data */ + /* (Note that these are supposed to stress the code, so are a little weird) */ + HDmemcpy(wdata[0], "1234567", MISC16_STR_SIZE); + HDmemcpy(wdata[1], "1234567\0", MISC16_STR_SIZE); + HDmemcpy(wdata[2], "12345678", MISC16_STR_SIZE); + HDmemcpy(wdata[3], "\0\0\0\0\0\0\0\0", MISC16_STR_SIZE); + /* Create the file */ file = H5Fcreate(MISC16_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file, FAIL, "H5Fcreate"); @@ -2743,11 +2749,11 @@ test_misc16(void) /* Compare data read in */ for(i = 0; i < MISC16_SPACE_DIM; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(unsigned)__LINE__, (int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { - TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(unsigned)__LINE__, (int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ @@ -2780,8 +2786,7 @@ test_misc17(void) { hid_t file; /* File ID */ herr_t ret; /* Generic return value */ - const char wdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2] = - {"1234567", "1234567\0", "12345678", {NULL}}; + char wdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2]; char rdata[MISC17_SPACE_DIM1][MISC17_SPACE_DIM2]; /* Information read in */ hid_t dataset; /* Dataset ID */ hid_t sid; /* Dataspace ID */ @@ -2789,6 +2794,13 @@ test_misc17(void) hsize_t dims[] = {MISC17_SPACE_DIM1, MISC17_SPACE_DIM2}; int i; + /* Initialize the data */ + /* (Note that these are supposed to stress the code, so are a little weird) */ + HDmemcpy(wdata[0], "1234567", MISC17_SPACE_DIM2); + HDmemcpy(wdata[1], "1234567\0", MISC17_SPACE_DIM2); + HDmemcpy(wdata[2], "12345678", MISC17_SPACE_DIM2); + HDmemcpy(wdata[3], "\0\0\0\0\0\0\0\0", MISC17_SPACE_DIM2); + /* Create the file */ file = H5Fcreate(MISC17_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file, FAIL, "H5Fcreate"); @@ -2819,11 +2831,11 @@ test_misc17(void) /* Compare data in the way of strings. */ for(i = 0; i < MISC17_SPACE_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { - TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); + TestErrPrintf("Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(unsigned)__LINE__, (int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i])); continue; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { - TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]); + TestErrPrintf("Line %u: VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(unsigned)__LINE__, (int)i,wdata[i],(int)i,rdata[i]); continue; } /* end if */ } /* end for */ @@ -3782,6 +3794,7 @@ test_misc23(void) char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */ H5O_info_t oinfo; htri_t tri_status; + ssize_t namelen; herr_t status; /* Output message about test being performed */ @@ -3851,8 +3864,8 @@ test_misc23(void) CHECK(tmp_id, FAIL, "H5Gcreate2"); /* Query that the name of the new group is correct */ - status = H5Iget_name(tmp_id, objname, (size_t)MISC23_NAME_BUF_SIZE); - CHECK(status, FAIL, "H5Iget_name"); + namelen = H5Iget_name(tmp_id, objname, (size_t)MISC23_NAME_BUF_SIZE); + CHECK(namelen, FAIL, "H5Iget_name"); VERIFY_STR(objname, "/A/B01/grp", "H5Iget_name"); status = H5Gclose(tmp_id); @@ -4991,7 +5004,7 @@ test_misc28(void) /* Initialize write buffer */ for(i=0; i<MISC28_SIZE; i++) - buf[i] = i; + buf[i] = (char)i; /* Create memory dataspace and selection in file dataspace */ sidm = H5Screate_simple(1, mdims, NULL); @@ -5012,7 +5025,7 @@ test_misc28(void) /* Initialize write buffer */ for(i=0; i<MISC28_SIZE; i++) - buf[i] = MISC28_SIZE - 1 - i; + buf[i] = (char)(MISC28_SIZE - 1 - i); /* Select new hyperslab */ start[1] = 1; diff --git a/test/tselect.c b/test/tselect.c index bdcdb2b..d6b1e8f 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -21,7 +21,7 @@ * *************************************************************/ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ +#define H5S_FRIEND /*suppress error about including H5Spkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5S_TESTING diff --git a/test/tsohm.c b/test/tsohm.c index 9da655e..b3ffac7 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -27,7 +27,7 @@ * This file needs to access private information from the H5F package. * This file also needs to access the file testing code. */ -#define H5F_PACKAGE +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ @@ -1279,7 +1279,7 @@ static void size2_verify_plist1(hid_t plist) CHECK_I(ret, "H5Pget_fill_value"); ret = memcmp(&fill1, &fill1_correct, sizeof(fill1_correct)); - VERIFY(ret, 0, memcmp); + VERIFY(ret, 0, "memcmp"); ret = H5Tclose(dtype1_id); CHECK_I(ret, "H5Tclose"); @@ -1350,7 +1350,7 @@ static void size2_verify_plist2(hid_t plist) CHECK_I(ret, "H5Pget_fill_value"); ret = HDmemcmp(&fill2, &fill2_correct, (size_t)DTYPE2_SIZE); - VERIFY(ret, 0, memcmp); + VERIFY(ret, 0, "memcmp"); ret = H5Tclose(dtype2_id); CHECK_I(ret, "H5Tclose"); @@ -3988,10 +3988,7 @@ test_sohm(void) test_sohm_delete(); /* Test deleting shared messages */ test_sohm_delete_revert(); /* Test that a file with SOHMs becomes an * empty file again when they are deleted. */ -#ifndef H5_CANNOT_OPEN_TWICE /* On VMS this test fails since it tries to - open target file the second time */ test_sohm_extlink(); /* Test SOHMs when external links are used */ -#endif /* H5_CANNOT_OPEN_TWICE */ test_sohm_extend_dset(); /* Test extending shared datasets */ test_sohm_external_dtype(); /* Test using datatype in another file */ diff --git a/test/ttsafe.c b/test/ttsafe.c index d0ab81a..d3c5cfb 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -40,13 +40,6 @@ /* ANY new test needs to have a prototype in ttsafe.h */ #include "ttsafe.h" -#ifndef H5_HAVE_THREADSAFE -int main(void) -{ - printf("Test skipped because THREADSAFE not enabled\n"); - return 0; -} -#else #define MAX_NUM_NAME 1000 #define NAME_OFFSET 6 /* offset for "name<num>" */ @@ -66,6 +59,30 @@ num_digits(int num) return u; } +/* Test the H5is_library_threadsafe() function */ +void +tts_is_threadsafe(void) +{ + hbool_t is_ts; + hbool_t should_be; + +#ifdef H5_HAVE_THREADSAFE + is_ts = FALSE; + should_be = TRUE; +#else /* H5_HAVE_THREADSAFE */ + is_ts = TRUE; + should_be = FALSE; +#endif /* H5_HAVE_THREADSAFE */ + + if(H5is_library_threadsafe(&is_ts) != SUCCEED) + TestErrPrintf("H5_is_library_threadsafe() call failed - test failed\n"); + + if(is_ts != should_be) + TestErrPrintf("Thread-safety value incorrect - test failed\n"); + + return; +} + /* Routine to generate attribute names for numeric values */ char *gen_name(int value) { @@ -88,10 +105,13 @@ char *gen_name(int value) int main(int argc, char *argv[]) { + /* Initialize testing framework */ TestInit(argv[0], NULL, NULL); /* Tests are generally arranged from least to most complexity... */ + AddTest("is_threadsafe", tts_is_threadsafe, NULL, "library threadsafe status", NULL); +#ifdef H5_HAVE_THREADSAFE AddTest("dcreate", tts_dcreate, cleanup_dcreate, "multi-dataset creation", NULL); AddTest("error", tts_error, cleanup_error, "per-thread error stacks", NULL); #ifdef H5_HAVE_PTHREAD_H @@ -100,6 +120,12 @@ int main(int argc, char *argv[]) #endif /* H5_HAVE_PTHREAD_H */ AddTest("acreate", tts_acreate, cleanup_acreate, "multi-attribute creation", NULL); +#else /* H5_HAVE_THREADSAFE */ + + printf("Most thread-safety tests skipped because THREADSAFE not enabled\n"); + +#endif /* H5_HAVE_THREADSAFE */ + /* Display testing information */ TestInfo(argv[0]); @@ -118,5 +144,6 @@ int main(int argc, char *argv[]) TestCleanup(); return GetTestNumErrs(); + } /* end main() */ -#endif /*H5_HAVE_THREADSAFE*/ + diff --git a/test/ttsafe.h b/test/ttsafe.h index b4826fc..f2e9e86 100644 --- a/test/ttsafe.h +++ b/test/ttsafe.h @@ -20,8 +20,6 @@ #ifndef TTSAFE_H #define TTSAFE_H -#include <string.h> - /* * Include required headers. This file tests internal library functions, * so we include the private headers here. @@ -31,16 +29,13 @@ #include "H5Eprivate.h" #include "testhdf5.h" -#ifdef H5_HAVE_THREADSAFE -/* Include pthread library for threadsafe tests */ -#ifdef H5_HAVE_PTHREAD_H -#include <pthread.h> -#endif /* H5_HAVE_PTHREAD_H */ /* Prototypes for the support routines */ extern char* gen_name(int); /* Prototypes for the test routines */ +void tts_is_threadsafe(void); +#ifdef H5_HAVE_THREADSAFE void tts_dcreate(void); void tts_error(void); void tts_cancel(void); @@ -54,3 +49,4 @@ void cleanup_acreate(void); #endif /* H5_HAVE_THREADSAFE */ #endif /* TTSAFE_H */ + diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index acf5592..4bc2c3c 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -237,3 +237,4 @@ void cleanup_error(void) } #endif /*H5_HAVE_THREADSAFE*/ + diff --git a/test/ttst.c b/test/ttst.c index 4ffe4cd..b869b63 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -95,13 +95,13 @@ test_tst_init(void) } /* end for */ /* Allocate space for the array of unique words */ - uniq_words=HDmalloc(sizeof(char *)*num_uniq_words); + uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words); /* Allocate space for the array of randomized order unique words also */ - rand_uniq_words=HDmalloc(sizeof(char *)*num_uniq_words); + rand_uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words); /* Allocate space for the array of sorted order unique words also */ - sort_uniq_words=HDmalloc(sizeof(char *)*num_uniq_words); + sort_uniq_words = (char **)HDmalloc(sizeof(char *)*num_uniq_words); /* Insert unique words from test set into unique word set */ w=0; diff --git a/test/tvltypes.c b/test/tvltypes.c index d1a4235..b7bbaee 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -1021,7 +1021,7 @@ test_vltypes_compound_vlen_vlen(void) wdata[i].f=(float)((i*20)/3.0F); wdata[i].v.p=HDmalloc((i+L1_INCM)*sizeof(hvl_t)); wdata[i].v.len=i+L1_INCM; - for(t1=(wdata[i].v).p,j=0; j<(i+L1_INCM); j++, t1++) { + for(t1=(hvl_t *)((wdata[i].v).p),j=0; j<(i+L1_INCM); j++, t1++) { t1->p=HDmalloc((j+L2_INCM)*sizeof(unsigned int)); t1->len=j+L2_INCM; for(k=0; k<j+L2_INCM; k++) @@ -1102,7 +1102,7 @@ test_vltypes_compound_vlen_vlen(void) continue; } /* end if */ - for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; j<rdata[i].v.len; j++, t1++, t2++) { + for(t1=(hvl_t *)(wdata[i].v.p), t2=(hvl_t *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) { if(t1->len != t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -1161,13 +1161,13 @@ static void test_vltypes_compound_vlstr(void) { typedef enum { - red, - blue, - green + red, + blue, + green } e1; typedef struct { char *string; - e1 color; + e1 color; } s2; typedef struct { /* Struct that the compound type are composed of */ hvl_t v; @@ -1199,12 +1199,12 @@ test_vltypes_compound_vlstr(void) for(i=0; i<SPACE1_DIM1; i++) { wdata[i].v.p=(s2*)HDmalloc((i+L3_INCM)*sizeof(s2)); wdata[i].v.len=i+L3_INCM; - for(t1=(wdata[i].v).p, j=0; j<(i+L3_INCM); j++, t1++) { - strcat(str, "m"); - t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1); + for(t1=(s2 *)((wdata[i].v).p), j=0; j<(i+L3_INCM); j++, t1++) { + strcat(str, "m"); + t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1); strcpy(t1->string, str); - /*t1->color = red;*/ - t1->color = blue; + /*t1->color = red;*/ + t1->color = blue; } } /* end for */ @@ -1342,7 +1342,7 @@ test_vltypes_compound_vlstr(void) continue; } /* end if */ - for(t1=wdata[i].v.p, t2=rdata[i].v.p, j=0; j<rdata[i].v.len; j++, t1++, t2++) { + for(t1=(s2 *)(wdata[i].v.p), t2=(s2 *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) { if( strcmp(t1->string, t2->string) ) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; @@ -1400,7 +1400,7 @@ test_vltypes_compound_vlstr(void) continue; } /* end if */ - for(t1=wdata2[i].v.p, t2=rdata2[i].v.p, j=0; j<rdata2[i].v.len; j++, t1++, t2++) { + for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; j<rdata2[i].v.len; j++, t1++, t2++) { if( strcmp(t1->string, t2->string) ) { TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string); continue; @@ -1871,7 +1871,7 @@ test_vltypes_vlen_vlen_atomic(void) return; } /* end if */ wdata[i].len=i+1; - for(t1=wdata[i].p,j=0; j<(i+1); j++, t1++) { + for(t1=(hvl_t *)(wdata[i].p),j=0; j<(i+1); j++, t1++) { t1->p=HDmalloc((j+1)*sizeof(unsigned int)); if(t1->p==NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); @@ -1977,7 +1977,7 @@ test_vltypes_vlen_vlen_atomic(void) TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { + for(t1=(hvl_t *)wdata[i].p, t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len!=t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -2062,7 +2062,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) return; } /* end if */ wdata[i].len = i + increment; - for(t1 = wdata[i].p, j = 0; j < (i + increment); j++, t1++) { + for(t1 = (hvl_t *)(wdata[i].p), j = 0; j < (i + increment); j++, t1++) { t1->p = HDmalloc((j + 1) * sizeof(unsigned int)); if(t1->p == NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n", i, j); @@ -2157,7 +2157,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { + for(t1=(hvl_t *)(wdata[i].p), t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len!=t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -2238,7 +2238,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) return; } /* end if */ wdata[i].len=i+increment; - for(t1=wdata[i].p,j=0; j<(i+increment); j++, t1++) { + for(t1=(hvl_t *)(wdata[i].p),j=0; j<(i+increment); j++, t1++) { t1->p=HDmalloc((j+1)*sizeof(unsigned int)); if(t1->p==NULL) { TestErrPrintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); @@ -2333,7 +2333,7 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void) TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { + for(t1=(hvl_t *)(wdata[i].p), t2=(hvl_t *)(rdata[i].p), j=0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len!=t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; @@ -2496,7 +2496,7 @@ test_vltypes_fill_value(void) /* Allocate space for the buffer to read data */ - rbuf = HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct)); + rbuf = (dtype1_struct *)HDmalloc(SPACE4_DIM_LARGE * sizeof(dtype1_struct)); CHECK(rbuf, NULL, "HDmalloc"); @@ -2538,7 +2538,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fcreate"); /* Create datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2597,6 +2597,8 @@ test_vltypes_fill_value(void) } break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: assert(0 && "Unknown layout type!"); break; @@ -2648,7 +2650,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fopen"); /* Read empty datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2698,6 +2700,8 @@ test_vltypes_fill_value(void) dset_elmts = SPACE4_DIM_LARGE; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: assert(0 && "Unknown layout type!"); break; @@ -2843,7 +2847,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fopen"); /* Write one element & fill values to datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2893,6 +2897,8 @@ test_vltypes_fill_value(void) dset_elmts = SPACE4_DIM_LARGE; break; + case H5D_LAYOUT_ERROR: + case H5D_NLAYOUTS: default: assert(0 && "Unknown layout type!"); break; diff --git a/test/unlink.c b/test/unlink.c index 993a7ec..c091281 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -20,7 +20,7 @@ * Purpose: Test unlinking operations. */ -#define H5G_PACKAGE /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5G_TESTING @@ -80,15 +80,17 @@ const char *FILENAME[] = { static herr_t test_sec2(void) { - hid_t file = -1; - hid_t fapl = -1; - hid_t access_fapl = -1; + hid_t file = -1; + hid_t fapl = -1; + hid_t access_fapl = -1; char filename[1024]; int *fhandle = NULL; hsize_t file_size = 0; TESTING("SEC2 file driver"); + h5_reset(); + /* Set property list and file name for SEC2 driver. */ fapl = h5_fileaccess(); if(H5Pset_fapl_sec2(fapl) < 0) @@ -145,103 +147,103 @@ error: return -1; } - /*------------------------------------------------------------------------- - * Function: test_direct + * Function: test_core * - * Purpose: Tests the file handle interface for DIRECT I/O driver + * Purpose: Tests the file handle interface for CORE driver * * Return: Success: 0 * Failure: -1 * * Programmer: Raymond Lu - * Wednesday, 20 September 2006 + * Tuesday, Sept 24, 2002 * *------------------------------------------------------------------------- */ static herr_t -test_direct(void) +test_core(void) { -#ifdef H5_HAVE_DIRECT hid_t file=(-1), fapl, access_fapl = -1; - hid_t dset1=-1, dset2=-1, space1=-1, space2=-1; char filename[1024]; - int *fhandle=NULL; + void *fhandle=NULL; hsize_t file_size; - hsize_t dims1[2], dims2[1]; - size_t mbound; - size_t fbsize; - size_t cbsize; + hbool_t use_write_tracking; + size_t write_tracking_page_size; int *points = NULL, *check = NULL, *p1, *p2; - int wdata2[DSET2_DIM] = {11,12,13,14}; - int rdata2[DSET2_DIM]; + hid_t dset1=-1, space1=-1; + hsize_t dims1[2]; int i, j, n; -#endif /*H5_HAVE_DIRECT*/ - TESTING("DIRECT I/O file driver"); + TESTING("CORE file driver"); -#ifndef H5_HAVE_DIRECT - SKIPPED(); - return 0; -#else /*H5_HAVE_DIRECT*/ + h5_reset(); - /* Set property list and file name for Direct driver. Set memory alignment boundary - * and file block size to 512 which is the minimum for Linux 2.6. */ + /* Set property list and file name for CORE driver */ fapl = h5_fileaccess(); - if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0) - TEST_ERROR; - h5_fixname(FILENAME[5], fapl, filename, sizeof filename); - - /* Verify the file access properties */ - if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0) + if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR; - if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE) + if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0) TEST_ERROR; + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0) + if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; - H5E_BEGIN_TRY { - file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - } H5E_END_TRY; - if(file<0) { - H5Pclose (fapl); - SKIPPED(); - printf(" Probably the file system doesn't support Direct I/O\n"); - return 0; - } - /* Retrieve the access property list... */ if ((access_fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR; /* Check that the driver is correct */ - if(H5FD_DIRECT != H5Pget_driver(access_fapl)) + if(H5FD_CORE != H5Pget_driver(access_fapl)) TEST_ERROR; - /* Check file handle API */ - if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) + /* Check that the backing store write tracking info was saved */ + if(H5Pget_core_write_tracking(fapl, &use_write_tracking, &write_tracking_page_size) < 0) TEST_ERROR; - if(*fhandle<0) + if(TRUE != use_write_tracking) + TEST_ERROR; + if(CORE_PAGE_SIZE != write_tracking_page_size) TEST_ERROR; + /* ...and close the property list */ + if (H5Pclose(access_fapl) < 0) + TEST_ERROR; + + if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle) < 0) + TEST_ERROR; + if(fhandle==NULL) + { + printf("fhandle==NULL\n"); + TEST_ERROR; + } + /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) TEST_ERROR; - /* There is no guarantee of the number of metadata allocations, but it's - * 4 currently and the size of the file should be between 3 & 4 file buffer - * sizes.. + /* There is no garantee the size of metadata in file is constant. + * Just try to check if it's reasonable. Why is this 4KB? */ - if(file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4)) + if(file_size<2*KB || file_size>6*KB) TEST_ERROR; - /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including - * memory address, size of data, and file address. */ - if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + if(H5Fclose(file) < 0) TEST_ERROR; - if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + + + /* Open the file with backing store off for read and write. + * Changes won't be saved in file. */ + if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0) + TEST_ERROR; + + if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR; + + /* Allocate memory for data set. */ + if(NULL == (points = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + TEST_ERROR; + if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; /* Initialize the dset1 */ @@ -284,47 +286,70 @@ test_direct(void) printf(" Read different values than written in data set 1.\n"); printf(" At index %d,%d\n", i, j); TEST_ERROR; - } /* end if */ + } /* end if */ - /* Create the data space2. For data set 2, memory address and data size are not aligned. */ - dims2[0] = DSET2_DIM; - if((space2 = H5Screate_simple(1, dims2, NULL)) < 0) + if(H5Dclose(dset1) < 0) TEST_ERROR; - /* Create the dset2 */ - if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if(H5Fclose(file) < 0) + TEST_ERROR; + + /* Open the file with backing store on for read and write. + * Changes will be saved in file. */ + if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) + TEST_ERROR; + + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR; + + /* Create the dset1 */ + if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0) + if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR; - if(H5Dclose(dset2) < 0) + if(H5Dclose(dset1) < 0) TEST_ERROR; - if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0) + if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Reallocate memory for reading buffer. */ + HDassert(check); + HDfree(check); + if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; /* Read the data back from dset1 */ - if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) + if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ - for(i = 0; i < DSET2_DIM; i++) - if(wdata2[i] != rdata2[i]) { - H5_FAILED(); - printf(" Read different values than written in data set 2.\n"); - printf(" At index %d\n", i); - TEST_ERROR; - } /* end if */ + p1 = points; + p2 = check; + for(i = 0; i < DSET1_DIM1; i++) + for(j = 0; j < DSET1_DIM2; j++) + if(*p1++ != *p2++) { + H5_FAILED(); + printf(" Read different values than written in data set 1.\n"); + printf(" At index %d,%d\n", i, j); + TEST_ERROR; + } /* end if */ - if(H5Sclose(space1) < 0) + /* Check file size API */ + if(H5Fget_filesize(file, &file_size) < 0) TEST_ERROR; - if(H5Dclose(dset1) < 0) + + /* There is no garantee the size of metadata in file is constant. + * Just try to check if it's reasonable. */ + if(file_size<64*KB || file_size>256*KB) TEST_ERROR; - if(H5Sclose(space2) < 0) + + if(H5Sclose(space1) < 0) TEST_ERROR; - if(H5Dclose(dset2) < 0) + if(H5Dclose(dset1) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; @@ -333,25 +358,14 @@ test_direct(void) HDassert(check); HDfree(check); - /* Verify that the file is an HDF5 file */ - if(H5Fis_accessible(filename, access_fapl) != TRUE) - TEST_ERROR; - - /* ...and close the property list */ - if(H5Pclose(access_fapl) < 0) - TEST_ERROR; - h5_cleanup(FILENAME, fapl); + PASSED(); return 0; error: H5E_BEGIN_TRY { H5Pclose(fapl); - H5Sclose(space1); - H5Dclose(dset1); - H5Sclose(space2); - H5Dclose(dset2); H5Fclose(file); } H5E_END_TRY; @@ -361,111 +375,110 @@ error: HDfree(check); return -1; -#endif /*H5_HAVE_DIRECT*/ } /*------------------------------------------------------------------------- - * Function: test_core + * Function: test_direct * - * Purpose: Tests the file handle interface for CORE driver + * Purpose: Tests the file handle interface for DIRECT I/O driver * * Return: Success: 0 * Failure: -1 * * Programmer: Raymond Lu - * Tuesday, Sept 24, 2002 + * Wednesday, 20 September 2006 * *------------------------------------------------------------------------- */ static herr_t -test_core(void) +test_direct(void) { +#ifdef H5_HAVE_DIRECT hid_t file=(-1), fapl, access_fapl = -1; + hid_t dset1=-1, dset2=-1, space1=-1, space2=-1; char filename[1024]; - void *fhandle=NULL; + int *fhandle=NULL; hsize_t file_size; - hbool_t use_write_tracking; - size_t write_tracking_page_size; + hsize_t dims1[2], dims2[1]; + size_t mbound; + size_t fbsize; + size_t cbsize; int *points = NULL, *check = NULL, *p1, *p2; - hid_t dset1=-1, space1=-1; - hsize_t dims1[2]; + int wdata2[DSET2_DIM] = {11,12,13,14}; + int rdata2[DSET2_DIM]; int i, j, n; +#endif /*H5_HAVE_DIRECT*/ - TESTING("CORE file driver"); + TESTING("DIRECT I/O file driver"); - /* Set property list and file name for CORE driver */ +#ifndef H5_HAVE_DIRECT + SKIPPED(); + return 0; +#else /*H5_HAVE_DIRECT*/ + + h5_reset(); + + /* Set property list and file name for Direct driver. Set memory alignment boundary + * and file block size to 512 which is the minimum for Linux 2.6. */ fapl = h5_fileaccess(); - if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) + if(H5Pset_fapl_direct(fapl, MBOUNDARY, FBSIZE, CBSIZE) < 0) TEST_ERROR; - if(H5Pset_core_write_tracking(fapl, TRUE, CORE_PAGE_SIZE) < 0) + h5_fixname(FILENAME[5], fapl, filename, sizeof filename); + + /* Verify the file access properties */ + if(H5Pget_fapl_direct(fapl, &mbound, &fbsize, &cbsize) < 0) + TEST_ERROR; + if(mbound != MBOUNDARY || fbsize != FBSIZE || cbsize != CBSIZE) TEST_ERROR; - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if(H5Pset_alignment(fapl, (hsize_t)THRESHOLD, (hsize_t)FBSIZE) < 0) TEST_ERROR; + H5E_BEGIN_TRY { + file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + } H5E_END_TRY; + if(file<0) { + H5Pclose (fapl); + SKIPPED(); + printf(" Probably the file system doesn't support Direct I/O\n"); + return 0; + } + /* Retrieve the access property list... */ if ((access_fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR; /* Check that the driver is correct */ - if(H5FD_CORE != H5Pget_driver(access_fapl)) - TEST_ERROR; - - /* Check that the backing store write tracking info was saved */ - if(H5Pget_core_write_tracking(fapl, &use_write_tracking, &write_tracking_page_size) < 0) - TEST_ERROR; - if(TRUE != use_write_tracking) - TEST_ERROR; - if(CORE_PAGE_SIZE != write_tracking_page_size) + if(H5FD_DIRECT != H5Pget_driver(access_fapl)) TEST_ERROR; /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) TEST_ERROR; - if(H5Fget_vfd_handle(file, H5P_DEFAULT, &fhandle) < 0) + /* Check file handle API */ + if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) + TEST_ERROR; + if(*fhandle<0) TEST_ERROR; - if(fhandle==NULL) - { - printf("fhandle==NULL\n"); - TEST_ERROR; - } /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) TEST_ERROR; - /* There is no garantee the size of metadata in file is constant. - * Just try to check if it's reasonable. Why is this 4KB? + /* There is no guarantee of the number of metadata allocations, but it's + * 4 currently and the size of the file should be between 3 & 4 file buffer + * sizes.. */ - if(file_size<2*KB || file_size>6*KB) - TEST_ERROR; - - if(H5Fclose(file) < 0) - TEST_ERROR; - - /* Verify that the file is an HDF5 file */ - if(H5Fis_accessible(filename, fapl) != TRUE) - TEST_ERROR; - - /* Open the file with backing store off for read and write. - * Changes won't be saved in file. */ - if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, FALSE) < 0) - TEST_ERROR; - - /* Verify that the file is an HDF5 file */ - if(H5Fis_accessible(filename, fapl) != TRUE) - TEST_ERROR; - - if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if(file_size < (FBSIZE * 3) || file_size >= (FBSIZE * 4)) TEST_ERROR; - /* Allocate memory for data set. */ - if(NULL == (points = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + /* Allocate aligned memory for data set 1. For data set 1, everything is aligned including + * memory address, size of data, and file address. */ + if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; - if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) TEST_ERROR; /* Initialize the dset1 */ @@ -508,75 +521,48 @@ test_core(void) printf(" Read different values than written in data set 1.\n"); printf(" At index %d,%d\n", i, j); TEST_ERROR; - } /* end if */ - - if(H5Dclose(dset1) < 0) - TEST_ERROR; - - if(H5Fclose(file) < 0) - TEST_ERROR; - - /* Verify that the file is an HDF5 file */ - if(H5Fis_accessible(filename, fapl) != TRUE) - TEST_ERROR; - - /* Open the file with backing store on for read and write. - * Changes will be saved in file. */ - if(H5Pset_fapl_core(fapl, (size_t)CORE_INCREMENT, TRUE) < 0) - TEST_ERROR; + } /* end if */ - if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + /* Create the data space2. For data set 2, memory address and data size are not aligned. */ + dims2[0] = DSET2_DIM; + if((space2 = H5Screate_simple(1, dims2, NULL)) < 0) TEST_ERROR; - /* Create the dset1 */ - if((dset1 = H5Dcreate2(file, DSET1_NAME, H5T_NATIVE_INT, space1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Create the dset2 */ + if((dset2 = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, space2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Write the data to the dset1 */ - if(H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) - TEST_ERROR; - - if(H5Dclose(dset1) < 0) + if(H5Dwrite(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata2) < 0) TEST_ERROR; - if((dset1 = H5Dopen2(file, DSET1_NAME, H5P_DEFAULT)) < 0) + if(H5Dclose(dset2) < 0) TEST_ERROR; - /* Reallocate memory for reading buffer. */ - HDassert(check); - HDfree(check); - if(NULL == (check = (int *)HDmalloc(DSET1_DIM1 * DSET1_DIM2 * sizeof(int)))) + if((dset2 = H5Dopen2(file, DSET2_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Read the data back from dset1 */ - if(H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) + if(H5Dread(dset2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ - p1 = points; - p2 = check; - for(i = 0; i < DSET1_DIM1; i++) - for(j = 0; j < DSET1_DIM2; j++) - if(*p1++ != *p2++) { - H5_FAILED(); - printf(" Read different values than written in data set 1.\n"); - printf(" At index %d,%d\n", i, j); - TEST_ERROR; - } /* end if */ - - /* Check file size API */ - if(H5Fget_filesize(file, &file_size) < 0) - TEST_ERROR; - - /* There is no garantee the size of metadata in file is constant. - * Just try to check if it's reasonable. */ - if(file_size<64*KB || file_size>256*KB) - TEST_ERROR; + for(i = 0; i < DSET2_DIM; i++) + if(wdata2[i] != rdata2[i]) { + H5_FAILED(); + printf(" Read different values than written in data set 2.\n"); + printf(" At index %d\n", i); + TEST_ERROR; + } /* end if */ if(H5Sclose(space1) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR; + if(H5Sclose(space2) < 0) + TEST_ERROR; + if(H5Dclose(dset2) < 0) + TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; HDassert(points); @@ -585,13 +571,16 @@ test_core(void) HDfree(check); h5_cleanup(FILENAME, fapl); - PASSED(); return 0; error: H5E_BEGIN_TRY { H5Pclose(fapl); + H5Sclose(space1); + H5Dclose(dset1); + H5Sclose(space2); + H5Dclose(dset2); H5Fclose(file); } H5E_END_TRY; @@ -601,6 +590,7 @@ error: HDfree(check); return -1; +#endif /*H5_HAVE_DIRECT*/ } @@ -723,6 +713,8 @@ test_family(void) TESTING("FAMILY file driver"); + h5_reset(); + /* Set property list and file name for FAMILY driver */ fapl = h5_fileaccess(); @@ -888,6 +880,8 @@ test_family_compat(void) TESTING("FAMILY file driver backward compatibility"); + h5_reset(); + /* Set property list and file name for FAMILY driver */ fapl = h5_fileaccess(); @@ -1032,6 +1026,9 @@ test_multi(void) int buf[MULTI_SIZE][MULTI_SIZE]; TESTING("MULTI file driver"); + + h5_reset(); + /* Set file access property list for MULTI driver */ fapl = h5_fileaccess(); @@ -1248,6 +1245,8 @@ test_multi_compat(void) TESTING("MULTI file driver backward compatibility"); + h5_reset(); + /* Set file access property list for MULTI driver */ fapl = h5_fileaccess(); @@ -1407,6 +1406,8 @@ test_log(void) TESTING("LOG file driver"); + h5_reset(); + /* Set property list and file name for log driver. */ fapl = h5_fileaccess(); if(H5Pset_fapl_log(fapl, LOG_FILENAME, flags, buf_size) < 0) @@ -1490,6 +1491,8 @@ test_stdio(void) TESTING("STDIO file driver"); + h5_reset(); + /* Set property list and file name for STDIO driver. */ fapl = h5_fileaccess(); if(H5Pset_fapl_stdio(fapl) < 0) @@ -1584,6 +1587,8 @@ test_windows(void) #else /* H5_HAVE_WINDOWS */ + h5_reset(); + /* Set property list and file name for WINDOWS driver. */ fapl = h5_fileaccess(); if(H5Pset_fapl_windows(fapl) < 0) @@ -1662,25 +1667,23 @@ main(void) { int nerrors = 0; - h5_reset(); - printf("Testing basic Virtual File Driver functionality.\n"); nerrors += test_sec2() < 0 ? 1 : 0; nerrors += test_core() < 0 ? 1 : 0; + nerrors += test_direct() < 0 ? 1 : 0; nerrors += test_family() < 0 ? 1 : 0; nerrors += test_family_compat() < 0 ? 1 : 0; nerrors += test_multi() < 0 ? 1 : 0; nerrors += test_multi_compat() < 0 ? 1 : 0; - nerrors += test_direct() < 0 ? 1 : 0; nerrors += test_log() < 0 ? 1 : 0; nerrors += test_stdio() < 0 ? 1 : 0; nerrors += test_windows() < 0 ? 1 : 0; if(nerrors) { - printf("***** %d Virtual File Driver TEST%s FAILED! *****\n", - nerrors, nerrors > 1 ? "S" : ""); - return 1; + printf("***** %d Virtual File Driver TEST%s FAILED! *****\n", + nerrors, nerrors > 1 ? "S" : ""); + return 1; } printf("All Virtual File Driver tests passed.\n"); |