diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 59 | ||||
-rw-r--r-- | test/CMakeTests.cmake | 10 | ||||
-rw-r--r-- | test/CMakeVFDTests.cmake | 38 | ||||
-rw-r--r-- | test/Makefile.am | 12 | ||||
-rw-r--r-- | test/accum.c | 2 | ||||
-rw-r--r-- | test/accum_swmr_reader.c | 2 | ||||
-rw-r--r-- | test/app_ref.c | 24 | ||||
-rw-r--r-- | test/btree2.c | 10 | ||||
-rw-r--r-- | test/cache.c | 5 | ||||
-rw-r--r-- | test/cache_api.c | 47 | ||||
-rw-r--r-- | test/cache_image.c | 5 | ||||
-rw-r--r-- | test/cache_tagging.c | 6 | ||||
-rw-r--r-- | test/cork.c | 17 | ||||
-rw-r--r-- | test/dangle.c | 16 | ||||
-rw-r--r-- | test/dsets.c | 25 | ||||
-rw-r--r-- | test/dtransform.c | 2 | ||||
-rw-r--r-- | test/dtypes.c | 86 | ||||
-rw-r--r-- | test/error_test.c | 20 | ||||
-rw-r--r-- | test/family_v16-000000.h5 (renamed from test/family_v16_00000.h5) | bin | 5120 -> 5120 bytes | |||
-rw-r--r-- | test/family_v16-000001.h5 (renamed from test/family_v16_00001.h5) | bin | 5120 -> 5120 bytes | |||
-rw-r--r-- | test/family_v16-000002.h5 (renamed from test/family_v16_00002.h5) | bin | 5120 -> 5120 bytes | |||
-rw-r--r-- | test/family_v16-000003.h5 (renamed from test/family_v16_00003.h5) | bin | 4048 -> 4048 bytes | |||
-rw-r--r-- | test/fheap.c | 2 | ||||
-rw-r--r-- | test/file_image.c | 5 | ||||
-rw-r--r-- | test/filenotclosed.c | 2 | ||||
-rw-r--r-- | test/fillval.c | 5 | ||||
-rw-r--r-- | test/flush1.c | 2 | ||||
-rw-r--r-- | test/flush2.c | 2 | ||||
-rw-r--r-- | test/flushrefresh.c | 2 | ||||
-rw-r--r-- | test/freespace.c | 28 | ||||
-rw-r--r-- | test/getname.c | 8 | ||||
-rw-r--r-- | test/h5test.c | 399 | ||||
-rw-r--r-- | test/h5test.h | 12 | ||||
-rw-r--r-- | test/lheap.c | 40 | ||||
-rw-r--r-- | test/links.c | 175 | ||||
-rw-r--r-- | test/links_env.c | 16 | ||||
-rw-r--r-- | test/mf.c | 203 | ||||
-rw-r--r-- | test/mtime.c | 101 | ||||
-rw-r--r-- | test/ntypes.c | 16 | ||||
-rw-r--r-- | test/null_vfd_plugin.c | 131 | ||||
-rw-r--r-- | test/null_vfd_plugin.h | 33 | ||||
-rw-r--r-- | test/objcopy.c | 41 | ||||
-rw-r--r-- | test/ohdr.c | 26 | ||||
-rw-r--r-- | test/page_buffer.c | 2 | ||||
-rw-r--r-- | test/reserved.c | 2 | ||||
-rw-r--r-- | test/set_extent.c | 43 | ||||
-rw-r--r-- | test/stab.c | 16 | ||||
-rw-r--r-- | test/swmr.c | 8 | ||||
-rw-r--r-- | test/swmr_check_compat_vfd.c | 2 | ||||
-rw-r--r-- | test/tarray.c | 6 | ||||
-rw-r--r-- | test/tattr.c | 108 | ||||
-rw-r--r-- | test/testhdf5.c | 2 | ||||
-rw-r--r-- | test/tfile.c | 886 | ||||
-rw-r--r-- | test/th5o.c | 117 | ||||
-rw-r--r-- | test/th5s.c | 2 | ||||
-rw-r--r-- | test/titerate.c | 6 | ||||
-rw-r--r-- | test/tmisc.c | 94 | ||||
-rw-r--r-- | test/trefer.c | 14 | ||||
-rw-r--r-- | test/tselect.c | 33 | ||||
-rw-r--r-- | test/tsohm.c | 44 | ||||
-rw-r--r-- | test/ttsafe.c | 2 | ||||
-rw-r--r-- | test/vds.c | 17 | ||||
-rw-r--r-- | test/vds_env.c | 17 | ||||
-rw-r--r-- | test/vfd.c | 18 | ||||
-rw-r--r-- | test/vfd_plugin.c | 388 | ||||
-rw-r--r-- | test/vol.c | 71 | ||||
-rw-r--r-- | test/vol_plugin.c | 4 |
67 files changed, 2356 insertions, 1181 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 56427f5..1461101 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -78,7 +78,7 @@ if (HDF5_ENABLE_FORMATTERS) endif () ################################################################################# -# If filter and vol plugin tests can be tested +# If filter, vfd and vol plugin tests can be tested ################################################################################# if (BUILD_SHARED_LIBS) # make plugins dir @@ -162,6 +162,50 @@ if (BUILD_SHARED_LIBS) endforeach () ################################################################################# + # make vfd plugins dir + ################################################################################# + file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/null_vfd_plugin_dir") + + #----------------------------------------------------------------------------- + # Define VFD Plugin Test Sources + #----------------------------------------------------------------------------- + set (VFD_PLUGIN_LIBS + null_vfd_plugin + ) + + foreach (vfd_lib ${VFD_PLUGIN_LIBS}) + set (HDF5_VFD_PLUGIN_LIB_CORENAME "${vfd_lib}") + set (HDF5_VFD_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_VFD_PLUGIN_LIB_CORENAME}") + set (HDF5_VFD_PLUGIN_LIB_TARGET ${HDF5_VFD_PLUGIN_LIB_CORENAME}) + + add_library (${HDF5_VFD_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${vfd_lib}.c) + target_include_directories (${HDF5_VFD_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (${HDF5_VFD_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_VFD_PLUGIN_LIB_TARGET} PUBLIC ${HDF5_TEST_LIBSH_TARGET}) + H5_SET_LIB_OPTIONS (${HDF5_VFD_PLUGIN_LIB_TARGET} ${HDF5_VFD_PLUGIN_LIB_NAME} SHARED "LIB") + set_target_properties (${HDF5_VFD_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_${HDF5_VFD_PLUGIN_LIB_TARGET}_FORMAT ${HDF5_VFD_PLUGIN_LIB_TARGET}) + endif () + + #----------------------------------------------------------------------------- + # Copy VFD plugin to a plugins folder + #----------------------------------------------------------------------------- + add_custom_command ( + TARGET ${HDF5_VFD_PLUGIN_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different + "$<TARGET_FILE:${HDF5_VFD_PLUGIN_LIB_TARGET}>" + "${CMAKE_BINARY_DIR}/null_vfd_plugin_dir/$<TARGET_FILE_NAME:${HDF5_VFD_PLUGIN_LIB_TARGET}>" + ) + endforeach () + + ################################################################################# # make vol plugins dir ################################################################################# file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/null_vol_plugin_dir") @@ -661,6 +705,19 @@ if (BUILD_SHARED_LIBS) clang_format (HDF5_TEST_filter_plugin_FORMAT filter_plugin) endif () + add_executable (vfd_plugin ${HDF5_TEST_SOURCE_DIR}/vfd_plugin.c) + target_include_directories (vfd_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (vfd_plugin SHARED) + target_link_libraries (vfd_plugin PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + set_target_properties (vfd_plugin PROPERTIES FOLDER test) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_vfd_plugin_FORMAT vfd_plugin) + endif () + add_executable (vol_plugin ${HDF5_TEST_SOURCE_DIR}/vol_plugin.c) target_include_directories (vol_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (vol_plugin SHARED) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index bb5356d..c537f37 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -127,10 +127,10 @@ set (HDF5_REFERENCE_TEST_FILES btree_idx_1_8.h5 corrupt_stab_msg.h5 deflate.h5 - family_v16_00000.h5 - family_v16_00001.h5 - family_v16_00002.h5 - family_v16_00003.h5 + family_v16-000000.h5 + family_v16-000001.h5 + family_v16-000002.h5 + family_v16-000003.h5 file_image_core_test.h5 filespace_1_6.h5 filespace_1_8.h5 @@ -331,7 +331,7 @@ set (test_CLEANFILES sec2_file.h5 direct_file.h5 family_file000*.h5 - new_family_v16_000*.h5 + new_family_v16-000*.h5 multi_file-*.h5 core_file filter_plugin.h5 diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 892ccf3..723595b 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -25,10 +25,29 @@ set (VFD_LIST split multi family + splitter + #log - log VFD currently has file space allocation bugs ) + if (H5_HAVE_DIRECT) set (VFD_LIST ${VFD_LIST} direct) endif () +if (H5_HAVE_PARALLEL) + # MPI I/O VFD is currently incompatible with too many tests in the VFD test set + # set (VFD_LIST ${VFD_LIST} mpio) +endif () +if (H5_HAVE_MIRROR_VFD) + set (VFD_LIST ${VFD_LIST} mirror) +endif () +if (H5_HAVE_ROS3_VFD) + set (VFD_LIST ${VFD_LIST} ros3) +endif () +if (H5_HAVE_LIBHDFS) + set (VFD_LIST ${VFD_LIST} hdfs) +endif () +if (H5_HAVE_WINDOWS) + set (VFD_LIST ${VFD_LIST} windows) +endif () foreach (vfdtest ${VFD_LIST}) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") @@ -208,3 +227,22 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD foreach (h5_vfd ${VFD_LIST}) ADD_VFD_TEST (${h5_vfd} 0) endforeach () + + ############################################################################## + ### V F D P L U G I N T E S T S + ############################################################################## + if (BUILD_SHARED_LIBS) + if (WIN32) + set (CMAKE_SEP "\;") + set (BIN_REL_PATH "../../") + else () + set (CMAKE_SEP ":") + set (BIN_REL_PATH "../") + endif () + + add_test (NAME H5PLUGIN-vfd_plugin COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:vfd_plugin>) + set_tests_properties (H5PLUGIN-vfd_plugin PROPERTIES + ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/null_vfd_plugin_dir;srcdir=${HDF5_TEST_BINARY_DIR}" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} + ) + endif () diff --git a/test/Makefile.am b/test/Makefile.am index d465664..09277b0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -94,7 +94,7 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \ swmr_check_compat_vfd vds_env vds_swmr_gen vds_swmr_reader vds_swmr_writer \ mirror_vfd if HAVE_SHARED_CONDITIONAL - check_PROGRAMS+= filter_plugin vol_plugin + check_PROGRAMS+= filter_plugin vfd_plugin vol_plugin endif # These programs generate test files for the tests. They don't need to be @@ -117,7 +117,7 @@ if HAVE_SHARED_CONDITIONAL # The libh5test library provides common support code for the tests. # The filter_plugin* libraries are for use in filter_plugin.c. # Build them as shared libraries if that option was enabled in configure. - noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la libnull_vol_connector.la + noinst_LTLIBRARIES=libh5test.la libfilter_plugin1_dsets.la libfilter_plugin2_dsets.la libfilter_plugin3_dsets.la libfilter_plugin4_groups.la libnull_vfd_plugin.la libnull_vol_connector.la libfilter_plugin1_dsets_la_SOURCES=filter_plugin1_dsets.c libfilter_plugin2_dsets_la_SOURCES=filter_plugin2_dsets.c libfilter_plugin3_dsets_la_SOURCES=filter_plugin3_dsets.c @@ -129,6 +129,12 @@ if HAVE_SHARED_CONDITIONAL libfilter_plugin3_dsets_la_LIBADD=$(LIBHDF5) libfilter_plugin4_groups_la_LIBADD=$(LIBHDF5) + # VFD plugin test libraries + # + # null_vfd_plugin is used for testing basic VFD plugin functionality. + libnull_vfd_plugin_la_SOURCES=null_vfd_plugin.c + libnull_vfd_plugin_la_LDFLAGS=$(AM_LDFLAGS) -avoid-version -module -shared -export-dynamic -rpath /nowhere + # VOL plugin test libraries # # null_vol_connector is used for testing basic VOL plugin functionality. @@ -192,7 +198,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \ tmisc[0-9]*.h5 set_extent[1-5].h5 ext[12].bin \ getname.h5 getname[1-3].h5 sec2_file.h5 direct_file.h5 \ - family_file000[0-3][0-9].h5 new_family_v16_000[0-3][0-9].h5 \ + family_file000[0-3][0-9].h5 new_family_v16-000[0-3][0-9].h5 \ multi_file-[rs].h5 core_file filter_plugin.h5 \ new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \ dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \ diff --git a/test/accum.c b/test/accum.c index c3346bc..08f86ca 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2121,7 +2121,7 @@ test_swmr_write_big(hbool_t newest_format) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); if (!H5FD__supports_swmr_test(driver)) { SKIPPED(); HDputs(" Test skipped due to VFD not supporting SWMR I/O."); diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index ce0e830..76f45bf 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -56,7 +56,7 @@ main(void) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); if (!H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; diff --git a/test/app_ref.c b/test/app_ref.c index 09cfb72..2777dc0 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -79,11 +79,12 @@ Abrt_Handler(int H5_ATTR_UNUSED sig) int main(void) { - hid_t ids[T_NUMCLASSES]; - hid_t fapl; /* File Access Property List */ - int ninc; - int i; - char filename[1024]; + const char *env_h5_drvr; /* File Driver value from environment */ + hid_t ids[T_NUMCLASSES]; + hid_t fapl; /* File Access Property List */ + int ninc; + int i; + char filename[1024]; h5_reset(); h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof filename); @@ -92,6 +93,19 @@ main(void) TESTING("library shutdown with reference count > 1"); + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* Don't run this test with the multi/split VFD. A bug in library shutdown + * ordering causes problems with the multi VFD when IDs are left dangling. + */ + if (!HDstrcmp(env_h5_drvr, "multi") || !HDstrcmp(env_h5_drvr, "split")) { + HDputs("\n -- SKIPPED for incompatible VFD --"); + return 0; + } + /* Create the file */ if ((ids[T_FILE] = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR diff --git a/test/btree2.c b/test/btree2.c index aca0c77..2d34fa7 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -8849,8 +8849,7 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); TEST_ERROR /* Check for VFD which stores data in multiple files */ - single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0); + single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, H5_EXCLUDE_NON_MULTIPART_DRIVERS); if (single_file_vfd) { /* Make a copy of the file in memory, in order to speed up deletion testing */ @@ -10127,7 +10126,7 @@ main(void) const char * envval = NULL; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL) envval = "nomatch"; @@ -10135,6 +10134,11 @@ main(void) h5_reset(); fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); + + /* For the Direct I/O driver, skip intensive tests due to poor performance */ + if (!HDstrcmp(envval, "direct")) + ExpressMode = 2; + if (ExpressMode > 1) HDprintf("***Express test mode on. Some tests may be skipped\n"); diff --git a/test/cache.c b/test/cache.c index 6989564..e802a9b 100644 --- a/test/cache.c +++ b/test/cache.c @@ -35888,6 +35888,11 @@ main(void) HDprintf(" express_test = %d\n", express_test); HDprintf("=========================================\n"); + if (!h5_using_default_driver(NULL)) { + HDputs(" -- SKIPPED for incompatible VFD --"); + HDexit(EXIT_SUCCESS); + } + if (create_entry_arrays() < 0) { HDprintf("ERROR: Unable to create entries arrays. Aborting.\n"); diff --git a/test/cache_api.c b/test/cache_api.c index 7858c65..432dab3 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -306,10 +306,10 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "H5Fclose() failed.\n"; } - else if (HDremove(filename) < 0) { + else if (H5Fdelete(filename, H5P_DEFAULT) < 0) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "H5Fdelete() failed.\n"; } } @@ -442,28 +442,28 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) } } - /* close the fapl used to create the file */ + /* close the file and delete it */ if (pass) { - if (H5Pclose(fapl_id) < 0) { + if (H5Fclose(file_id) < 0) { pass = FALSE; - failure_mssg = "H5Pclose() failed.\n"; + failure_mssg = "H5Fclose() failed.\n"; + } + else if (H5Fdelete(filename, fapl_id) < 0) { + + pass = FALSE; + failure_mssg = "H5Fdelete() failed.\n"; } } - /* close the file and delete it */ + /* close the fapl used to create the file */ if (pass) { - if (H5Fclose(file_id) < 0) { - - pass = FALSE; - failure_mssg = "H5Fclose() failed.\n"; - } - else if (HDremove(filename) < 0) { + if (H5Pclose(fapl_id) < 0) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "H5Pclose() failed.\n"; } } @@ -803,10 +803,10 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "H5Fclose() failed.\n"; } - else if (HDremove(filename) < 0) { + else if (H5Fdelete(filename, H5P_DEFAULT) < 0) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "H5Fdelete() failed.\n"; } } @@ -1445,10 +1445,10 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "H5Fclose() failed.\n"; } - else if (HDremove(filename) < 0) { + else if (H5Fdelete(filename, H5P_DEFAULT) < 0) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "H5Fdelete() failed.\n"; } } @@ -2170,10 +2170,10 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "H5Fclose() failed.\n"; } - else if (HDremove(filename) < 0) { + else if (H5Fdelete(filename, H5P_DEFAULT) < 0) { pass = FALSE; - failure_mssg = "HDremove() failed.\n"; + failure_mssg = "H5Fdelete() failed.\n"; } } @@ -2258,8 +2258,13 @@ main(void) for (paged = FALSE; paged <= TRUE; paged++) { hid_t my_fcpl = fcpl_id; - if (paged) - my_fcpl = fcpl2_id; + if (paged) { + /* Only run paged aggregation tests with sec2/default driver */ + if (!h5_using_default_driver(NULL)) + continue; + else + my_fcpl = fcpl2_id; + } if (!check_fapl_mdc_api_calls(paged, my_fcpl)) nerrs += 1; diff --git a/test/cache_image.c b/test/cache_image.c index 4967066..4100c1f 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -7839,7 +7839,7 @@ main(void) int express_test; /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; @@ -7853,8 +7853,7 @@ main(void) HDprintf("=========================================\n"); /* Check for VFD which stores data in multiple files */ - single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0); + single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, H5_EXCLUDE_NON_MULTIPART_DRIVERS); nerrs += check_cache_image_ctl_flow_1(single_file_vfd); nerrs += check_cache_image_ctl_flow_2(single_file_vfd); diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 06de174..b69a501 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -4572,6 +4572,12 @@ main(void) /* Open the HDF5 Library */ H5open(); + /* Only run with sec2/default driver */ + if (!h5_using_default_driver(NULL)) { + HDputs(" -- SKIPPED for incompatible VFD --"); + HDexit(EXIT_SUCCESS); + } + /* ========== */ /* Test Setup */ /* ========== */ diff --git a/test/cork.c b/test/cork.c index 80934ad..8001f5d 100644 --- a/test/cork.c +++ b/test/cork.c @@ -26,7 +26,11 @@ */ #define H5C_FRIEND /*suppress error about including H5Cpkg */ #define H5C_TESTING /*suppress warning about H5C testing funcs*/ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_TESTING + #include "H5Cpkg.h" /* Cache */ +#include "H5FDpkg.h" /* ============ */ /* Test Defines */ @@ -2243,6 +2247,19 @@ main(void) nerrs += verify_old_dset_cork(); for (swmr = 0; swmr <= 1; swmr++) { + if (swmr) { + char *driver = NULL; + + /* Skip these tests if SWMR I/O is not supported for the VFD specified + * by the environment variable. + */ + driver = HDgetenv(HDF5_DRIVER); + if (!H5FD__supports_swmr_test(driver)) { + HDputs("-- SKIPPED SWMR tests for SWMR-incompatible VFD --"); + continue; + } + } + /* Tests with new/old library format */ /* This is the test moved from th5o.c: test_h5o_cork() */ nerrs += test_objs_cork(swmr, TRUE); diff --git a/test/dangle.c b/test/dangle.c index d41507b..95d3105 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -660,7 +660,21 @@ error: int main(void) { - int nerrors = 0; + const char *env_h5_drvr; /* File Driver value from environment */ + int nerrors = 0; + + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* Don't run this test with the multi/split VFD. A bug in library shutdown + * ordering causes problems with the multi VFD when IDs are left dangling. + */ + if (!HDstrcmp(env_h5_drvr, "multi") || !HDstrcmp(env_h5_drvr, "split")) { + HDputs(" -- SKIPPED for incompatible VFD --"); + return 0; + } /* Run tests w/weak file close */ HDputs("Testing dangling objects with weak file close:"); diff --git a/test/dsets.c b/test/dsets.c index 922f370..5e80ef7 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -15558,10 +15558,11 @@ main(void) int nerrors = 0; const char *envval; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); int i; /* Don't run this test using certain file drivers */ - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL) envval = "nomatch"; @@ -15718,7 +15719,11 @@ main(void) nerrors += (test_multiopen(file) < 0 ? 1 : 0); nerrors += (test_types(file) < 0 ? 1 : 0); nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0); - nerrors += (test_missing_filter(file) < 0 ? 1 : 0); + + if (!driver_uses_modified_filename) { + nerrors += (test_missing_filter(file) < 0 ? 1 : 0); + } + nerrors += (test_can_apply(file) < 0 ? 1 : 0); nerrors += (test_can_apply2(file) < 0 ? 1 : 0); nerrors += (test_optional_filters(file) < 0 ? 1 : 0); @@ -15727,7 +15732,11 @@ main(void) nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0); nerrors += (test_filter_delete(file) < 0 ? 1 : 0); - nerrors += (test_filters_endianess() < 0 ? 1 : 0); + + if (!driver_uses_modified_filename) { + nerrors += (test_filters_endianess() < 0 ? 1 : 0); + } + nerrors += (test_zero_dims(file) < 0 ? 1 : 0); nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0); @@ -15745,7 +15754,11 @@ main(void) nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0); nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0); - nerrors += (test_idx_compatible() < 0 ? 1 : 0); + + if (!driver_uses_modified_filename) { + nerrors += (test_idx_compatible() < 0 ? 1 : 0); + } + nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0); nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0); nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0); @@ -15779,7 +15792,9 @@ main(void) nerrors += (test_gather_error() < 0 ? 1 : 0); /* Tests version bounds using its own file */ - nerrors += (test_versionbounds() < 0 ? 1 : 0); + if (!driver_uses_modified_filename) { + nerrors += (test_versionbounds() < 0 ? 1 : 0); + } /* Tests that use their own file */ nerrors += (test_object_header_minimization_dcpl() < 0 ? 1 : 0); diff --git a/test/dtransform.c b/test/dtransform.c index 743103f..b721a59 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -199,6 +199,8 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, COMPARE(TYPE, array, COMPARE_DATA, 2) \ } \ \ + if (H5Dclose(dset_nn) < 0) \ + TEST_ERROR; \ if (H5Dclose(dset) < 0) \ TEST_ERROR; \ if (H5Sclose(dataspace) < 0) \ diff --git a/test/dtypes.c b/test/dtypes.c index 8b3101c..1c1a6ec 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -3725,53 +3725,55 @@ test_compound_18(void) if (H5Fclose(file) < 0) FAIL_STACK_ERROR - /* Open Generated File */ - /* (generated with gen_bad_compound.c) */ - if ((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if (!h5_driver_uses_modified_filename()) { + /* Open Generated File */ + /* (generated with gen_bad_compound.c) */ + if ((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Try to open the datatype */ + H5E_BEGIN_TRY + { + tid = H5Topen2(file, "cmpnd", H5P_DEFAULT); + } + H5E_END_TRY; + if (tid > 0) { + H5Tclose(tid); + FAIL_PUTS_ERROR("opened named datatype with bad compound datatype") + } /* end if */ - /* Try to open the datatype */ - H5E_BEGIN_TRY - { - tid = H5Topen2(file, "cmpnd", H5P_DEFAULT); - } - H5E_END_TRY; - if (tid > 0) { - H5Tclose(tid); - FAIL_PUTS_ERROR("opened named datatype with bad compound datatype") - } /* end if */ + /* Try to open the dataset */ + H5E_BEGIN_TRY + { + did = H5Dopen2(file, "dataset", H5P_DEFAULT); + } + H5E_END_TRY; + if (did > 0) { + H5Dclose(did); + FAIL_PUTS_ERROR("opened dataset with bad compound datatype") + } /* end if */ - /* Try to open the dataset */ - H5E_BEGIN_TRY - { - did = H5Dopen2(file, "dataset", H5P_DEFAULT); - } - H5E_END_TRY; - if (did > 0) { - H5Dclose(did); - FAIL_PUTS_ERROR("opened dataset with bad compound datatype") - } /* end if */ + /* Open the group with the attribute */ + if ((gid = H5Gopen2(file, "group", H5P_DEFAULT)) < 0) + TEST_ERROR - /* Open the group with the attribute */ - if ((gid = H5Gopen2(file, "group", H5P_DEFAULT)) < 0) - TEST_ERROR + /* Try to open the dataset */ + H5E_BEGIN_TRY + { + aid = H5Aopen(gid, "attr", H5P_DEFAULT); + } + H5E_END_TRY; + if (aid > 0) { + H5Aclose(aid); + FAIL_PUTS_ERROR("opened attribute with bad compound datatype") + } /* end if */ - /* Try to open the dataset */ - H5E_BEGIN_TRY - { - aid = H5Aopen(gid, "attr", H5P_DEFAULT); + /* Close IDs */ + if (H5Gclose(gid) < 0) + FAIL_STACK_ERROR + if (H5Fclose(file) < 0) + FAIL_STACK_ERROR } - H5E_END_TRY; - if (aid > 0) { - H5Aclose(aid); - FAIL_PUTS_ERROR("opened attribute with bad compound datatype") - } /* end if */ - - /* Close IDs */ - if (H5Gclose(gid) < 0) - FAIL_STACK_ERROR - if (H5Fclose(file) < 0) - FAIL_STACK_ERROR PASSED(); return 0; diff --git a/test/error_test.c b/test/error_test.c index f4dc340..9ac76dd 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -738,7 +738,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_filter_error(const char *fname) +test_filter_error(const char *fname, hid_t fapl) { const char *pathname = H5_get_srcdir_filename(fname); /* Corrected test file name */ hid_t file = -1; @@ -748,7 +748,7 @@ test_filter_error(const char *fname) HDfprintf(stderr, "\nTesting error message during data reading when filter isn't registered\n"); /* Open the file */ - if ((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if ((file = H5Fopen(pathname, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR; /* Open the regular dataset */ @@ -785,9 +785,15 @@ main(void) hid_t fapl = -1; hid_t estack_id = -1; char filename[1024]; + const char *env_h5_drvr; /* File driver value from environment */ const char *FUNC_main = "main"; int i; + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + HDfprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n"); /* Initialize errors */ @@ -877,7 +883,15 @@ main(void) * the test file was pre-generated. */ h5_fixname(DATAFILE, H5P_DEFAULT, filename, sizeof filename); - if (test_filter_error(filename) < 0) + if (!h5_using_default_driver(env_h5_drvr) && HDstrcmp(env_h5_drvr, "stdio")) { + /* If not using the library's default VFD or the stdio VFD, force + * the library's default VFD here. The test file was pre-generated + * and can cause issues with many VFDs. + */ + if (H5Pset_driver(fapl, H5_DEFAULT_VFD, NULL) < 0) + TEST_ERROR; + } + if (test_filter_error(filename, fapl) < 0) TEST_ERROR; h5_clean_files(FILENAME, fapl); diff --git a/test/family_v16_00000.h5 b/test/family_v16-000000.h5 Binary files differindex ac75ea9..ac75ea9 100644 --- a/test/family_v16_00000.h5 +++ b/test/family_v16-000000.h5 diff --git a/test/family_v16_00001.h5 b/test/family_v16-000001.h5 Binary files differindex bf55b32..bf55b32 100644 --- a/test/family_v16_00001.h5 +++ b/test/family_v16-000001.h5 diff --git a/test/family_v16_00002.h5 b/test/family_v16-000002.h5 Binary files differindex 9bd0891..9bd0891 100644 --- a/test/family_v16_00002.h5 +++ b/test/family_v16-000002.h5 diff --git a/test/family_v16_00003.h5 b/test/family_v16-000003.h5 Binary files differindex fedce2a..fedce2a 100644 --- a/test/family_v16_00003.h5 +++ b/test/family_v16-000003.h5 diff --git a/test/fheap.c b/test/fheap.c index 86a555d..3c3088d 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16365,7 +16365,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Don't run this test using certain file drivers */ - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL) envval = "nomatch"; diff --git a/test/file_image.c b/test/file_image.c index 0d031f5..e2b7810 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -1361,7 +1361,10 @@ main(void) errors += test_properties(); errors += test_callbacks(); - errors += test_core(); + + if (!h5_driver_uses_modified_filename()) { + errors += test_core(); + } /* Perform tests with/without user block */ for (user = FALSE; user <= TRUE; user++) { diff --git a/test/filenotclosed.c b/test/filenotclosed.c index b5def9b..58edc06 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -68,7 +68,7 @@ main(void) hbool_t contig_addr_vfd; /* Contiguous address vfd */ /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; diff --git a/test/fillval.c b/test/fillval.c index 8de6ef1..7faeb65 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -2722,7 +2722,10 @@ main(int argc, char *argv[]) nerrors += test_create(my_fapl, FILENAME[1], H5D_CONTIGUOUS); nerrors += test_rdwr(my_fapl, FILENAME[3], H5D_CONTIGUOUS); nerrors += test_extend(my_fapl, FILENAME[5], H5D_CONTIGUOUS); - nerrors += test_compatible(); + + if (!h5_driver_uses_modified_filename()) { + nerrors += test_compatible(); + } } /* end if */ /* Compact dataset storage tests */ diff --git a/test/flush1.c b/test/flush1.c index 456f5f4..f5c4e2b 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -201,7 +201,7 @@ main(void) TEST_ERROR /* Check if the current VFD supports SWMR */ - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); vfd_supports_swmr = H5FD__supports_swmr_test(driver); /*************************************************/ diff --git a/test/flush2.c b/test/flush2.c index 3262b14..bf1187b 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -251,7 +251,7 @@ main(void) PUTS_ERROR("bad vfd-dependent fapl") /* Check if the current VFD supports SWMR */ - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); vfd_supports_swmr = H5FD__supports_swmr_test(driver); /* TEST 1 */ diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 5efff2f..8d2c083 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -153,7 +153,7 @@ main(int argc, const char *argv[]) * anything. */ /* Determine driver being used */ - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL || H5FD__supports_swmr_test(envval)) { if (test_flush() != SUCCEED) diff --git a/test/freespace.c b/test/freespace.c index e888b2b..1107609 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -661,13 +661,16 @@ test_fs_sect_add(hid_t fapl) /* Close the file */ if (H5Fclose(file) < 0) FAIL_STACK_ERROR + sect_node = NULL; - /* Get the size of a file w/empty heap*/ - if ((tmp_file_size = h5_get_file_size(filename, fapl)) < 0) - TEST_ERROR + if (h5_using_default_driver(NULL)) { + /* Get the size of a file w/empty heap*/ + if ((tmp_file_size = h5_get_file_size(filename, fapl)) < 0) + TEST_ERROR - if (tmp_file_size <= (file_size + fr_meta_size)) - TEST_ERROR + if (tmp_file_size <= (file_size + fr_meta_size)) + TEST_ERROR + } PASSED(); @@ -723,13 +726,16 @@ test_fs_sect_add(hid_t fapl) /* Close the file */ if (H5Fclose(file) < 0) FAIL_STACK_ERROR + sect_node = NULL; - /* Get the size of a file w/empty heap*/ - if ((tmp_file_size = h5_get_file_size(filename, fapl)) < 0) - TEST_ERROR + if (h5_using_default_driver(NULL)) { + /* Get the size of a file w/empty heap*/ + if ((tmp_file_size = h5_get_file_size(filename, fapl)) < 0) + TEST_ERROR - if (tmp_file_size != (file_size + fr_meta_size)) - TEST_ERROR + if (tmp_file_size != (file_size + fr_meta_size)) + TEST_ERROR + } PASSED(); @@ -799,6 +805,7 @@ test_fs_sect_add(hid_t fapl) /* Close the file */ if (H5Fclose(file) < 0) FAIL_STACK_ERROR + sect_node = NULL; PASSED(); @@ -878,6 +885,7 @@ test_fs_sect_add(hid_t fapl) /* Close the file */ if (H5Fclose(file) < 0) FAIL_STACK_ERROR + sect_node = NULL; PASSED(); diff --git a/test/getname.c b/test/getname.c index 200c426..485e3c1 100644 --- a/test/getname.c +++ b/test/getname.c @@ -3775,8 +3775,12 @@ main(void) /* Call "main" test routine */ nerrors += test_main(file_id, fapl); - nerrors += test_obj_ref(fapl); - nerrors += test_reg_ref(fapl); + + if (!h5_using_parallel_driver(NULL)) { + nerrors += test_obj_ref(fapl); + nerrors += test_reg_ref(fapl); + } + nerrors += test_elinks(fapl); /* Close file */ diff --git a/test/h5test.c b/test/h5test.c index ba0662a..e69a682 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -40,10 +40,7 @@ * to the cpp constant. If neither is defined then use some default value. * * HDF5_DRIVER: This string describes what low level file driver to - * use for HDF5 file access. The first word in the - * value is the name of the driver and subsequent data - * is interpreted according to the driver. See - * h5_get_vfd_fapl() for details. + * use for HDF5 file access. * * HDF5_LIBVER_BOUNDS: This string describes what library version bounds to * use for HDF5 file access. See h5_get_libver_fapl() for details. @@ -525,8 +522,8 @@ static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock) { - const char *prefix = NULL; - const char *env = NULL; /* HDF5_DRIVER environment variable */ + const char *prefix = NULL; + const char *driver_env_var = NULL; /* HDF5_DRIVER environment variable */ char * ptr, last = '\0'; const char *suffix = _suffix; size_t i, j; @@ -538,6 +535,13 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu HDmemset(fullname, 0, size); + /* Determine if driver is set by environment variable. If it is, + * only generate a suffix if fixing the filename for the superblock + * file. */ + driver_env_var = HDgetenv(HDF5_DRIVER); + if (driver_env_var && (H5P_DEFAULT == fapl) && subst_for_superblock) + fapl = H5P_FILE_ACCESS_DEFAULT; + /* figure out the suffix */ if (H5P_DEFAULT != fapl) { if ((driver = H5Pget_driver(fapl)) < 0) @@ -546,28 +550,25 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu if (suffix) { if (H5FD_FAMILY == driver) { if (subst_for_superblock) - suffix = "00000.h5"; + suffix = "-000000.h5"; else - suffix = nest_printf ? "%%05d.h5" : "%05d.h5"; + suffix = nest_printf ? "-%%06d.h5" : "-%06d.h5"; } else if (H5FD_MULTI == driver) { - /* Get the environment variable, if it exists, in case + /* Check the HDF5_DRIVER environment variable in case * we are using the split driver since both of those * use the multi VFD under the hood. */ - env = HDgetenv("HDF5_DRIVER"); #ifdef HDF5_DRIVER /* Use the environment variable, then the compile-time constant */ - if (!env) - env = HDF5_DRIVER; + if (!driver_env_var) + driver_env_var = HDF5_DRIVER; #endif - if (env && !HDstrcmp(env, "split")) { + if (driver_env_var && !HDstrcmp(driver_env_var, "split")) { /* split VFD */ if (subst_for_superblock) - suffix = "-m.h5"; - else - suffix = NULL; + suffix = ".h5.meta"; } else { /* multi VFD */ @@ -583,7 +584,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu /* Must first check fapl is not H5P_DEFAULT (-1) because H5FD_XXX * could be of value -1 if it is not defined. */ - isppdriver = H5P_DEFAULT != fapl && (H5FD_MPIO == driver); + isppdriver = ((H5P_DEFAULT != fapl) || driver_env_var) && (H5FD_MPIO == driver); /* Check HDF5_NOCLEANUP environment setting. * (The #ifdef is needed to prevent compile failure in case MPI is not @@ -591,12 +592,12 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu */ if (isppdriver) { #ifdef H5_HAVE_PARALLEL - if (getenv_all(MPI_COMM_WORLD, 0, "HDF5_NOCLEANUP")) + if (getenv_all(MPI_COMM_WORLD, 0, HDF5_NOCLEANUP)) SetTestNoCleanup(); #endif /* H5_HAVE_PARALLEL */ } else { - if (HDgetenv("HDF5_NOCLEANUP")) + if (HDgetenv(HDF5_NOCLEANUP)) SetTestNoCleanup(); } @@ -798,11 +799,7 @@ h5_fileaccess(void) if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; - /* Attempt to set up a file driver first */ - if (h5_get_vfd_fapl(fapl_id) < 0) - goto error; - - /* Finally, check for libver bounds */ + /* Check for libver bounds */ if (h5_get_libver_fapl(fapl_id) < 0) goto error; @@ -837,11 +834,7 @@ h5_fileaccess_flags(unsigned flags) if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; - /* Attempt to set up a file driver first */ - if ((flags & H5_FILEACCESS_VFD) && h5_get_vfd_fapl(fapl_id) < 0) - goto error; - - /* Finally, check for libver bounds */ + /* Check for libver bounds */ if ((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0) goto error; @@ -854,150 +847,6 @@ error: } /* end h5_fileaccess_flags() */ /*------------------------------------------------------------------------- - * Function: h5_get_vfd_fapl - * - * Purpose: Sets the file driver for a FAPL according to the value specified - * in the constant or environment variable "HDF5_DRIVER". - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Dana Robinson - * February 2016 - * - *------------------------------------------------------------------------- - */ -herr_t -h5_get_vfd_fapl(hid_t fapl) -{ - const char *env = NULL; /* HDF5_DRIVER environment variable */ - const char *tok = NULL; /* strtok pointer */ - char * lasts = NULL; /* Context pointer for strtok_r() call */ - char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ - - /* Get the environment variable, if it exists */ - env = HDgetenv("HDF5_DRIVER"); -#ifdef HDF5_DRIVER - /* Use the environment variable, then the compile-time constant */ - if (!env) - env = HDF5_DRIVER; -#endif - - /* If the environment variable was not set, just return - * without modifying the FAPL. - */ - if (!env || !*env) - goto done; - - /* Get the first 'word' of the environment variable. - * If it's nothing (environment variable was whitespace) - * just return the default fapl. - */ - HDstrncpy(buf, env, sizeof(buf)); - buf[sizeof(buf) - 1] = '\0'; - if (NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) - goto done; - - if (!HDstrcmp(tok, "sec2")) { - /* POSIX (section 2) read() and write() system calls */ - if (H5Pset_fapl_sec2(fapl) < 0) - goto error; - } - else if (!HDstrcmp(tok, "stdio")) { - /* Standard C fread() and fwrite() system calls */ - if (H5Pset_fapl_stdio(fapl) < 0) - goto error; - } - else if (!HDstrcmp(tok, "core")) { - /* In-memory driver settings (backing store on, 1 MB increment) */ - if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) - goto error; - } - else if (!HDstrcmp(tok, "core_paged")) { - /* In-memory driver with write tracking and paging on */ - if (H5Pset_fapl_core(fapl, (size_t)H5_MB, TRUE) < 0) - goto error; - if (H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) - goto error; - } - else if (!HDstrcmp(tok, "split")) { - /* Split meta data and raw data each using default driver */ - if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) - goto error; - } - else if (!HDstrcmp(tok, "multi")) { - /* Multi-file driver, general case of the split driver */ - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - char * sv[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; - H5FD_mem_t mt; - - HDmemset(memb_map, 0, sizeof(memb_map)); - HDmemset(memb_fapl, 0, sizeof(memb_fapl)); - HDmemset(memb_name, 0, sizeof(memb_name)); - HDmemset(memb_addr, 0, sizeof(memb_addr)); - - HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { - memb_fapl[mt] = H5P_DEFAULT; - sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN); - HDassert(sv[mt]); - HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); - memb_name[mt] = sv[mt]; - memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); - } /* end for */ - - if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) - goto error; - - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - HDfree(sv[mt]); - } - else if (!HDstrcmp(tok, "family")) { - /* Family of files, each 1MB and using the default driver */ - hsize_t fam_size = 100 * 1024 * 1024; /* 100 MB */ - - /* Was a family size specified in the environment variable? */ - if ((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) - fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024 * 1024); - if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) - goto error; - } - else if (!HDstrcmp(tok, "log")) { - /* Log file access */ - unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; - - /* Were special log file flags specified in the environment variable? */ - if ((tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) - log_flags = (unsigned)HDstrtol(tok, NULL, 0); - - if (H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) - goto error; -#ifdef H5_HAVE_DIRECT - } - else if (!HDstrcmp(tok, "direct")) { - /* Linux direct read() and write() system calls. Set memory boundary, - * file block size, and copy buffer size to the default values. - */ - if (H5Pset_fapl_direct(fapl, 1024, 4096, 8 * 4096) < 0) - goto error; -#endif - } - else { - /* Unknown driver */ - goto error; - } /* end if */ - -done: - return 0; - -error: - return -1; -} /* end h5_get_vfd_fapl() */ - -/*------------------------------------------------------------------------- * Function: h5_get_libver_fapl * * Purpose: Sets the library version bounds for a FAPL according to the @@ -1333,30 +1182,58 @@ h5_get_file_size(const char *filename, hid_t fapl) #ifdef H5_HAVE_DIRECT driver == H5FD_DIRECT || #endif /* H5_HAVE_DIRECT */ - driver == H5FD_LOG) { + driver == H5FD_LOG || driver == H5FD_SPLITTER) { /* Get the file's statistics */ if (0 == HDstat(filename, &sb)) return ((h5_stat_size_t)sb.st_size); } /* end if */ else if (driver == H5FD_MULTI) { H5FD_mem_t mt; - h5_stat_size_t tot_size = 0; - - HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { - /* Create the filename to query */ - HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); - - /* Check for existence of file */ - if (0 == HDaccess(temp, F_OK)) { - /* Get the file's statistics */ - if (0 != HDstat(temp, &sb)) - return (-1); - - /* Add to total size */ - tot_size += (h5_stat_size_t)sb.st_size; - } /* end if */ - } /* end for */ + h5_stat_size_t tot_size = 0; + char * driver_env_var = NULL; + + driver_env_var = HDgetenv(HDF5_DRIVER); + if (driver_env_var && !HDstrcmp(driver_env_var, "split")) { + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { + if (mt != H5FD_MEM_DRAW && mt != H5FD_MEM_SUPER) + continue; + + /* Create the filename to query */ + if (mt == H5FD_MEM_DRAW) { + HDsnprintf(temp, sizeof temp, "%s.raw", filename); + } + else { + HDsnprintf(temp, sizeof temp, "%s.meta", filename); + } + + /* Check for existence of file */ + if (0 == HDaccess(temp, F_OK)) { + /* Get the file's statistics */ + if (0 != HDstat(temp, &sb)) + return (-1); + + /* Add to total size */ + tot_size += (h5_stat_size_t)sb.st_size; + } /* end if */ + } /* end for */ + } + else { + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { + /* Create the filename to query */ + HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); + + /* Check for existence of file */ + if (0 == HDaccess(temp, F_OK)) { + /* Get the file's statistics */ + if (0 != HDstat(temp, &sb)) + return (-1); + + /* Add to total size */ + tot_size += (h5_stat_size_t)sb.st_size; + } /* end if */ + } /* end for */ + } /* Return total size */ return (tot_size); @@ -1404,7 +1281,9 @@ h5_get_file_size(const char *filename, hid_t fapl) return (tot_size); } /* end if */ else { - HDassert(0 && "Unknown VFD!"); + /* Get the file's statistics */ + if (0 == HDstat(filename, &sb)) + return ((h5_stat_size_t)sb.st_size); } /* end else */ } /* end else */ @@ -1892,7 +1771,9 @@ dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hi } /* Dummy VFD with the minimum parameters to make a VFD that can be registered */ +#define DUMMY_VFD_VALUE (H5FD_class_value_t)155 static const H5FD_class_t H5FD_dummy_g = { + DUMMY_VFD_VALUE, /* value */ "dummy", /* name */ 1, /* maxaddr */ H5F_CLOSE_WEAK, /* fc_degree */ @@ -2288,3 +2169,137 @@ error: } return FAIL; } /* end h5_check_if_file_locking_enabled() */ + +/*------------------------------------------------------------------------- + * Function: h5_using_default_driver + * + * Purpose: Checks if the specified VFD name matches the library's + * default VFD. If `drv_name` is NULL, the HDF5_DRIVER + * environment is checked instead (if it is set). + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +h5_using_default_driver(const char *drv_name) +{ + hbool_t ret_val = TRUE; + + HDassert(H5_DEFAULT_VFD == H5FD_SEC2); + + if (!drv_name) + drv_name = HDgetenv(HDF5_DRIVER); + + if (drv_name) + return (!HDstrcmp(drv_name, "sec2") || !HDstrcmp(drv_name, "nomatch")); + + return ret_val; +} + +/*------------------------------------------------------------------------- + * Function: h5_using_parallel_driver + * + * Purpose: Checks if the specified VFD name matches a parallel-enabled + * VFD (usually `mpio`). If `drv_name` is NULL, the + * HDF5_DRIVER environment is checked instead (if it is set). + * + * This is mostly useful for avoiding tests that use features + * which are not currently supported for parallel HDF5, such + * as writing of VL or region reference datatypes. + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +h5_using_parallel_driver(const char *drv_name) +{ + hbool_t ret_val = FALSE; + + if (!drv_name) + drv_name = HDgetenv(HDF5_DRIVER); + + if (drv_name) + return (!HDstrcmp(drv_name, "mpio")); + + return ret_val; +} + +/*------------------------------------------------------------------------- + * Function: h5_driver_uses_modified_filename + * + * Purpose: Checks if the current VFD set by use of the HDF5_DRIVER + * environment variable uses a modified filename. Examples + * are the multi and family drivers. + * + * This routine is helpful for skipping tests that use + * pre-generated files. VFDs that use a modified filename will + * not be able to find these files and those tests will fail. + * Eventually, HDF5's testing framework should be modified to + * not run VFD testing against tests that use pre-generated + * files. + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +h5_driver_uses_modified_filename(void) +{ + hbool_t ret_val = FALSE; + char * driver = HDgetenv(HDF5_DRIVER); + + if (driver) { + ret_val = !HDstrcmp(driver, "multi") || !HDstrcmp(driver, "split") || !HDstrcmp(driver, "family") || + !HDstrcmp(driver, "splitter"); + } + + return ret_val; +} /* end h5_driver_uses_modified_filename() */ + +/*------------------------------------------------------------------------- + * Function: h5_driver_uses_multiple_files + * + * Purpose: Checks if the specified VFD name matches a driver that + * stores data using multiple files. + * + * The following flags can be used to control what types of + * drivers are checked for by this routine: + * + * H5_EXCLUDE_MULTIPART_DRIVERS - This flag excludes any + * drivers which store data using multiple files which, + * together, make up a single logical file. These are + * drivers like the split, multi and family drivers. + * + * H5_EXCLUDE_NON_MULTIPART_DRIVERS - This flag excludes any + * drivers which store data using multiple files which are + * separate logical files. The splitter driver is an example + * of this type of driver. + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +h5_driver_uses_multiple_files(const char *drv_name, unsigned flags) +{ + hbool_t ret_val = FALSE; + + if (!drv_name) + drv_name = HDgetenv(HDF5_DRIVER); + + if (drv_name) { + if ((flags & H5_EXCLUDE_MULTIPART_DRIVERS) == 0) { + if (!HDstrcmp(drv_name, "split") || !HDstrcmp(drv_name, "multi") || !HDstrcmp(drv_name, "family")) + return TRUE; + } + + if ((flags & H5_EXCLUDE_NON_MULTIPART_DRIVERS) == 0) { + if (!HDstrcmp(drv_name, "splitter")) + return TRUE; + } + } + + return ret_val; +} diff --git a/test/h5test.h b/test/h5test.h index 2855fb5..914a534 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -166,8 +166,11 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ #define H5_ALARM_SEC 1200 /* default is 20 minutes */ /* Flags for h5_fileaccess_flags() */ -#define H5_FILEACCESS_VFD 0x01 -#define H5_FILEACCESS_LIBVER 0x02 +#define H5_FILEACCESS_LIBVER 0x01 + +/* Flags for h5_driver_uses_multiple_files() */ +#define H5_EXCLUDE_MULTIPART_DRIVERS 0x01 +#define H5_EXCLUDE_NON_MULTIPART_DRIVERS 0x02 /* Macros to create and fill 2D arrays with a single heap allocation. * These can be used to replace large stack and global arrays which raise @@ -255,9 +258,12 @@ H5TEST_DLL const char * h5_get_version_string(H5F_libver_t libver); H5TEST_DLL int h5_compare_file_bytes(char *fname1, char *fname2); H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const char *dest); H5TEST_DLL herr_t h5_check_if_file_locking_enabled(hbool_t *are_enabled); +H5TEST_DLL hbool_t h5_using_default_driver(const char *drv_name); +H5TEST_DLL hbool_t h5_using_parallel_driver(const char *drv_name); +H5TEST_DLL hbool_t h5_driver_uses_modified_filename(void); +H5TEST_DLL hbool_t h5_driver_uses_multiple_files(const char *drv_name, unsigned flags); /* Functions that will replace components of a FAPL */ -H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); H5TEST_DLL herr_t h5_get_libver_fapl(hid_t fapl_id); /* h5_clean_files() replacements */ diff --git a/test/lheap.c b/test/lheap.c index 2609510..283c3e3 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -174,27 +174,29 @@ main(void) goto error; PASSED(); - /* Check opening existing file non-default sizes of lengths and addresses */ - TESTING("opening pre-created file with non-default sizes"); - { - const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ - hid_t dset = -1; - file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); - if (file >= 0) { - if ((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0) - TEST_ERROR - if (H5Dclose(dset) < 0) - TEST_ERROR - if (H5Fclose(file) < 0) - TEST_ERROR + if (!h5_driver_uses_modified_filename()) { + /* Check opening existing file non-default sizes of lengths and addresses */ + TESTING("opening pre-created file with non-default sizes"); + { + const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ + hid_t dset = -1; + file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + if (file >= 0) { + if ((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0) + TEST_ERROR + if (H5Dclose(dset) < 0) + TEST_ERROR + if (H5Fclose(file) < 0) + TEST_ERROR + } + else { + H5_FAILED(); + HDprintf("***cannot open the pre-created non-default sizes test file (%s)\n", testfile); + goto error; + } /* end else */ } - else { - H5_FAILED(); - HDprintf("***cannot open the pre-created non-default sizes test file (%s)\n", testfile); - goto error; - } /* end else */ + PASSED(); } - PASSED(); /* Verify symbol table messages are cached */ if (h5_verify_cached_stabs(FILENAME, fapl) < 0) diff --git a/test/links.c b/test/links.c index f022783..e1a9dba 100644 --- a/test/links.c +++ b/test/links.c @@ -9897,7 +9897,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) would report FALSE, causing problems */ base_driver = H5Pget_driver(fapl); op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI || - base_driver == H5FD_MPIO || base_driver == H5FD_CORE) + base_driver == H5FD_MPIO || base_driver == H5FD_CORE || base_driver == H5FD_DIRECT) ? H5P_DEFAULT : fapl; op_data.fam_size = ELINK_CB_FAM_SIZE; @@ -10071,8 +10071,11 @@ external_reset_register(void) if (H5Fclose(file) < 0) TEST_ERROR - if (HDremove(filename) != 0) - TEST_ERROR + H5E_BEGIN_TRY + { + H5Fdelete(filename, H5P_DEFAULT); + } + H5E_END_TRY; PASSED(); return SUCCEED; @@ -16629,11 +16632,14 @@ link_filters(hid_t fapl, hbool_t new_format) /* Close file, get file size */ if (H5Fclose(fid) < 0) TEST_ERROR - filesize_filtered = h5_get_file_size(filename, fapl); - /* Check that the file size is smaller with the filter */ - if ((double)filesize_filtered > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) - TEST_ERROR + if (h5_using_default_driver(NULL)) { + filesize_filtered = h5_get_file_size(filename, fapl); + + /* Check that the file size is smaller with the filter */ + if ((double)filesize_filtered > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) + TEST_ERROR + } /* Close */ if (H5Pclose(fcpl) < 0) @@ -22544,8 +22550,9 @@ main(void) unsigned minimize_dset_oh; unsigned efc; /* Whether to use the external file cache */ const char *env_h5_drvr; /* File Driver value from environment */ + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; @@ -22611,88 +22618,100 @@ main(void) nerrors += test_deprec(my_fapl, new_format); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* tests for external link */ - /* Test external file cache first, so it sees the default efc setting on the fapl - */ - nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; + /* Skip external link tests for splitter VFD, which has external link-related bugs */ + if (HDstrcmp(env_h5_drvr, "splitter")) { - /* This test cannot run with the EFC because it assumes that an - * intermediate file is not held open - */ - nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; + /* tests for external link */ + /* Test external file cache first, so it sees the default efc setting on the fapl + */ + nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; - /* This test cannot run with the EFC because the EFC cannot currently - * reopen a cached file with a different intent - */ - nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + /* This test cannot run with the EFC because it assumes that an + * intermediate file is not held open + */ + nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; - /* Try external link tests both with and without the external file cache */ - for (efc = FALSE; efc <= TRUE; efc++) { - if (efc) { - if (H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR - HDprintf("\n---Testing with external file cache---\n"); - } /* end if */ - else { - if (H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR - HDprintf("\n---Testing without external file cache---\n"); - } /* end else */ + /* This test cannot run with the EFC because the EFC cannot currently + * reopen a cached file with a different intent + */ + nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; + + /* Try external link tests both with and without the external file cache */ + for (efc = FALSE; efc <= TRUE; efc++) { + if (efc) { + if (H5Pset_elink_file_cache_size(my_fapl, 8) < 0) + TEST_ERROR + HDprintf("\n---Testing with external file cache---\n"); + } /* end if */ + else { + if (H5Pset_elink_file_cache_size(my_fapl, 0) < 0) + TEST_ERROR + HDprintf("\n---Testing without external file cache---\n"); + } /* end else */ - nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += external_link_root_deprec(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_root_deprec(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; - 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; - 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; + nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0; + 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; + 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; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += external_link_query_deprec(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_query_deprec(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; - 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; - nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0; + 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; + nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0; #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0; #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += external_link_endian(new_format) < 0 ? 1 : 0; - nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; - - nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; - nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; + + if (!driver_uses_modified_filename) { + nerrors += external_link_endian(new_format) < 0 ? 1 : 0; + } + + nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0; + + nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0; + + if (!driver_uses_modified_filename) { + nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0; + } + + nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0; + nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0; #ifdef H5_HAVE_WINDOW_PATH - nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0; #endif - 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; - nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; - } /* with/without external file cache */ + 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; + nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + } /* with/without external file cache */ + } /* These tests assume that external links are a form of UD links, * so assume that everything that passed for external links diff --git a/test/links_env.c b/test/links_env.c index 590be20..7170132 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -152,8 +152,20 @@ error: int main(void) { - hid_t fapl; /* File access property lists */ - int nerrors = 0; /* Error from tests */ + const char *env_h5_drvr; /* File driver value from environment */ + hid_t fapl; /* File access property lists */ + int nerrors = 0; /* Error from tests */ + + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* Splitter VFD has issues with external links */ + if (!HDstrcmp(env_h5_drvr, "splitter")) { + HDputs(" -- SKIPPED for incompatible VFD --"); + HDexit(EXIT_SUCCESS); + } h5_reset(); fapl = h5_fileaccess(); @@ -223,15 +223,16 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2; haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF; hsize_t ma_size = 0; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t suitable_vfd; TESTING("H5MM_alloc() of file allocation"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); - if (contig_addr_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -371,15 +372,16 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) haddr_t addr = 0; haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF; hsize_t ma_size = 0, new_ma_size = 0; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t suitable_vfd; TESTING("H5MF_try_shrink() of file allocation: test 1"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); - if (contig_addr_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -478,9 +480,9 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of file allocation: test 2"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - if (contig_addr_vfd) { + if (suitable_vfd) { /* Re-open the file with meta/small data setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -528,9 +530,9 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of file allocation: test 3"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - if (contig_addr_vfd) { + if (suitable_vfd) { /* Re-open the file with meta/small data setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -573,9 +575,9 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of file allocation: test 4"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - if (contig_addr_vfd) { + if (suitable_vfd) { /* Re-open the file with meta/small data setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -658,15 +660,16 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) htri_t was_extended; haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF; hsize_t ma_size = 0, new_ma_size = 0; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t suitable_vfd; TESTING("H5MF_try_extend() of file allocation: test 1"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); - if (contig_addr_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -763,9 +766,9 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_extend() of file allocation: test 2"); /* Skip test when using VFDs that has different address spaces for each - * type of metadata allocation. + * type of metadata allocation. Also skip test for Direct VFD. */ - if (contig_addr_vfd) { + if (suitable_vfd) { /* Re-open the file with meta/small data setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) FAIL_STACK_ERROR @@ -2188,13 +2191,14 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2; haddr_t ma_addr = HADDR_UNDEF; hsize_t ma_size = 0; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator:test 1"); - /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); - if (contig_addr_vfd) { + /* Skip test when using VFDs that don't use the metadata aggregator. Also skip test for Direct VFD. */ + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2339,13 +2343,14 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) haddr_t addr1, addr2, addr3; haddr_t ma_addr = HADDR_UNDEF; hsize_t ma_size = 0; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator:test 2"); - /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0); - if (contig_addr_vfd) { + /* Skip test when using VFDs that don't use the metadata aggregator. Also skip test for Direct VFD. */ + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && + HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3847,16 +3852,17 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) htri_t was_extended; H5FS_stat_t state; hsize_t alignment = 0, mis_align = 0, tmp = 0, accum = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MM_alloc() of file allocation with alignment: test 1"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3966,9 +3972,10 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TESTING("H5MF_try_shrink() of file allocation with alignment: test 2"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - if (have_alloc_vfd) { + if (suitable_vfd) { /* Re-open the file with alignment and meta/sdata setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0) FAIL_STACK_ERROR @@ -4023,9 +4030,10 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TESTING("H5MF_try_extend() of file allocation with alignment: test 3"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - if (have_alloc_vfd) { + if (suitable_vfd) { /* Re-open the file with alignment and meta/sdata setting */ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl1)) < 0) FAIL_STACK_ERROR @@ -4080,6 +4088,9 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ + if (fapl1 >= 0 && H5Pclose(fapl1) < 0) + FAIL_STACK_ERROR + return (0); error: @@ -4135,7 +4146,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) H5FS_stat_t state; htri_t was_extended; hsize_t alignment = 0, tmp = 0, mis_align = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of free-space manager with alignment: test 1"); @@ -4297,10 +4308,11 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Skip test when using VFDs that have their own 'alloc' callback, which * don't push mis-aligned space fragments on the file free space list + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { if ((file_size = h5_get_file_size(filename, new_fapl)) < 0) TEST_ERROR @@ -4497,16 +4509,17 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr = HADDR_UNDEF; hsize_t ma_size = 0, mis_align = 0; hsize_t alignment = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 1"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4759,16 +4772,17 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF; hsize_t ma_size = 0, sdata_size = 0, mis_align = 0; hsize_t alignment = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 2"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5104,16 +5118,17 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF; hsize_t ma_size = 0, sdata_size = 0, mis_align = 0; hsize_t alignment = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 3"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5417,16 +5432,17 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr = HADDR_UNDEF; hsize_t ma_size = 0, saved_ma_size = 0; hsize_t alignment = 0, mis_align = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 4"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5635,16 +5651,17 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t sdata_addr = HADDR_UNDEF, new_sdata_addr = HADDR_UNDEF; hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0, new_sdata_size = 0; hsize_t alignment = 0, mis_align = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 5"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5905,16 +5922,17 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF, sdata_addr = HADDR_UNDEF; hsize_t ma_size = 0, new_ma_size = 0, sdata_size = 0; hsize_t alignment = 0, mis_align = 0, tmp = 0; - hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ + hbool_t suitable_vfd; TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 6"); /* Skip test when using VFDs that have their own 'alloc' callback, which - * don't push mis-aligned space fragments on the file free space list + * don't push mis-aligned space fragments on the file free space list. + * Also skip test for Direct VFD. */ - have_alloc_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && - HDstrcmp(env_h5_drvr, "multi") != 0); - if (have_alloc_vfd) { + suitable_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "stdio") != 0 && HDstrcmp(env_h5_drvr, "split") != 0 && + HDstrcmp(env_h5_drvr, "multi") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0); + if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -6139,20 +6157,23 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) /* Add alignment to member files for split/multi driver */ if (split || multi) { - hid_t memb_fapl; + if (split) { + hid_t memb_fapl_arr[H5FD_MEM_NTYPES]; - /* Creat fapl */ - if ((memb_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - TEST_ERROR + /* Get current multi settings */ + if (H5Pget_fapl_multi(copied_fapl, NULL, memb_fapl_arr, NULL, NULL, NULL) < 0) + TEST_ERROR - /* Set alignment. Note that it is the block size of the parent FAPL that - * is important here. */ - if (H5Pset_alignment(memb_fapl, 0, align) < 0) - TEST_ERROR + /* Set alignment. Note that it is the block size of the parent FAPL that + * is important here. */ + if (H5Pset_alignment(memb_fapl_arr[H5FD_MEM_SUPER], 0, align) < 0) + TEST_ERROR + if (H5Pset_alignment(memb_fapl_arr[H5FD_MEM_DRAW], 0, align) < 0) + TEST_ERROR - if (split) { /* Set split driver with new FAPLs */ - if (H5Pset_fapl_split(copied_fapl, "-m.h5", memb_fapl, "-r.h5", memb_fapl) < 0) + if (H5Pset_fapl_split(copied_fapl, "-m.h5", memb_fapl_arr[H5FD_MEM_SUPER], "-r.h5", + memb_fapl_arr[H5FD_MEM_DRAW]) < 0) TEST_ERROR } /* end if */ else { @@ -6165,14 +6186,17 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) /* Get current multi settings */ HDmemset(memb_name, 0, sizeof memb_name); - if (H5Pget_fapl_multi(copied_fapl, memb_map, NULL, memb_name, memb_addr, &relax) < 0) + if (H5Pget_fapl_multi(copied_fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0) TEST_ERROR /* Populate memb_fapl_arr, patch memb_addr so member file addresses * are aligned */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { - memb_fapl_arr[mt] = memb_fapl; - memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align; + /* Set alignment. Note that it is the block size of the parent FAPL that + * is important here. */ + if (H5Pset_alignment(memb_fapl_arr[mt], 0, align) < 0) + TEST_ERROR + memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align; } /* end for */ /* Set multi driver with new FAPLs */ @@ -6184,11 +6208,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) HDfree(memb_name[mt]); } /* end else */ - - /* Close memb_fapl */ - if (H5Pclose(memb_fapl) < 0) - TEST_ERROR - } /* end if */ + } /* end if */ /* Reopen the file with alignment */ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, copied_fapl)) < 0) @@ -6253,6 +6273,9 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) PASSED(); + if (H5Pclose(copied_fapl) < 0) + TEST_ERROR + /* Close file */ if (H5Fclose(file) < 0) TEST_ERROR @@ -9128,7 +9151,7 @@ main(void) hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; diff --git a/test/mtime.c b/test/mtime.c index 43dc502..10cafd1 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -60,6 +60,7 @@ main(void) signed char buf1[32], buf2[32]; char filename[1024]; int token_cmp; + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); h5_reset(); fapl = h5_fileaccess(); @@ -131,63 +132,67 @@ main(void) } PASSED(); - /* Check opening existing file with old-style modification time information - * and make certain that the time is correct - */ - TESTING("accessing old modification time messages"); - - { - const char *testfile = H5_get_srcdir_filename(TESTFILE1); /* Corrected test file name */ - - file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); - if (file >= 0) { - if (H5Oget_info_by_name3(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) - TEST_ERROR; - if (oi1.ctime != MTIME1) { + if (!driver_uses_modified_filename) { + /* Check opening existing file with old-style modification time information + * and make certain that the time is correct + */ + TESTING("accessing old modification time messages"); + + { + const char *testfile = H5_get_srcdir_filename(TESTFILE1); /* Corrected test file name */ + + file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + if (file >= 0) { + if (H5Oget_info_by_name3(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0) + TEST_ERROR; + if (oi1.ctime != MTIME1) { + H5_FAILED(); + /* If this fails, examine H5Omtime.c. Modification time is very + * system dependent (e.g., on Windows DST must be hardcoded). */ + HDputs(" Old modification time incorrect"); + goto error; + } + if (H5Fclose(file) < 0) + TEST_ERROR; + } + else { H5_FAILED(); - /* If this fails, examine H5Omtime.c. Modification time is very - * system dependent (e.g., on Windows DST must be hardcoded). */ - HDputs(" Old modification time incorrect"); + HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); goto error; - } - if (H5Fclose(file) < 0) - TEST_ERROR; + } /* end else */ } - else { - H5_FAILED(); - HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); - goto error; - } /* end else */ + PASSED(); } - PASSED(); - /* Check opening existing file with new-style modification time information - * and make certain that the time is correct - */ - TESTING("accessing new modification time messages"); - - { - const char *testfile = H5_get_srcdir_filename(TESTFILE2); /* Corrected test file name */ - - file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); - if (file >= 0) { - if (H5Oget_info_by_name3(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) - TEST_ERROR; - if (oi2.ctime != MTIME2) { + if (!driver_uses_modified_filename) { + /* Check opening existing file with new-style modification time information + * and make certain that the time is correct + */ + TESTING("accessing new modification time messages"); + + { + const char *testfile = H5_get_srcdir_filename(TESTFILE2); /* Corrected test file name */ + + file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); + if (file >= 0) { + if (H5Oget_info_by_name3(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0) + TEST_ERROR; + if (oi2.ctime != MTIME2) { + H5_FAILED(); + HDputs(" Modification time incorrect."); + goto error; + } + if (H5Fclose(file) < 0) + TEST_ERROR; + } + else { H5_FAILED(); - HDputs(" Modification time incorrect."); + HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); goto error; - } - if (H5Fclose(file) < 0) - TEST_ERROR; + } /* end else */ } - else { - H5_FAILED(); - HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); - goto error; - } /* end else */ + PASSED(); } - PASSED(); /* Verify symbol table messages are cached */ if (h5_verify_cached_stabs(FILENAME, fapl) < 0) diff --git a/test/ntypes.c b/test/ntypes.c index 13cc72a..37a63a4 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -3131,11 +3131,19 @@ main(void) nerrors += test_enum_dtype(file) < 0 ? 1 : 0; nerrors += test_array_dtype(file) < 0 ? 1 : 0; nerrors += test_array_dtype2(file) < 0 ? 1 : 0; - nerrors += test_vl_dtype(file) < 0 ? 1 : 0; - nerrors += test_vlstr_dtype(file) < 0 ? 1 : 0; + + if (!h5_using_parallel_driver(NULL)) { + nerrors += test_vl_dtype(file) < 0 ? 1 : 0; + nerrors += test_vlstr_dtype(file) < 0 ? 1 : 0; + } + nerrors += test_str_dtype(file) < 0 ? 1 : 0; - nerrors += test_refer_dtype(file) < 0 ? 1 : 0; - nerrors += test_refer_dtype2(file) < 0 ? 1 : 0; + + if (!h5_using_parallel_driver(NULL)) { + nerrors += test_refer_dtype(file) < 0 ? 1 : 0; + nerrors += test_refer_dtype2(file) < 0 ? 1 : 0; + } + nerrors += test_opaque_dtype(file) < 0 ? 1 : 0; nerrors += test_bitfield_dtype(file) < 0 ? 1 : 0; nerrors += test_ninteger() < 0 ? 1 : 0; diff --git a/test/null_vfd_plugin.c b/test/null_vfd_plugin.c new file mode 100644 index 0000000..8031484 --- /dev/null +++ b/test/null_vfd_plugin.c @@ -0,0 +1,131 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Purpose: A simple Virtual File Driver (VFD) with almost no functionality + * that is used for testing basic VFD plugin handling (registration, etc.). + */ + +/* Public HDF5 headers */ +#include "hdf5.h" + +/* For HDF5 plugin functionality */ +#include "H5PLextern.h" + +/* This driver's header */ +#include "null_vfd_plugin.h" + +/* Prototypes */ +static H5FD_t *H5FD_null_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); +static herr_t H5FD_null_close(H5FD_t *_file); +static herr_t H5FD_null_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + void *buf); +static herr_t H5FD_null_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, + const void *buf); +static haddr_t H5FD_null_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_null_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD_null_get_eof(const H5FD_t *_file, H5FD_mem_t type); + +static const H5FD_class_t H5FD_null_g = { + NULL_VFD_VALUE, /* value */ + NULL_VFD_NAME, /* name */ + 1, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + NULL, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD_null_open, /* open */ + H5FD_null_close, /* close */ + NULL, /* cmp */ + NULL, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD_null_get_eoa, /* get_eoa */ + H5FD_null_set_eoa, /* set_eoa */ + H5FD_null_get_eof, /* get_eof */ + NULL, /* get_handle */ + H5FD_null_read, /* read */ + H5FD_null_write, /* write */ + NULL, /* flush */ + NULL, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + NULL, /* del */ + NULL, /* ctl */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ +}; + +static H5FD_t * +H5FD_null_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) +{ + return NULL; +} + +static herr_t +H5FD_null_close(H5FD_t *_file) +{ + return 0; +} + +static herr_t +H5FD_null_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf) +{ + return 0; +} + +static herr_t +H5FD_null_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf) +{ + return 0; +} + +static haddr_t +H5FD_null_get_eoa(const H5FD_t *_file, H5FD_mem_t type) +{ + return HADDR_UNDEF; +} + +static herr_t +H5FD_null_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) +{ + return 0; +} + +static haddr_t +H5FD_null_get_eof(const H5FD_t *_file, H5FD_mem_t type) +{ + return HADDR_UNDEF; +} + +/* These two functions are necessary to load this plugin using + * the HDF5 library. + */ + +H5PL_type_t +H5PLget_plugin_type(void) +{ + return H5PL_TYPE_VFD; +} + +const void * +H5PLget_plugin_info(void) +{ + return &H5FD_null_g; +} diff --git a/test/null_vfd_plugin.h b/test/null_vfd_plugin.h new file mode 100644 index 0000000..7b7671f --- /dev/null +++ b/test/null_vfd_plugin.h @@ -0,0 +1,33 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The public header file for the null testing VFD plugin. + */ +#ifndef H5FDnull_H +#define H5FDnull_H + +#define H5FD_NULL (H5FD_null_init()) +#define NULL_VFD_NAME "null_vfd_plugin" +#define NULL_VFD_VALUE ((H5FD_class_value_t)200) + +#ifdef __cplusplus +extern "C" { +#endif + +H5_DLL hid_t H5FD_null_init(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/test/objcopy.c b/test/objcopy.c index e01083d..c8a5bac 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -17305,13 +17305,18 @@ error: int main(void) { - int nerrors = 0; - hid_t fapl, fapl2; - hid_t fcpl_shared, ocpl; - unsigned max_compact, min_dense; - int configuration; /* Configuration of tests. */ - int ExpressMode; - hbool_t same_file; /* Whether to run tests that only use one file */ + int nerrors = 0; + hid_t fapl, fapl2; + hid_t fcpl_shared, ocpl; + unsigned max_compact, min_dense; + int configuration; /* Configuration of tests. */ + int ExpressMode; + const char *env_h5_drvr; /* File Driver value from environment */ + hbool_t same_file; /* Whether to run tests that only use one file */ + + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; /* Setup */ h5_reset(); @@ -17468,9 +17473,14 @@ main(void) FALSE, "H5Ocopy(): expand soft link"); nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, "H5Ocopy(): expand external link"); - nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, - H5O_COPY_EXPAND_SOFT_LINK_FLAG | H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, - "H5Ocopy(): expand soft and external links"); + + /* Splitter VFD currently has external link-related bugs */ + if (HDstrcmp(env_h5_drvr, "splitter")) { + nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, + H5O_COPY_EXPAND_SOFT_LINK_FLAG | H5O_COPY_EXPAND_EXT_LINK_FLAG, FALSE, + "H5Ocopy(): expand soft and external links"); + } + nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_SHALLOW_HIERARCHY_FLAG, FALSE, "H5Ocopy(): shallow group copy"); nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl, H5O_COPY_EXPAND_REFERENCE_FLAG, @@ -17548,9 +17558,14 @@ main(void) nerrors += test_copy_same_file_named_datatype(fcpl_src, src_fapl); - /* Test with dataset opened in the file or not */ - nerrors += test_copy_old_layout(fcpl_dst, dst_fapl, FALSE); - nerrors += test_copy_old_layout(fcpl_dst, dst_fapl, TRUE); + /* Check if current driver might modify the filename. Skip these tests + * if so, since the file is pre-generated. + */ + if (!h5_driver_uses_modified_filename()) { + /* Test with dataset opened in the file or not */ + nerrors += test_copy_old_layout(fcpl_dst, dst_fapl, FALSE); + nerrors += test_copy_old_layout(fcpl_dst, dst_fapl, TRUE); + } /* Test with dataset opened in the file or not */ nerrors += test_copy_null_ref(fcpl_src, fcpl_dst, src_fapl, dst_fapl); diff --git a/test/ohdr.c b/test/ohdr.c index d28b11e..60d32b7 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -34,6 +34,13 @@ #define H5G_FRIEND /* suppress error about including H5Gpkg */ #include "H5Gpkg.h" +/* + * This file needs to access private routines from the H5FD package. + */ +#define H5FD_FRIEND /* suppress error about including H5FDpkg */ +#define H5FD_TESTING +#include "H5FDpkg.h" + const char *FILENAME[] = {"ohdr", "ohdr_min_a", "ohdr_min_b", NULL}; /* used for object header size comparison */ @@ -1813,13 +1820,12 @@ main(void) herr_t ret; /* Generic return value */ /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; /* Check for VFD which stores data in multiple files */ - single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0); + single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, 0); /* Reset library */ h5_reset(); @@ -2107,11 +2113,15 @@ main(void) if (h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR - /* A test to exercise the re-read of the object header for SWMR access */ - if (test_ohdr_swmr(TRUE) < 0) - TEST_ERROR - if (test_ohdr_swmr(FALSE) < 0) - TEST_ERROR + if (H5FD__supports_swmr_test(env_h5_drvr)) { + /* A test to exercise the re-read of the object header for SWMR access */ + if (test_ohdr_swmr(TRUE) < 0) + TEST_ERROR + if (test_ohdr_swmr(FALSE) < 0) + TEST_ERROR + } + else + HDputs("Skipped SWMR tests for SWMR-incompatible VFD"); /* Pop API context */ if (api_ctx_pushed && H5CX_pop(FALSE) < 0) diff --git a/test/page_buffer.c b/test/page_buffer.c index b80d330..cb59fda 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -2153,7 +2153,7 @@ main(void) h5_reset(); /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; diff --git a/test/reserved.c b/test/reserved.c index 6e41a16..f864329 100644 --- a/test/reserved.c +++ b/test/reserved.c @@ -489,7 +489,7 @@ main(void) hid_t fapl; const char *envval = NULL; - envval = HDgetenv("HDF5_DRIVER"); + envval = HDgetenv(HDF5_DRIVER); if (envval == NULL) envval = "nomatch"; /* QAK: should be able to use the core driver? */ diff --git a/test/set_extent.c b/test/set_extent.c index 3078c2d..ab2a443 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -117,7 +117,7 @@ main(void) const char *env_h5_drvr; /* File Driver value from environment */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; /* Current VFD that does not support contigous address space */ @@ -343,35 +343,42 @@ do_ranks(hid_t fapl, hbool_t new_format) goto error; } /* end if */ - /* VL test */ - if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) { - DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length") - HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE - ? "btree" - : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); - goto error; - } /* end if */ - - /* Sparse allocation test (regular and VL) */ - if (!(config & CONFIG_EARLY_ALLOC)) { - if (test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < 0) { - DO_RANKS_PRINT_CONFIG("Randomized rank 4 with sparse allocation") + if (!h5_using_parallel_driver(NULL)) { + /* VL test */ + if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < + 0) { + DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length") HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; } /* end if */ - if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < - 0) { - DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length with sparse allocation") + } + + /* Sparse allocation test (regular and VL) */ + if (!(config & CONFIG_EARLY_ALLOC)) { + if (test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < 0) { + DO_RANKS_PRINT_CONFIG("Randomized rank 4 with sparse allocation") HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; } /* end if */ - } /* end if */ + + if (!h5_using_parallel_driver(NULL)) { + if (test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, + index_type) < 0) { + DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length with sparse allocation") + HDprintf(" Index: %s\n", + index_type == RANK4_INDEX_BTREE + ? "btree" + : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); + goto error; + } /* end if */ + } + } /* end if */ /* Break out if using the old format */ if (!new_format) diff --git a/test/stab.c b/test/stab.c index 798619d..31ff497 100644 --- a/test/stab.c +++ b/test/stab.c @@ -1417,10 +1417,11 @@ main(void) unsigned new_format; /* Whether to use the new format or not */ const char *env_h5_drvr; /* File Driver value from environment */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ - int nerrors = 0; + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); + int nerrors = 0; /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; @@ -1473,14 +1474,21 @@ main(void) if (contig_addr_vfd) { nerrors += lifecycle(fcpl2, fapl2); nerrors += long_compact(fcpl2, fapl2); - nerrors += read_old(); + + if (!driver_uses_modified_filename) { + nerrors += read_old(); + } + nerrors += no_compact(fcpl2, fapl2); nerrors += gcpl_on_root(fapl2); } /* Old group API specific tests */ nerrors += old_api(fapl); - nerrors += corrupt_stab_msg(); + + if (!driver_uses_modified_filename) { + nerrors += corrupt_stab_msg(); + } /* Close 2nd FAPL */ H5Pclose(fapl2); diff --git a/test/swmr.c b/test/swmr.c index 24a0b7c..e6fdb47 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -6270,13 +6270,13 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri /* If requested, set the environment variable */ if (env_var_override) { - if (HDsetenv("HDF5_USE_FILE_LOCKING", turn_locking_on ? "FALSE" : "TRUE", TRUE) < 0) + if (HDsetenv(HDF5_USE_FILE_LOCKING, turn_locking_on ? "FALSE" : "TRUE", TRUE) < 0) TEST_ERROR if (H5F__reparse_file_lock_variable_test() < 0) TEST_ERROR } else { - if (HDsetenv("HDF5_USE_FILE_LOCKING", "", TRUE) < 0) + if (HDsetenv(HDF5_USE_FILE_LOCKING, "", TRUE) < 0) TEST_ERROR if (H5F__reparse_file_lock_variable_test() < 0) TEST_ERROR @@ -7367,7 +7367,7 @@ main(void) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); if (!H5FD__supports_swmr_test(driver)) { HDprintf("This VFD does not support SWMR I/O\n"); return EXIT_SUCCESS; @@ -7377,7 +7377,7 @@ main(void) * about file locking. File locking should be used unless explicitly * disabled. */ - lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING"); + lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING); if (lock_env_var && !HDstrcmp(lock_env_var, "FALSE")) use_file_locking = FALSE; else diff --git a/test/swmr_check_compat_vfd.c b/test/swmr_check_compat_vfd.c index 4133696..720c747 100644 --- a/test/swmr_check_compat_vfd.c +++ b/test/swmr_check_compat_vfd.c @@ -43,7 +43,7 @@ main(void) { char *driver = NULL; - driver = HDgetenv("HDF5_DRIVER"); + driver = HDgetenv(HDF5_DRIVER); if (H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS; diff --git a/test/tarray.c b/test/tarray.c index af167a7..3b17239 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -2217,8 +2217,10 @@ test_array(void) test_array_bkg(); /* Read compound datatype with array fields and background fields read */ - /* This test uses a custom file */ - test_compat(); /* Test compatibility changes for compound datatype fields */ + if (!h5_driver_uses_modified_filename()) { + /* This test uses a custom file */ + test_compat(); /* Test compatibility changes for compound datatype fields */ + } } /* end test_array() */ diff --git a/test/tattr.c b/test/tattr.c index 756e139..b807bce 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -2274,9 +2274,11 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_create() */ /**************************************************************** @@ -2418,9 +2420,11 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_open() */ /**************************************************************** @@ -2448,6 +2452,10 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ + /* Only run this test for sec2/default driver */ + if (!h5_using_default_driver(NULL)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Attributes in Dense Storage\n")); @@ -2611,9 +2619,11 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_delete() */ /**************************************************************** @@ -2643,6 +2653,10 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) unsigned use_corder; /* Track creation order or not */ herr_t ret; /* Generic return value */ + /* Only run this test for sec2/default driver */ + if (!h5_using_default_driver(NULL)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing Renaming Attributes in Dense Storage\n")); @@ -2802,9 +2816,11 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_rename() */ /**************************************************************** @@ -2833,6 +2849,10 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) int use_min_dset_oh = (dcpl_g != H5P_DEFAULT); herr_t ret; /* Generic return value */ + /* Only run this test for sec2/default driver */ + if (!h5_using_default_driver(NULL)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing Unlinking Object with Attributes in Dense Storage\n")); @@ -2945,9 +2965,11 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_unlink() */ /**************************************************************** @@ -3109,9 +3131,11 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_dense_limits() */ /**************************************************************** @@ -3896,9 +3920,11 @@ test_attr_big(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_big() */ /**************************************************************** @@ -4105,9 +4131,11 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) ret = H5Sclose(null_sid); CHECK(ret, FAIL, "H5Sclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* test_attr_null_space() */ /**************************************************************** @@ -8705,9 +8733,11 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* end for */ /* Close dataspaces */ @@ -9151,9 +9181,11 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* end for */ /* Close dataspaces */ @@ -9521,9 +9553,11 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* end for */ /* Close dataspaces */ @@ -9878,9 +9912,11 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); - /* Check size of file */ - filesize = h5_get_file_size(FILENAME, fapl); - VERIFY(filesize, empty_filesize, "h5_get_file_size"); + if (h5_using_default_driver(NULL)) { + /* Check size of file */ + filesize = h5_get_file_size(FILENAME, fapl); + VERIFY(filesize, empty_filesize, "h5_get_file_size"); + } } /* end for */ /* Close dataspaces */ diff --git a/test/testhdf5.c b/test/testhdf5.c index 45c0f9f..dc5f0aa 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -81,7 +81,7 @@ main(int argc, char *argv[]) TestSummary(); /* Clean up test files, if allowed */ - if (GetTestCleanup() && !HDgetenv("HDF5_NOCLEANUP")) + if (GetTestCleanup() && !HDgetenv(HDF5_NOCLEANUP)) TestCleanup(); /* Release test infrastructure */ diff --git a/test/tfile.c b/test/tfile.c index 0014d08..47d1b67 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -35,6 +35,10 @@ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg.h */ +#define H5FD_TESTING +#include "H5FDpkg.h" + #define H5D_FRIEND /*suppress error about including H5Dpkg */ #include "H5Dpkg.h" /* Dataset access */ @@ -176,8 +180,8 @@ const char *FILESPACE_NAME[] = {"tfilespace", NULL}; #define DSET_DS1 "DS1" /* Local test function declarations for version bounds */ -static void test_libver_bounds_low_high(void); -static void test_libver_bounds_super(hid_t fapl); +static void test_libver_bounds_low_high(const char *env_h5_drvr); +static void test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr); static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); static void test_libver_bounds_obj(hid_t fapl); @@ -304,186 +308,189 @@ test_file_create(void) VERIFY(ret, FAIL, "H5Pclose"); #endif - /* Create a new file with a non-standard file-creation template */ - tmpl1 = H5Pcreate(H5P_FILE_CREATE); - CHECK(tmpl1, FAIL, "H5Pcreate"); + if (h5_using_default_driver(NULL)) { - /* Try setting some bad userblock sizes */ - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE1); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE2); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE3); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE4); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE5); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE6); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - H5E_BEGIN_TRY - { - ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE7); - } - H5E_END_TRY; - VERIFY(ret, FAIL, "H5Pset_userblock"); - - /* Set the new file-creation parameters */ - ret = H5Pset_userblock(tmpl1, F2_USERBLOCK_SIZE); - CHECK(ret, FAIL, "H5Pset_userblock"); + /* Create a new file with a non-standard file-creation template */ + tmpl1 = H5Pcreate(H5P_FILE_CREATE); + CHECK(tmpl1, FAIL, "H5Pcreate"); - ret = H5Pset_sizes(tmpl1, (size_t)F2_OFFSET_SIZE, (size_t)F2_LENGTH_SIZE); - CHECK(ret, FAIL, "H5Pset_sizes"); + /* Try setting some bad userblock sizes */ + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE1); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE2); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE3); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE4); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE5); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE6); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); + H5E_BEGIN_TRY + { + ret = H5Pset_userblock(tmpl1, BAD_USERBLOCK_SIZE7); + } + H5E_END_TRY; + VERIFY(ret, FAIL, "H5Pset_userblock"); - ret = H5Pset_sym_k(tmpl1, F2_SYM_INTERN_K, F2_SYM_LEAF_K); - CHECK(ret, FAIL, "H5Pset_sym_k"); + /* Set the new file-creation parameters */ + ret = H5Pset_userblock(tmpl1, F2_USERBLOCK_SIZE); + CHECK(ret, FAIL, "H5Pset_userblock"); - /* - * Try to create second file, with non-standard file-creation template - * params. - */ - fid2 = H5Fcreate(FILE2, H5F_ACC_TRUNC, tmpl1, H5P_DEFAULT); - CHECK(fid2, FAIL, "H5Fcreate"); + ret = H5Pset_sizes(tmpl1, (size_t)F2_OFFSET_SIZE, (size_t)F2_LENGTH_SIZE); + CHECK(ret, FAIL, "H5Pset_sizes"); - /* Release file-creation template */ - ret = H5Pclose(tmpl1); - CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pset_sym_k(tmpl1, F2_SYM_INTERN_K, F2_SYM_LEAF_K); + CHECK(ret, FAIL, "H5Pset_sym_k"); - /* Make certain we can create a dataset properly in the file with the userblock */ - { - hid_t dataset_id, dataspace_id; /* identifiers */ - hsize_t dims[F2_RANK]; - unsigned data[F2_DIM0][F2_DIM1]; - unsigned i, j; + /* + * Try to create second file, with non-standard file-creation template + * params. + */ + fid2 = H5Fcreate(FILE2, H5F_ACC_TRUNC, tmpl1, H5P_DEFAULT); + CHECK(fid2, FAIL, "H5Fcreate"); - /* Create the data space for the dataset. */ - dims[0] = F2_DIM0; - dims[1] = F2_DIM1; - dataspace_id = H5Screate_simple(F2_RANK, dims, NULL); - CHECK(dataspace_id, FAIL, "H5Screate_simple"); + /* Release file-creation template */ + ret = H5Pclose(tmpl1); + CHECK(ret, FAIL, "H5Pclose"); - /* Create the dataset. */ - dataset_id = - H5Dcreate2(fid2, F2_DSET, H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(dataset_id, FAIL, "H5Dcreate2"); + /* Make certain we can create a dataset properly in the file with the userblock */ + { + hid_t dataset_id, dataspace_id; /* identifiers */ + hsize_t dims[F2_RANK]; + unsigned data[F2_DIM0][F2_DIM1]; + unsigned i, j; + + /* Create the data space for the dataset. */ + dims[0] = F2_DIM0; + dims[1] = F2_DIM1; + dataspace_id = H5Screate_simple(F2_RANK, dims, NULL); + CHECK(dataspace_id, FAIL, "H5Screate_simple"); + + /* Create the dataset. */ + dataset_id = H5Dcreate2(fid2, F2_DSET, H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, + H5P_DEFAULT); + CHECK(dataset_id, FAIL, "H5Dcreate2"); + + for (i = 0; i < F2_DIM0; i++) + for (j = 0; j < F2_DIM1; j++) + data[i][j] = i * 10 + j; + + /* Write data to the new dataset */ + ret = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + CHECK(ret, FAIL, "H5Dwrite"); + + /* End access to the dataset and release resources used by it. */ + ret = H5Dclose(dataset_id); + CHECK(ret, FAIL, "H5Dclose"); - for (i = 0; i < F2_DIM0; i++) - for (j = 0; j < F2_DIM1; j++) - data[i][j] = i * 10 + j; + /* Terminate access to the data space. */ + ret = H5Sclose(dataspace_id); + CHECK(ret, FAIL, "H5Sclose"); + } - /* Write data to the new dataset */ - ret = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); - CHECK(ret, FAIL, "H5Dwrite"); + /* Get the file-creation template */ + tmpl1 = H5Fget_create_plist(fid2); + CHECK(tmpl1, FAIL, "H5Fget_create_plist"); - /* End access to the dataset and release resources used by it. */ - ret = H5Dclose(dataset_id); - CHECK(ret, FAIL, "H5Dclose"); + /* Get the file-creation parameters */ + ret = H5Pget_userblock(tmpl1, &ublock); + CHECK(ret, FAIL, "H5Pget_userblock"); + VERIFY(ublock, F2_USERBLOCK_SIZE, "H5Pget_userblock"); - /* Terminate access to the data space. */ - ret = H5Sclose(dataspace_id); - CHECK(ret, FAIL, "H5Sclose"); - } + ret = H5Pget_sizes(tmpl1, &parm, &parm2); + CHECK(ret, FAIL, "H5Pget_sizes"); + VERIFY(parm, F2_OFFSET_SIZE, "H5Pget_sizes"); + VERIFY(parm2, F2_LENGTH_SIZE, "H5Pget_sizes"); - /* Get the file-creation template */ - tmpl1 = H5Fget_create_plist(fid2); - CHECK(tmpl1, FAIL, "H5Fget_create_plist"); + ret = H5Pget_sym_k(tmpl1, &iparm, &iparm2); + CHECK(ret, FAIL, "H5Pget_sym_k"); + VERIFY(iparm, F2_SYM_INTERN_K, "H5Pget_sym_k"); + VERIFY(iparm2, F2_SYM_LEAF_K, "H5Pget_sym_k"); - /* Get the file-creation parameters */ - ret = H5Pget_userblock(tmpl1, &ublock); - CHECK(ret, FAIL, "H5Pget_userblock"); - VERIFY(ublock, F2_USERBLOCK_SIZE, "H5Pget_userblock"); + /* Clone the file-creation template */ + tmpl2 = H5Pcopy(tmpl1); + CHECK(tmpl2, FAIL, "H5Pcopy"); - ret = H5Pget_sizes(tmpl1, &parm, &parm2); - CHECK(ret, FAIL, "H5Pget_sizes"); - VERIFY(parm, F2_OFFSET_SIZE, "H5Pget_sizes"); - VERIFY(parm2, F2_LENGTH_SIZE, "H5Pget_sizes"); + /* Release file-creation template */ + ret = H5Pclose(tmpl1); + CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pget_sym_k(tmpl1, &iparm, &iparm2); - CHECK(ret, FAIL, "H5Pget_sym_k"); - VERIFY(iparm, F2_SYM_INTERN_K, "H5Pget_sym_k"); - VERIFY(iparm2, F2_SYM_LEAF_K, "H5Pget_sym_k"); + /* Set the new file-creation parameter */ + ret = H5Pset_userblock(tmpl2, F3_USERBLOCK_SIZE); + CHECK(ret, FAIL, "H5Pset_userblock"); - /* Clone the file-creation template */ - tmpl2 = H5Pcopy(tmpl1); - CHECK(tmpl2, FAIL, "H5Pcopy"); + /* + * Try to create second file, with non-standard file-creation template + * params + */ + fid3 = H5Fcreate(FILE3, H5F_ACC_TRUNC, tmpl2, H5P_DEFAULT); + CHECK(fid3, FAIL, "H5Fcreate"); - /* Release file-creation template */ - ret = H5Pclose(tmpl1); - CHECK(ret, FAIL, "H5Pclose"); + /* Release file-creation template */ + ret = H5Pclose(tmpl2); + CHECK(ret, FAIL, "H5Pclose"); - /* Set the new file-creation parameter */ - ret = H5Pset_userblock(tmpl2, F3_USERBLOCK_SIZE); - CHECK(ret, FAIL, "H5Pset_userblock"); + /* Get the file-creation template */ + tmpl1 = H5Fget_create_plist(fid3); + CHECK(tmpl1, FAIL, "H5Fget_create_plist"); - /* - * Try to create second file, with non-standard file-creation template - * params - */ - fid3 = H5Fcreate(FILE3, H5F_ACC_TRUNC, tmpl2, H5P_DEFAULT); - CHECK(fid3, FAIL, "H5Fcreate"); + /* Get the file-creation parameters */ + ret = H5Pget_userblock(tmpl1, &ublock); + CHECK(ret, FAIL, "H5Pget_userblock"); + VERIFY(ublock, F3_USERBLOCK_SIZE, "H5Pget_userblock"); - /* Release file-creation template */ - ret = H5Pclose(tmpl2); - CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pget_sizes(tmpl1, &parm, &parm2); + CHECK(ret, FAIL, "H5Pget_sizes"); + VERIFY(parm, F3_OFFSET_SIZE, "H5Pget_sizes"); + VERIFY(parm2, F3_LENGTH_SIZE, "H5Pget_sizes"); - /* Get the file-creation template */ - tmpl1 = H5Fget_create_plist(fid3); - CHECK(tmpl1, FAIL, "H5Fget_create_plist"); + ret = H5Pget_sym_k(tmpl1, &iparm, &iparm2); + CHECK(ret, FAIL, "H5Pget_sym_k"); + VERIFY(iparm, F3_SYM_INTERN_K, "H5Pget_sym_k"); + VERIFY(iparm2, F3_SYM_LEAF_K, "H5Pget_sym_k"); - /* Get the file-creation parameters */ - ret = H5Pget_userblock(tmpl1, &ublock); - CHECK(ret, FAIL, "H5Pget_userblock"); - VERIFY(ublock, F3_USERBLOCK_SIZE, "H5Pget_userblock"); - - ret = H5Pget_sizes(tmpl1, &parm, &parm2); - CHECK(ret, FAIL, "H5Pget_sizes"); - VERIFY(parm, F3_OFFSET_SIZE, "H5Pget_sizes"); - VERIFY(parm2, F3_LENGTH_SIZE, "H5Pget_sizes"); + /* Release file-creation template */ + ret = H5Pclose(tmpl1); + CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pget_sym_k(tmpl1, &iparm, &iparm2); - CHECK(ret, FAIL, "H5Pget_sym_k"); - VERIFY(iparm, F3_SYM_INTERN_K, "H5Pget_sym_k"); - VERIFY(iparm2, F3_SYM_LEAF_K, "H5Pget_sym_k"); + /* Close second file */ + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); - /* Release file-creation template */ - ret = H5Pclose(tmpl1); - CHECK(ret, FAIL, "H5Pclose"); + /* Close third file */ + ret = H5Fclose(fid3); + CHECK(ret, FAIL, "H5Fclose"); + } /* Close first file */ ret = H5Fclose(fid1); CHECK(ret, FAIL, "H5Fclose"); - - /* Close second file */ - ret = H5Fclose(fid2); - CHECK(ret, FAIL, "H5Fclose"); - - /* Close third file */ - ret = H5Fclose(fid3); - CHECK(ret, FAIL, "H5Fclose"); } /* test_file_create() */ /**************************************************************** @@ -492,7 +499,7 @@ test_file_create(void) ** ****************************************************************/ static void -test_file_open(void) +test_file_open(const char *env_h5_drvr) { hid_t fid1, fid2; /*HDF5 File IDs */ hid_t did; /*dataset ID */ @@ -510,6 +517,10 @@ test_file_open(void) * Test single file open */ + /* Only run this test with sec2/default driver */ + if (!h5_using_default_driver(env_h5_drvr)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File Opening I/O\n")); @@ -1619,22 +1630,24 @@ test_file_perm2(void) ** H5Fis_accessible() API call. ** *****************************************************************/ -#define FILE_IS_ACCESSIBLE "tfile_is_accessible" +#define FILE_IS_ACCESSIBLE "tfile_is_accessible" +#define FILE_IS_ACCESSIBLE_NON_HDF5 "tfile_is_accessible_non_hdf5" static void test_file_is_accessible(const char *env_h5_drvr) { - hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */ - hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */ - hid_t fapl_id = H5I_INVALID_HID; /* File access property list */ - int fd; /* POSIX file descriptor */ - char filename[FILENAME_LEN]; /* Filename to use */ - char sb_filename[FILENAME_LEN]; /* Name of file w/ superblock */ - ssize_t nbytes; /* Number of bytes written */ - unsigned u; /* Local index variable */ - unsigned char buf[1024]; /* Buffer of data to write */ - htri_t is_hdf5; /* Whether a file is an HDF5 file */ - int posix_ret; /* Return value from POSIX calls */ - herr_t ret; /* Return value from HDF5 calls */ + hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */ + hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */ + hid_t fapl_id = H5I_INVALID_HID; /* File access property list */ + int fd; /* POSIX file descriptor */ + char filename[FILENAME_LEN]; /* Filename to use */ + char non_hdf5_filename[FILENAME_LEN]; /* Base name of non-hdf5 file */ + char non_hdf5_sb_filename[FILENAME_LEN]; /* Name of non-hdf5 superblock file */ + ssize_t nbytes; /* Number of bytes written */ + unsigned u; /* Local index variable */ + unsigned char buf[1024]; /* Buffer of data to write */ + htri_t is_hdf5; /* Whether a file is an HDF5 file */ + int posix_ret; /* Return value from POSIX calls */ + herr_t ret; /* Return value from HDF5 calls */ /* Output message about test being performed */ MESSAGE(5, ("Testing Detection of HDF5 Files\n")); @@ -1643,13 +1656,11 @@ test_file_is_accessible(const char *env_h5_drvr) fapl_id = h5_fileaccess(); CHECK(fapl_id, H5I_INVALID_HID, "H5Pcreate"); - /* Fix up filenames - * For VFDs that create multiple files, we also need the name - * of the file with the superblock. With single-file VFDs, this - * will be equal to the one from h5_fixname(). - */ + /* Fix up filenames */ h5_fixname(FILE_IS_ACCESSIBLE, fapl_id, filename, sizeof(filename)); - h5_fixname_superblock(FILE_IS_ACCESSIBLE, fapl_id, sb_filename, sizeof(filename)); + h5_fixname(FILE_IS_ACCESSIBLE_NON_HDF5, fapl_id, non_hdf5_filename, sizeof(non_hdf5_filename)); + h5_fixname_superblock(FILE_IS_ACCESSIBLE_NON_HDF5, fapl_id, non_hdf5_sb_filename, + sizeof(non_hdf5_sb_filename)); /****************/ /* Normal usage */ @@ -1722,48 +1733,54 @@ test_file_is_accessible(const char *env_h5_drvr) VERIFY(is_hdf5, TRUE, "H5Fis_accessible"); } /* end if */ - /***********************/ - /* EMPTY non-HDF5 file */ - /***********************/ + /* Don't run the below tests for drivers that use multiple + * logical files, like the splitter driver. + */ + if (!h5_driver_uses_multiple_files(env_h5_drvr, H5_EXCLUDE_MULTIPART_DRIVERS)) { + /***********************/ + /* EMPTY non-HDF5 file */ + /***********************/ - /* Create non-HDF5 file and check it */ - fd = HDopen(sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW); - CHECK(fd, (-1), "HDopen"); + /* Create non-HDF5 file and check it */ + fd = HDopen(non_hdf5_sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW); + CHECK(fd, (-1), "HDopen"); - /* Close the file */ - posix_ret = HDclose(fd); - CHECK(posix_ret, (-1), "HDclose"); + /* Close the file */ + posix_ret = HDclose(fd); + CHECK(posix_ret, (-1), "HDclose"); - /* Verify that the file is NOT an HDF5 file */ - is_hdf5 = H5Fis_accessible(filename, fapl_id); - VERIFY(is_hdf5, FALSE, "H5Fis_accessible (empty non-HDF5 file)"); + /* Verify that the file is NOT an HDF5 file using the base filename */ + is_hdf5 = H5Fis_accessible(non_hdf5_filename, fapl_id); + VERIFY(is_hdf5, FALSE, "H5Fis_accessible (empty non-HDF5 file)"); - /***************************/ - /* Non-empty non-HDF5 file */ - /***************************/ + /***************************/ + /* Non-empty non-HDF5 file */ + /***************************/ - /* Create non-HDF5 file and check it */ - fd = HDopen(sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW); - CHECK(fd, (-1), "HDopen"); + /* Create non-HDF5 file and check it */ + fd = HDopen(non_hdf5_sb_filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW); + CHECK(fd, (-1), "HDopen"); - /* Initialize information to write */ - for (u = 0; u < 1024; u++) - buf[u] = (unsigned char)u; + /* Initialize information to write */ + for (u = 0; u < 1024; u++) + buf[u] = (unsigned char)u; - /* Write some information */ - nbytes = HDwrite(fd, buf, (size_t)1024); - VERIFY(nbytes, 1024, "HDwrite"); + /* Write some information */ + nbytes = HDwrite(fd, buf, (size_t)1024); + VERIFY(nbytes, 1024, "HDwrite"); - /* Close the file */ - posix_ret = HDclose(fd); - CHECK(posix_ret, (-1), "HDclose"); + /* Close the file */ + posix_ret = HDclose(fd); + CHECK(posix_ret, (-1), "HDclose"); - /* Verify that the file is not an HDF5 file */ - is_hdf5 = H5Fis_accessible(filename, fapl_id); - VERIFY(is_hdf5, FALSE, "H5Fis_accessible (non-HDF5 file)"); + /* Verify that the file is not an HDF5 file */ + is_hdf5 = H5Fis_accessible(non_hdf5_filename, fapl_id); + VERIFY(is_hdf5, FALSE, "H5Fis_accessible (non-HDF5 file)"); + } /* Clean up files */ h5_delete_test_file(filename, fapl_id); + h5_delete_test_file(non_hdf5_filename, fapl_id); /* Close property list */ ret = H5Pclose(fapl_id); @@ -1795,6 +1812,9 @@ test_file_ishdf5(const char *env_h5_drvr) int posix_ret; /* Return value from POSIX calls */ herr_t ret; /* Return value from HDF5 calls */ + if (!h5_using_default_driver(env_h5_drvr)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing Detection of HDF5 Files (using deprecated H5Fis_hdf5() call)\n")); @@ -1830,33 +1850,28 @@ test_file_ishdf5(const char *env_h5_drvr) /* Non-default user block size */ /*******************************/ - /* This test is not currently working for the family VFD. - * There are failures when creating files with userblocks. - */ - if (0 != HDstrcmp(env_h5_drvr, "family")) { - /* Create a file creation property list with a non-default user block size */ - fcpl_id = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate"); + /* Create a file creation property list with a non-default user block size */ + fcpl_id = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl_id, H5I_INVALID_HID, "H5Pcreate"); - ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); - CHECK(ret, FAIL, "H5Pset_userblock"); + ret = H5Pset_userblock(fcpl_id, (hsize_t)2048); + CHECK(ret, FAIL, "H5Pset_userblock"); - /* Create file with non-default user block */ - fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); + /* Create file with non-default user block */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); - /* Release file creation property list */ - ret = H5Pclose(fcpl_id); - CHECK(ret, FAIL, "H5Pclose"); + /* Release file creation property list */ + ret = H5Pclose(fcpl_id); + CHECK(ret, FAIL, "H5Pclose"); - /* Close file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - /* Verify that the file is an HDF5 file */ - is_hdf5 = H5Fis_hdf5(sb_filename); - VERIFY(is_hdf5, TRUE, "H5Fis_hdf5"); - } /* end if */ + /* Verify that the file is an HDF5 file */ + is_hdf5 = H5Fis_hdf5(sb_filename); + VERIFY(is_hdf5, TRUE, "H5Fis_hdf5"); /***************************/ /* Non-empty non-HDF5 file */ @@ -2891,7 +2906,7 @@ test_file_double_datatype_open(void) ** *****************************************************************/ static void -test_userblock_file_size(void) +test_userblock_file_size(const char *env_h5_drvr) { hid_t file1_id, file2_id; hid_t group1_id, group2_id; @@ -2903,6 +2918,11 @@ test_userblock_file_size(void) unsigned long fileno1, fileno2; /* File number */ herr_t ret; /* Generic return value */ + /* Don't run with multi/split, family or direct drivers */ + if (!HDstrcmp(env_h5_drvr, "multi") || !HDstrcmp(env_h5_drvr, "split") || + !HDstrcmp(env_h5_drvr, "family") || !HDstrcmp(env_h5_drvr, "direct")) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing file size with user block\n")); @@ -3289,13 +3309,17 @@ test_userblock_alignment_helper2(hid_t fapl, hbool_t open_rw) ** *****************************************************************/ static void -test_userblock_alignment(void) +test_userblock_alignment(const char *env_h5_drvr) { hid_t fid; /* File ID */ hid_t fcpl; /* File creation property list ID */ hid_t fapl; /* File access property list ID */ herr_t ret; /* Generic return value */ + /* Only run with sec2 driver */ + if (!h5_using_default_driver(env_h5_drvr)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing that non-zero userblocks and object alignment interact correctly.\n")); @@ -3507,13 +3531,17 @@ test_userblock_alignment(void) ** *****************************************************************/ static void -test_userblock_alignment_paged(void) +test_userblock_alignment_paged(const char *env_h5_drvr) { hid_t fid; /* File ID */ hid_t fcpl; /* File creation property list ID */ hid_t fapl; /* File access property list ID */ herr_t ret; /* Generic return value */ + /* Only run with sec2 driver */ + if (!h5_using_default_driver(env_h5_drvr)) + return; + /* Output message about test being performed */ MESSAGE(5, ("Testing interaction between userblock and alignment (via paged aggregation and " "H5Pset_alignment)\n")); @@ -5570,7 +5598,10 @@ test_libver_bounds(void) test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2); test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 2); test_libver_bounds_open(); - test_libver_bounds_copy(); + + if (!h5_driver_uses_modified_filename()) { + test_libver_bounds_copy(); + } } /* end test_libver_bounds() */ /************************************************************************************** @@ -5595,7 +5626,7 @@ test_libver_bounds(void) ** **************************************************************************************/ static void -test_libver_bounds_low_high(void) +test_libver_bounds_low_high(const char *env_h5_drvr) { hid_t fapl = H5I_INVALID_HID; /* File access property list */ H5F_libver_t low, high; /* Low and high bounds */ @@ -5635,7 +5666,7 @@ test_libver_bounds_low_high(void) VERIFY(ret, SUCCEED, "H5Pset_libver_bounds"); /* Tests to verify version bounds */ - test_libver_bounds_super(fapl); + test_libver_bounds_super(fapl, env_h5_drvr); test_libver_bounds_obj(fapl); test_libver_bounds_dataset(fapl); test_libver_bounds_dataspace(fapl); @@ -5668,7 +5699,7 @@ test_libver_bounds_low_high(void) ** *************************************************************************/ static void -test_libver_bounds_super(hid_t fapl) +test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) { hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ herr_t ret; /* The return value */ @@ -5680,12 +5711,14 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #A and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #A and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ @@ -5701,12 +5734,14 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #B and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #B and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ @@ -5724,38 +5759,44 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #C and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #C and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); CHECK(ret, FAIL, "H5Pclose"); - /* Create a fcpl with persistent free-space manager enabled: #D */ - /* This will result in superblock version 2 */ - fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); - ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1); - CHECK(ret, FAIL, "H5Pset_file_space"); - - /* Verify superblock version when creating a file with input fapl, - fcpl #D and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE, TRUE); - - /* Verify superblock version when opening a file which is created - with input fapl, fcpl #D and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE, TRUE); - - /* Close the fcpl */ - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + if (h5_using_default_driver(env_h5_drvr)) { + /* Create a fcpl with persistent free-space manager enabled: #D */ + /* This will result in superblock version 2 */ + fcpl = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); + ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1); + CHECK(ret, FAIL, "H5Pset_file_space"); + + /* Verify superblock version when creating a file with input fapl, + fcpl #D and with/without SWMR access */ + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_create(fapl, fcpl, TRUE, TRUE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, TRUE); + + /* Verify superblock version when opening a file which is created + with input fapl, fcpl #D and with/without SWMR access */ + if (H5FD__supports_swmr_test(env_h5_drvr)) + test_libver_bounds_super_open(fapl, fcpl, TRUE, TRUE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, TRUE); + + /* Close the fcpl */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); + } } /* end test_libver_bounds_super() */ @@ -7747,7 +7788,7 @@ test_min_dset_ohdr(void) ****************************************************************/ #ifndef H5_NO_DEPRECATED_SYMBOLS static void -test_deprec(void) +test_deprec(const char *env_h5_drvr) { hid_t file; /* File IDs for old & new files */ hid_t fcpl; /* File creation property list */ @@ -7800,166 +7841,169 @@ test_deprec(void) ret = H5Fclose(file); CHECK(ret, FAIL, "H5Fclose"); - /* Create a file creation property list */ - fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + /* Only run this part of the test with the sec2/default driver */ + if (h5_using_default_driver(env_h5_drvr)) { + /* Create a file creation property list */ + fcpl = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl, FAIL, "H5Pcreate"); - /* Set a property in the FCPL that will push the superblock version up */ - ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)0); - ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512); - CHECK(ret, FAIL, "H5Pset_file_space_strategy"); + /* Set a property in the FCPL that will push the superblock version up */ + ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)0); + ret = H5Pset_file_space_page_size(fcpl, (hsize_t)512); + CHECK(ret, FAIL, "H5Pset_file_space_strategy"); - fapl = H5Pcreate(H5P_FILE_ACCESS); - ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1024); - CHECK(ret, FAIL, "H5Pset_alignment"); + fapl = H5Pcreate(H5P_FILE_ACCESS); + ret = H5Pset_alignment(fapl, (hsize_t)1, (hsize_t)1024); + CHECK(ret, FAIL, "H5Pset_alignment"); - /* Creating a file with the non-default file creation property list should - * create a version 2 superblock - */ + /* Creating a file with the non-default file creation property list should + * create a version 2 superblock + */ - /* Create file with custom file creation property list */ - file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(file, FAIL, "H5Fcreate"); + /* Create file with custom file creation property list */ + file = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, fapl); + CHECK(file, FAIL, "H5Fcreate"); - new_fapl = H5Fget_access_plist(file); - H5Pget_alignment(new_fapl, NULL, &align); + new_fapl = H5Fget_access_plist(file); + H5Pget_alignment(new_fapl, NULL, &align); - /* Close FCPL */ - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close FCPL */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); - /* Get the file's version information */ - ret = H5Fget_info1(file, &finfo); - CHECK(ret, FAIL, "H5Fget_info1"); - VERIFY(finfo.super_ext_size, 152, "H5Fget_info1"); - VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1"); - VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1"); - VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1"); + /* Get the file's version information */ + ret = H5Fget_info1(file, &finfo); + CHECK(ret, FAIL, "H5Fget_info1"); + VERIFY(finfo.super_ext_size, 152, "H5Fget_info1"); + VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1"); + VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1"); + VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1"); - /* Get the file's dataset creation property list */ - fcpl = H5Fget_create_plist(file); - CHECK(fcpl, FAIL, "H5Fget_create_plist"); + /* Get the file's dataset creation property list */ + fcpl = H5Fget_create_plist(file); + CHECK(fcpl, FAIL, "H5Fget_create_plist"); - /* Get the file's version information */ - ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); - CHECK(ret, FAIL, "H5Pget_version"); - VERIFY(super, 2, "H5Pget_version"); - VERIFY(freelist, 0, "H5Pget_version"); - VERIFY(stab, 0, "H5Pget_version"); - VERIFY(shhdr, 0, "H5Pget_version"); + /* Get the file's version information */ + ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); + CHECK(ret, FAIL, "H5Pget_version"); + VERIFY(super, 2, "H5Pget_version"); + VERIFY(freelist, 0, "H5Pget_version"); + VERIFY(stab, 0, "H5Pget_version"); + VERIFY(shhdr, 0, "H5Pget_version"); - /* Close FCPL */ - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close FCPL */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); - /* Close file */ - ret = H5Fclose(file); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); - /* Re-open the file */ - file = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); - CHECK(file, FAIL, "H5Fcreate"); + /* Re-open the file */ + file = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(file, FAIL, "H5Fcreate"); - /* Get the file's version information */ - ret = H5Fget_info1(file, &finfo); - CHECK(ret, FAIL, "H5Fget_info1"); - VERIFY(finfo.super_ext_size, 152, "H5Fget_info1"); - VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1"); - VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1"); - VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1"); + /* Get the file's version information */ + ret = H5Fget_info1(file, &finfo); + CHECK(ret, FAIL, "H5Fget_info1"); + VERIFY(finfo.super_ext_size, 152, "H5Fget_info1"); + VERIFY(finfo.sohm.hdr_size, 0, "H5Fget_info1"); + VERIFY(finfo.sohm.msgs_info.index_size, 0, "H5Fget_info1"); + VERIFY(finfo.sohm.msgs_info.heap_size, 0, "H5Fget_info1"); - /* Get the file's creation property list */ - fcpl = H5Fget_create_plist(file); - CHECK(fcpl, FAIL, "H5Fget_create_plist"); + /* Get the file's creation property list */ + fcpl = H5Fget_create_plist(file); + CHECK(fcpl, FAIL, "H5Fget_create_plist"); - /* Get the file's version information */ - ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); - CHECK(ret, FAIL, "H5Pget_version"); - VERIFY(super, 2, "H5Pget_version"); - VERIFY(freelist, 0, "H5Pget_version"); - VERIFY(stab, 0, "H5Pget_version"); - VERIFY(shhdr, 0, "H5Pget_version"); + /* Get the file's version information */ + ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); + CHECK(ret, FAIL, "H5Pget_version"); + VERIFY(super, 2, "H5Pget_version"); + VERIFY(freelist, 0, "H5Pget_version"); + VERIFY(stab, 0, "H5Pget_version"); + VERIFY(shhdr, 0, "H5Pget_version"); - /* Close FCPL */ - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close FCPL */ + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); - /* Close file */ - ret = H5Fclose(file); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(file); + CHECK(ret, FAIL, "H5Fclose"); - { /* Test deprecated H5Pget/set_file_space() */ + { /* Test deprecated H5Pget/set_file_space() */ - H5F_file_space_type_t old_strategy; - hsize_t old_threshold; - hid_t fid; - hid_t ffcpl; + H5F_file_space_type_t old_strategy; + hsize_t old_threshold; + hid_t fid; + hid_t ffcpl; - fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + fcpl = H5Pcreate(H5P_FILE_CREATE); + CHECK(fcpl, FAIL, "H5Pcreate"); - ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(old_strategy, H5F_FILE_SPACE_ALL, "H5Pget_file_space"); - VERIFY(old_threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space"); + ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); + VERIFY(old_strategy, H5F_FILE_SPACE_ALL, "H5Pget_file_space"); + VERIFY(old_threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space"); - /* Set file space strategy and free space section threshold */ - ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0); - CHECK(ret, FAIL, "H5Pget_file_space"); + /* Set file space strategy and free space section threshold */ + ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_ALL_PERSIST, (hsize_t)0); + CHECK(ret, FAIL, "H5Pget_file_space"); - /* Get the file space info from the creation property */ - ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); - VERIFY(old_threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space"); + /* Get the file space info from the creation property */ + ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); + VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); + VERIFY(old_threshold, H5F_FREE_SPACE_THRESHOLD_DEF, "H5Pget_file_space"); - ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_DEFAULT, (hsize_t)3); - CHECK(ret, FAIL, "H5Pget_file_space"); + ret = H5Pset_file_space(fcpl, H5F_FILE_SPACE_DEFAULT, (hsize_t)3); + CHECK(ret, FAIL, "H5Pget_file_space"); - ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); - VERIFY(old_threshold, 3, "H5Pget_file_space"); + ret = H5Pget_file_space(fcpl, &old_strategy, &old_threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); + VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); + VERIFY(old_threshold, 3, "H5Pget_file_space"); - /* Create a file */ - fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); - CHECK(file, FAIL, "H5Fcreate"); + /* Create a file */ + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); + CHECK(file, FAIL, "H5Fcreate"); - old_strategy = H5F_FILE_SPACE_DEFAULT; - old_threshold = 0; - ffcpl = H5Fget_create_plist(fid); - ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); - VERIFY(old_threshold, 3, "H5Pget_file_space"); + old_strategy = H5F_FILE_SPACE_DEFAULT; + old_threshold = 0; + ffcpl = H5Fget_create_plist(fid); + ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); + VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); + VERIFY(old_threshold, 3, "H5Pget_file_space"); - /* Close file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + /* Close file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - ret = H5Pclose(ffcpl); - CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(ffcpl); + CHECK(ret, FAIL, "H5Pclose"); - ret = H5Pclose(fcpl); - CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(fcpl); + CHECK(ret, FAIL, "H5Pclose"); - /* Reopen the file */ - fid = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); - CHECK(fid, FAIL, "H5Fcreate"); + /* Reopen the file */ + fid = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid, FAIL, "H5Fcreate"); - old_strategy = H5F_FILE_SPACE_DEFAULT; - old_threshold = 0; - ffcpl = H5Fget_create_plist(fid); - ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold); - CHECK(ret, FAIL, "H5Pget_file_space"); - VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); - VERIFY(old_threshold, 3, "H5Pget_file_space"); + old_strategy = H5F_FILE_SPACE_DEFAULT; + old_threshold = 0; + ffcpl = H5Fget_create_plist(fid); + ret = H5Pget_file_space(ffcpl, &old_strategy, &old_threshold); + CHECK(ret, FAIL, "H5Pget_file_space"); + VERIFY(old_strategy, H5F_FILE_SPACE_ALL_PERSIST, "H5Pget_file_space"); + VERIFY(old_threshold, 3, "H5Pget_file_space"); - ret = H5Pclose(ffcpl); - CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(ffcpl); + CHECK(ret, FAIL, "H5Pclose"); - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } } } /* test_deprec */ @@ -7973,15 +8017,16 @@ test_deprec(void) void test_file(void) { - const char *env_h5_drvr; /* File Driver value from environment */ - hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */ + const char *env_h5_drvr; /* File Driver value from environment */ + hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */ + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); herr_t ret; /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File I/O\n")); /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; @@ -7990,7 +8035,7 @@ test_file(void) CHECK(fapl_id, H5I_INVALID_HID, "h5_fileaccess"); test_file_create(); /* Test file creation(also creation templates)*/ - test_file_open(); /* Test file opening */ + test_file_open(env_h5_drvr); /* Test file opening */ test_file_reopen(); /* Test file reopening */ test_file_close(); /* Test file close behavior */ test_get_file_id(); /* Test H5Iget_file_id */ @@ -8008,14 +8053,19 @@ test_file(void) test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */ test_file_double_file_dataset_open(TRUE); test_file_double_file_dataset_open(FALSE); - 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 */ - test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly - */ - test_userblock_alignment_paged(); /* Tests files created with a userblock and alignment (via paged - aggregation) interact properly */ - test_filespace_info(env_h5_drvr); /* Test file creation public routines: */ + test_userblock_file_size( + env_h5_drvr); /* 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 */ + + if (!driver_uses_modified_filename) { + test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */ + } + + test_userblock_alignment( + env_h5_drvr); /* Tests that files created with a userblock and alignment interact properly */ + test_userblock_alignment_paged(env_h5_drvr); /* Tests files created with a userblock and alignment (via + paged aggregation) interact properly */ + test_filespace_info(env_h5_drvr); /* Test file creation public routines: */ /* H5Pget/set_file_space_strategy() & H5Pget/set_file_space_page_size() */ /* Skipped testing for multi/split drivers */ test_file_freespace(env_h5_drvr); /* Test file public routine H5Fget_freespace() */ @@ -8027,19 +8077,25 @@ test_file(void) /* Setup for multi/split drivers are there already */ test_sects_freespace(env_h5_drvr, FALSE); /* Test file public routine H5Fget_free_sections() */ /* Skipped testing for multi/split drivers */ - test_filespace_compatible(); /* Test compatibility for file space management */ - test_filespace_round_compatible(); /* Testing file space compatibility for files from trunk to 1_8 to - trunk */ - test_filespace_1_10_0_compatible(); /* Testing file space compatibility for files from release 1.10.0 */ - test_libver_bounds(); /* Test compatibility for file space management */ - test_libver_bounds_low_high(); + + if (!driver_uses_modified_filename) { + test_filespace_compatible(); /* Test compatibility for file space management */ + + test_filespace_round_compatible(); /* Testing file space compatibility for files from trunk to 1_8 to + trunk */ + test_filespace_1_10_0_compatible(); /* Testing file space compatibility for files from release 1.10.0 + */ + } + + test_libver_bounds(); /* Test compatibility for file space management */ + test_libver_bounds_low_high(env_h5_drvr); test_libver_macros(); /* Test the macros for library version comparison */ test_libver_macros2(); /* Test the macros for library version comparison */ test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */ test_min_dset_ohdr(); /* Test datset object header minimization */ #ifndef H5_NO_DEPRECATED_SYMBOLS test_file_ishdf5(env_h5_drvr); /* Test detecting HDF5 files correctly */ - test_deprec(); /* Test deprecated routines */ + test_deprec(env_h5_drvr); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ ret = H5Pclose(fapl_id); @@ -8064,13 +8120,17 @@ test_file(void) void cleanup_file(void) { - HDremove(SFILE1); - HDremove(FILE1); - HDremove(FILE2); - HDremove(FILE3); - HDremove(FILE4); - HDremove(FILE5); - HDremove(FILE6); - HDremove(FILE7); - HDremove(DST_FILE); + H5E_BEGIN_TRY + { + H5Fdelete(SFILE1, H5P_DEFAULT); + H5Fdelete(FILE1, H5P_DEFAULT); + H5Fdelete(FILE2, H5P_DEFAULT); + H5Fdelete(FILE3, H5P_DEFAULT); + H5Fdelete(FILE4, H5P_DEFAULT); + H5Fdelete(FILE5, H5P_DEFAULT); + H5Fdelete(FILE6, H5P_DEFAULT); + H5Fdelete(FILE7, H5P_DEFAULT); + H5Fdelete(DST_FILE, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/th5o.c b/test/th5o.c index ebb6c6e..48c0a81 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -43,14 +43,17 @@ test_h5o_open(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ + char filename[1024]; hsize_t dims[RANK]; H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ H5G_info_t ginfo; /* Group info struct */ H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -155,11 +158,14 @@ test_h5o_close(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ + char filename[1024]; hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -247,8 +253,9 @@ test_h5o_open_by_addr(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info2_t li; /* Buffer for H5Lget_info2 */ - haddr_t grp_addr; /* Addresses for objects */ + char filename[1024]; + H5L_info2_t li; /* Buffer for H5Lget_info2 */ + haddr_t grp_addr; /* Addresses for objects */ haddr_t dset_addr; haddr_t dtype_addr; hsize_t dims[RANK]; @@ -257,8 +264,10 @@ test_h5o_open_by_addr(void) H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -397,15 +406,18 @@ test_h5o_open_by_token(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info2_t li; /* Buffer for H5Lget_info */ + char filename[1024]; + H5L_info2_t li; /* Buffer for H5Lget_info */ hsize_t dims[RANK]; H5I_type_t id_type; /* Type of IDs returned from H5Oopen */ H5G_info_t ginfo; /* Group info struct */ H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -515,12 +527,15 @@ test_h5o_refcount(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5O_info2_t oinfo; /* Object info struct */ + char filename[1024]; + H5O_info2_t oinfo; /* Object info struct */ hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -612,7 +627,7 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file and check that the reference counts were really incremented */ - fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); grp = H5Gopen2(fid, "group", H5P_DEFAULT); @@ -650,7 +665,7 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file and check that the reference counts were really decremented */ - fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); grp = H5Gopen2(fid, "group", H5P_DEFAULT); @@ -709,10 +724,11 @@ test_h5o_refcount(void) static void test_h5o_plist(void) { - hid_t fid; /* HDF5 File ID */ - hid_t grp, dset, dtype, dspace; /* Object identifiers */ - hid_t fapl; /* File access property list */ - hid_t gcpl, dcpl, tcpl; /* Object creation properties */ + hid_t fid; /* HDF5 File ID */ + hid_t grp, dset, dtype, dspace; /* Object identifiers */ + hid_t fapl; /* File access property list */ + hid_t gcpl, dcpl, tcpl; /* Object creation properties */ + char filename[1024]; unsigned def_max_compact, def_min_dense; /* Default phase change parameters */ unsigned max_compact, min_dense; /* Actual phase change parameters */ herr_t ret; /* Value returned from API calls */ @@ -725,8 +741,10 @@ test_h5o_plist(void) ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); CHECK(ret, FAIL, "H5Pset_libver_bounds"); + h5_fixname(TEST_FILENAME, fapl, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); CHECK(fid, FAIL, "H5Fcreate"); /* Create group, dataset & named datatype creation property lists */ @@ -840,7 +858,7 @@ test_h5o_plist(void) CHECK(ret, FAIL, "H5Fclose"); /* Re-open the file and check that the object creation properties persist */ - fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, fapl); + fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); CHECK(fid, FAIL, "H5Fopen"); /* Re-open objects */ @@ -909,7 +927,8 @@ test_h5o_link(void) hid_t type_id = -1; hid_t fapl_id = -1; hid_t lcpl_id = -1; - hsize_t dims[2] = {TEST6_DIM1, TEST6_DIM2}; + char filename[1024]; + hsize_t dims[2] = {TEST6_DIM1, TEST6_DIM2}; htri_t committed; /* Whether the named datatype is committed */ H5F_libver_t low, high; /* File format bounds */ int * wdata; @@ -917,6 +936,8 @@ test_h5o_link(void) int i, n; herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Allocate memory buffers */ /* (These are treated as 2-D buffers) */ wdata = (int *)HDmalloc((size_t)(TEST6_DIM1 * TEST6_DIM2) * sizeof(int)); @@ -957,7 +978,7 @@ test_h5o_link(void) continue; /* Create a new HDF5 file */ - file_id = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); CHECK(file_id, FAIL, "H5Fcreate"); /* Close the FAPL */ @@ -1060,6 +1081,7 @@ test_h5o_comment(void) hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ hid_t attr_space, attr_id; + char filename[1024]; hsize_t dims[RANK]; hsize_t attr_dims = 1; int attr_value = 5; @@ -1073,8 +1095,10 @@ test_h5o_comment(void) herr_t ret; /* Value returned from API calls */ int ret_value; + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create an attribute for the file */ @@ -1152,7 +1176,7 @@ test_h5o_comment(void) /* Now make sure that the comments are correct all 4 types of objects */ /* Open file */ - fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); /* Getting the comment on the file and verify it */ @@ -1232,6 +1256,7 @@ test_h5o_comment_by_name(void) hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ hid_t attr_space, attr_id; + char filename[1024]; hsize_t dims[RANK]; hsize_t attr_dims = 1; int attr_value = 5; @@ -1245,8 +1270,10 @@ test_h5o_comment_by_name(void) herr_t ret; /* Value returned from API calls */ int ret_value; + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create an attribute for the file */ @@ -1324,7 +1351,7 @@ test_h5o_comment_by_name(void) /* Now make sure that the comments are correct all 4 types of objects */ /* Open file */ - fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); + fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); /* Getting the comment on the file and verify it */ @@ -1390,13 +1417,16 @@ test_h5o_comment_by_name(void) static void test_h5o_getinfo_same_file(void) { - hid_t fid1, fid2; /* HDF5 File ID */ - hid_t gid1, gid2; /* Group IDs */ + hid_t fid1, fid2; /* HDF5 File ID */ + hid_t gid1, gid2; /* Group IDs */ + char filename[1024]; H5O_info2_t oinfo1, oinfo2; /* Object info structs */ herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid1 = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid1, FAIL, "H5Fcreate"); /* Create two groups in the file */ @@ -1438,9 +1468,9 @@ test_h5o_getinfo_same_file(void) CHECK(ret, FAIL, "H5Fclose"); /* Open file twice */ - fid1 = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid1 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid1, FAIL, "H5Fopen"); - fid2 = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid2, FAIL, "H5Fopen"); /* Open the two groups in the file */ @@ -1497,8 +1527,9 @@ test_h5o_open_by_addr_deprec(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5L_info1_t li; /* Buffer for H5Lget_info1 */ - haddr_t grp_addr; /* Addresses for objects */ + char filename[1024]; + H5L_info1_t li; /* Buffer for H5Lget_info1 */ + haddr_t grp_addr; /* Addresses for objects */ haddr_t dset_addr; haddr_t dtype_addr; hsize_t dims[RANK]; @@ -1507,8 +1538,10 @@ test_h5o_open_by_addr_deprec(void) H5T_class_t type_class; /* Class of the datatype */ herr_t ret; /* Value returned from API calls */ + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + /* Create a new HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create a group, dataset, and committed datatype within the file */ @@ -1682,13 +1715,16 @@ test_h5o_getinfo_visit(void) hid_t gid1 = -1, gid2 = -1; /* Group IDs */ hid_t sid = -1; /* Dataspace ID */ hid_t aid = -1; /* Attribute ID */ - H5O_info1_t oinfo1, oinfo2; /* Object info structs */ - char attrname[25]; /* Attribute name */ - int j; /* Local index variable */ - herr_t ret; /* Value returned from API calls */ + char filename[1024]; + H5O_info1_t oinfo1, oinfo2; /* Object info structs */ + char attrname[25]; /* Attribute name */ + int j; /* Local index variable */ + herr_t ret; /* Value returned from API calls */ + + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); /* Create an HDF5 file */ - fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create "group1" in the file */ @@ -1806,5 +1842,12 @@ test_h5o(void) void cleanup_h5o(void) { - HDremove(TEST_FILENAME); + char filename[1024]; + + H5E_BEGIN_TRY + { + h5_fixname(TEST_FILENAME, H5P_DEFAULT, filename, sizeof filename); + H5Fdelete(filename, H5P_DEFAULT); + } + H5E_END_TRY; } diff --git a/test/th5s.c b/test/th5s.c index 51216dc..97a6728 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -194,7 +194,7 @@ test_h5s_basic(void) * If this test fails and the H5S_MAX_RANK variable has changed, follow * the instructions in space_overflow.c for regenerating the th5s.h5 file. */ - { + if (!h5_driver_uses_modified_filename()) { const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); diff --git a/test/titerate.c b/test/titerate.c index 10ed039..1d87343 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -1175,8 +1175,10 @@ test_iterate(void) #endif } /* end for */ - /* Test the fix for issue HDFFV-10588 */ - test_corrupted_attnamelen(); + if (!h5_driver_uses_modified_filename()) { + /* Test the fix for issue HDFFV-10588 */ + test_corrupted_attnamelen(); + } /* Close FAPLs */ ret = H5Pclose(fapl); diff --git a/test/tmisc.c b/test/tmisc.c index b267330..bb8d8c8 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -287,7 +287,7 @@ typedef struct { #define MISC25C_ATTRNAME2 "ab" /* Definitions for misc. test #26 */ -#define MISC26_FILE "dcpl_file" +#define MISC26_FILE "dcpl_file.h5" /* Definitions for misc. test #27 */ /* (Note that this test file is generated by the "gen_bad_ohdr.c" code) */ @@ -6026,29 +6026,51 @@ test_misc36(void) void test_misc(void) { + hbool_t driver_uses_modified_filename = h5_driver_uses_modified_filename(); + hbool_t default_driver = h5_using_default_driver(NULL); + /* Output message about test being performed */ MESSAGE(5, ("Testing Miscellaneous Routines\n")); - test_misc1(); /* Test unlinking a dataset & immediately re-using name */ - test_misc2(); /* Test storing a VL-derived datatype in two different files */ - test_misc3(); /* Test reading from chunked dataset with non-zero fill value */ - test_misc4(); /* Test retrieving the fileno for various objects with H5Oget_info() */ - test_misc5(); /* Test several level deep nested compound & VL datatypes */ - test_misc6(); /* Test object header continuation code */ - test_misc7(); /* Test for sensible datatypes stored on disk */ - test_misc8(); /* Test storage sizes of various types of dataset storage */ - test_misc9(); /* Test for opening (not creating) core files */ - test_misc10(); /* Test for using dataset creation property lists from old files */ - test_misc11(); /* Test for all properties of a file creation property list being stored */ + test_misc1(); /* Test unlinking a dataset & immediately re-using name */ + test_misc2(); /* Test storing a VL-derived datatype in two different files */ + test_misc3(); /* Test reading from chunked dataset with non-zero fill value */ + test_misc4(); /* Test retrieving the fileno for various objects with H5Oget_info() */ + test_misc5(); /* Test several level deep nested compound & VL datatypes */ + test_misc6(); /* Test object header continuation code */ + test_misc7(); /* Test for sensible datatypes stored on disk */ + test_misc8(); /* Test storage sizes of various types of dataset storage */ + test_misc9(); /* Test for opening (not creating) core files */ + + if (!driver_uses_modified_filename) { + test_misc10(); /* Test for using dataset creation property lists from old files */ + } + + if (default_driver) { + test_misc11(); /* Test for all properties of a file creation property list being stored */ + } + test_misc12(); /* Test VL-strings in chunked datasets operating correctly */ - test_misc13(); /* Test that a user block can be insert in front of file contents */ + + if (default_driver) { + test_misc13(); /* Test that a user block can be insert in front of file contents */ + } + test_misc14(); /* Test that deleted dataset's data is removed from sieve buffer correctly */ - test_misc15(); /* Test that checking a file's access property list more than once works */ + + if (!driver_uses_modified_filename) { + test_misc15(); /* Test that checking a file's access property list more than once works */ + } + test_misc16(); /* Test array of fixed-length string */ test_misc17(); /* Test array of ASCII character */ test_misc18(); /* Test new object header information in H5O_info_t struct */ test_misc19(); /* Test incrementing & decrementing ref count on IDs */ - test_misc20(); /* Test problems with truncated dimensions in version 2 of storage layout message */ + + if (!driver_uses_modified_filename) { + test_misc20(); /* Test problems with truncated dimensions in version 2 of storage layout message */ + } + #ifdef H5_HAVE_FILTER_SZIP test_misc21(); /* Test that "late" allocation time is treated the same as "incremental", for chunked datasets w/a filters */ @@ -6057,19 +6079,39 @@ test_misc(void) test_misc23(); /* Test intermediate group creation */ test_misc24(); /* Test inappropriate API opens of objects */ test_misc25a(); /* Exercise null object header message merge bug */ - test_misc25b(); /* Exercise null object header message merge bug on existing file */ + + if (!driver_uses_modified_filename) { + test_misc25b(); /* Exercise null object header message merge bug on existing file */ + } + test_misc25c(); /* Exercise another null object header message merge bug */ test_misc26(); /* Test closing property lists with long filter pipelines */ - test_misc27(); /* Test opening file with object that has bad # of object header messages */ - test_misc28(); /* Test that chunks are cached appropriately */ - test_misc29(); /* Test that speculative metadata reads are handled correctly */ - test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */ - test_misc31(); /* Test Reentering library through deprecated routines after H5close() */ - test_misc32(); /* Test filter memory allocation functions */ - test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */ - test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */ - test_misc35(); /* Test behavior of free-list & allocation statistics API calls */ - test_misc36(); /* Exercise H5atclose and H5is_library_terminating */ + + if (!driver_uses_modified_filename) { + test_misc27(); /* Test opening file with object that has bad # of object header messages */ + } + + test_misc28(); /* Test that chunks are cached appropriately */ + + if (!driver_uses_modified_filename) { + test_misc29(); /* Test that speculative metadata reads are handled correctly */ + } + + test_misc30(); /* Exercise local heap loading bug where free lists were getting dropped */ + + if (default_driver) { + test_misc31(); /* Test Reentering library through deprecated routines after H5close() */ + } + + test_misc32(); /* Test filter memory allocation functions */ + + if (!driver_uses_modified_filename) { + test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */ + } + + test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */ + test_misc35(); /* Test behavior of free-list & allocation statistics API calls */ + test_misc36(); /* Exercise H5atclose and H5is_library_terminating */ } /* test_misc() */ diff --git a/test/trefer.c b/test/trefer.c index 9b6c415..48d3670 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -3452,11 +3452,17 @@ test_reference_perf(void) void test_reference(void) { - H5F_libver_t low, high; /* Low and high bounds */ + H5F_libver_t low, high; /* Low and high bounds */ + const char * env_h5_drvr; /* File Driver value from environment */ /* Output message about test being performed */ MESSAGE(5, ("Testing References\n")); + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + test_reference_params(); /* Test for correct parameter checking */ test_reference_obj(); /* Test basic H5R object reference code */ test_reference_vlen_obj(); /* Test reference within vlen */ @@ -3476,7 +3482,11 @@ test_reference(void) } /* end high bound */ } /* end low bound */ - test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ + /* The following test is currently broken with the Direct VFD */ + if (HDstrcmp(env_h5_drvr, "direct") != 0) { + test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ + } + test_reference_group(); /* Test operations on dereferenced groups */ test_reference_attr(); /* Test attribute references */ test_reference_external(); /* Test external references */ diff --git a/test/tselect.c b/test/tselect.c index 1bfb663..5fec1da 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -15991,18 +15991,24 @@ test_h5s_set_extent_none(void) void test_select(void) { - hid_t plist_id; /* Property list for reading random hyperslabs */ - hid_t fapl; /* Property list accessing the file */ - int mdc_nelmts; /* Metadata number of elements */ - size_t rdcc_nelmts; /* Raw data number of elements */ - size_t rdcc_nbytes; /* Raw data number of bytes */ - double rdcc_w0; /* Raw data write percentage */ - hssize_t offset[SPACE7_RANK] = {1, 1}; /* Offset for testing selection offsets */ - herr_t ret; /* Generic return value */ + hid_t plist_id; /* Property list for reading random hyperslabs */ + hid_t fapl; /* Property list accessing the file */ + int mdc_nelmts; /* Metadata number of elements */ + size_t rdcc_nelmts; /* Raw data number of elements */ + size_t rdcc_nbytes; /* Raw data number of bytes */ + double rdcc_w0; /* Raw data write percentage */ + hssize_t offset[SPACE7_RANK] = {1, 1}; /* Offset for testing selection offsets */ + const char *env_h5_drvr; /* File Driver value from environment */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Selections\n")); + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + /* Create a dataset transfer property list */ plist_id = H5Pcreate(H5P_DATASET_XFER); CHECK(plist_id, FAIL, "H5Pcreate"); @@ -16065,10 +16071,13 @@ test_select(void) test_select_hyper_union_3d(); /* Test hyperslab union code for 3-D dataset */ test_select_hyper_valid_combination(); /* Test different input combinations */ - test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */ - test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */ - test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */ - test_select_hyper_nota_2d(); /* Test hyperslab NOTA code for 2-D dataset */ + /* The following tests are currently broken with the Direct VFD */ + if (HDstrcmp(env_h5_drvr, "direct") != 0) { + test_select_hyper_and_2d(); /* Test hyperslab intersection (AND) code for 2-D dataset */ + test_select_hyper_xor_2d(); /* Test hyperslab XOR code for 2-D dataset */ + test_select_hyper_notb_2d(); /* Test hyperslab NOTB code for 2-D dataset */ + test_select_hyper_nota_2d(); /* Test hyperslab NOTA code for 2-D dataset */ + } /* test the random hyperslab I/O with the default property list for reading */ test_select_hyper_union_random_5d(H5P_DEFAULT); /* Test hyperslab union code for random 5-D hyperslabs */ diff --git a/test/tsohm.c b/test/tsohm.c index b4ece0b..774378a 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3815,23 +3815,45 @@ test_sohm_external_dtype(void) void test_sohm(void) { + const char *env_h5_drvr; + hbool_t default_driver; + MESSAGE(5, ("Testing Shared Object Header Messages\n")); - test_sohm_fcpl(); /* Test SOHMs and file creation plists */ - test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */ - test_sohm_size1(); /* Tests the sizes of files with one SOHM */ -#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ + /* Get the VFD to use */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + default_driver = h5_using_default_driver(env_h5_drvr); + + test_sohm_fcpl(); /* Test SOHMs and file creation plists */ + test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */ + + /* Only run this test with sec2/default driver */ + if (default_driver) + test_sohm_size1(); /* Tests the sizes of files with one SOHM */ + +#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ test_sohm_size_consistency_open_create(); -#endif /* Jira HDFFV-10645 */ - test_sohm_attrs(); /* Tests shared messages in attributes */ - test_sohm_size2(0); /* Tests the sizes of files with multiple SOHMs */ - test_sohm_size2(1); /* Tests the sizes of files with multiple - * SOHMs, closing and reopening file after - * each write. */ +#endif /* Jira HDFFV-10645 */ + test_sohm_attrs(); /* Tests shared messages in attributes */ + + /* Only run these tests with sec2/default driver */ + if (default_driver) { + test_sohm_size2(0); /* Tests the sizes of files with multiple SOHMs */ + test_sohm_size2(1); /* Tests the sizes of files with multiple + * SOHMs, closing and reopening file after + * each write. */ + } + 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. */ - test_sohm_extlink(); /* Test SOHMs when external links are used */ + + if (!h5_driver_uses_modified_filename()) { + test_sohm_extlink(); /* Test SOHMs when external links are used */ + } 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 067a715..da78a7d 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -132,7 +132,7 @@ main(int argc, char *argv[]) TestSummary(); /* Clean up test files, if allowed */ - if (GetTestCleanup() && !HDgetenv("HDF5_NOCLEANUP")) + if (GetTestCleanup() && !HDgetenv(HDF5_NOCLEANUP)) TestCleanup(); /* Release test infrastructure */ @@ -12288,9 +12288,24 @@ main(void) hid_t src_fapl = -1; /* File access property list */ int test_api_config; unsigned bit_config; - H5F_libver_t low, high; /* Low and high bounds */ + H5F_libver_t low, high; /* Low and high bounds */ + const char * env_h5_drvr; /* File Driver value from environment */ int nerrors = 0; + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* + * Skip VDS tests for parallel-enabled and splitter VFDs. VDS currently + * doesn't support parallel reads and the splitter VFD has external + * link-related bugs. + */ + if (h5_using_parallel_driver(env_h5_drvr) || !HDstrcmp(env_h5_drvr, "splitter")) { + HDputs(" -- SKIPPED for incompatible VFD --"); + HDexit(EXIT_SUCCESS); + } + /* Testing setup */ h5_reset(); fapl = h5_fileaccess(); diff --git a/test/vds_env.c b/test/vds_env.c index 58d90fc..5020db6 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -298,9 +298,24 @@ main(void) { hid_t fapl, my_fapl; unsigned bit_config; - H5F_libver_t low, high; /* Low and high bounds */ + H5F_libver_t low, high; /* Low and high bounds */ + const char * env_h5_drvr; /* File Driver value from environment */ int nerrors = 0; + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr == NULL) + env_h5_drvr = "nomatch"; + + /* + * Skip VDS tests for parallel-enabled and splitter VFDs. VDS currently + * doesn't support parallel reads and the splitter VFD has external + * link-related bugs. + */ + if (h5_using_parallel_driver(env_h5_drvr) || !HDstrcmp(env_h5_drvr, "splitter")) { + HDputs(" -- SKIPPED for incompatible VFD --"); + HDexit(EXIT_SUCCESS); + } + /* Testing setup */ h5_reset(); fapl = h5_fileaccess(); @@ -51,7 +51,7 @@ const char *FILENAME[] = {"sec2_file", /*0*/ "core_file", /*1*/ "family_file", /*2*/ - "new_family_v16_", /*3*/ + "new_family_v16", /*3*/ "multi_file", /*4*/ "direct_file", /*5*/ "log_file", /*6*/ @@ -68,7 +68,7 @@ const char *FILENAME[] = {"sec2_file", /*0*/ #define LOG_FILENAME "log_vfd_out.log" -#define COMPAT_BASENAME "family_v16_" +#define COMPAT_BASENAME "family_v16" #define MULTI_COMPAT_BASENAME "multi_file_v16" #define SPLITTER_DATASET_NAME "dataset" @@ -3488,6 +3488,7 @@ H5FD__ctl_test_vfd_ctl(H5FD_t H5_ATTR_UNUSED *_file, uint64_t op_code, uint64_t /* Minimal VFD for ctl feature tests */ static const H5FD_class_t H5FD_ctl_test_vfd_g = { + (H5FD_class_value_t)201, /* value */ "ctl_test_vfd", /* name */ HADDR_MAX, /* maxaddr */ H5F_CLOSE_SEMI, /* fc_degree */ @@ -3925,7 +3926,18 @@ error: int main(void) { - int nerrors = 0; + char *env_h5_drvr = NULL; + int nerrors = 0; + + /* Don't run VFD tests when HDF5_DRIVER is set. These tests expect a + * specific VFD to be set and HDF5_DRIVER being set can interfere + * with that. + */ + env_h5_drvr = HDgetenv(HDF5_DRIVER); + if (env_h5_drvr) { + HDprintf(" -- SKIPPED VFD tests because %s is set -- \n", HDF5_DRIVER); + HDexit(EXIT_SUCCESS); + } h5_reset(); diff --git a/test/vfd_plugin.c b/test/vfd_plugin.c new file mode 100644 index 0000000..df211cc --- /dev/null +++ b/test/vfd_plugin.c @@ -0,0 +1,388 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://www.hdfgroup.org/licenses. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Tests basic VFD plugin operations. Uses a basic testing VFD + * which is loaded as a dynamic plugin. + */ + +#include "h5test.h" + +#include "null_vfd_plugin.h" + +#define DEFAULT_DRIVER_NAME "sec2" + +/*------------------------------------------------------------------------- + * Function: test_set_by_name() + * + * Purpose: Tests if we can load and register a VFD plugin by name. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_set_by_name(void) +{ + htri_t is_registered = FAIL; + hid_t driver_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + + TESTING("VFD plugin registration by name"); + + /* The null VFD should not be registered at the start of the test */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + /* Register the null VFD by name */ + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + if (H5Pset_driver_by_name(fapl_id, NULL_VFD_NAME, NULL) < 0) + TEST_ERROR; + + /* The null VFD should be registered now */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VFD was not registered"); + + /* Unregister the null VFD */ + if ((driver_id = H5Pget_driver(fapl_id)) < 0) + TEST_ERROR; + if (H5FDunregister(driver_id) < 0) + TEST_ERROR; + + /* Close FAPL, which holds last reference to null VFD */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* The null VFD should not be registered now */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } + H5E_END_TRY; + + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: test_set_by_value() + * + * Purpose: Tests if we can load and register a VFD plugin by value + * (ID). + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_set_by_value(void) +{ + htri_t is_registered = FAIL; + hid_t driver_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + + TESTING("VFD plugin registration by value (ID)"); + + /* The null VFD should not be registered at the start of the test */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + /* Register the null VFD by value */ + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + if (H5Pset_driver_by_value(fapl_id, NULL_VFD_VALUE, NULL) < 0) + TEST_ERROR; + + /* The null VFD should be registered now */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VFD was not registered"); + + /* Unregister the null VFD */ + if ((driver_id = H5Pget_driver(fapl_id)) < 0) + TEST_ERROR; + if (H5FDunregister(driver_id) < 0) + TEST_ERROR; + + /* Close FAPL, which holds last reference to null VFD */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* The null VFD should not be registered now */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } + H5E_END_TRY; + + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: test_set_multi() + * + * Purpose: Tests if we can register a VFD plugin multiple times. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +#define N_REGISTRATIONS 10 +static herr_t +test_set_multi(void) +{ + htri_t is_registered = FAIL; + hid_t driver_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + int i; + + TESTING("registering a VFD plugin multiple times"); + + /* The null VFD should not be registered at the start of the test */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + /* Register the VFD multiple times */ + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + for (i = 0; i < N_REGISTRATIONS; i++) { + if (H5Pset_driver_by_name(fapl_id, NULL_VFD_NAME, NULL) < 0) + TEST_ERROR; + } + + /* The null VFD should be registered now */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VFD was not registered"); + + /* Unregister the null VFD */ + if ((driver_id = H5Pget_driver(fapl_id)) < 0) + TEST_ERROR; + for (i = 0; i < N_REGISTRATIONS; i++) { + if (H5FDunregister(driver_id) < 0) + TEST_ERROR; + } + + /* Close FAPL, which holds last reference to null VFD */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* The null VFD should not be registered now */ + if ((is_registered = H5FDis_driver_registered_by_name(NULL_VFD_NAME)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + /* Repeat testing with the _by_value routines */ + + /* The null VFD should not be registered at the start of the test */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + /* Register the VFD multiple times */ + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + for (i = 0; i < N_REGISTRATIONS; i++) { + if (H5Pset_driver_by_value(fapl_id, NULL_VFD_VALUE, NULL) < 0) + TEST_ERROR; + } + + /* The null VFD should be registered now */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (FALSE == is_registered) + FAIL_PUTS_ERROR("NULL VFD was not registered"); + + /* Unregister the null VFD */ + if ((driver_id = H5Pget_driver(fapl_id)) < 0) + TEST_ERROR; + for (i = 0; i < N_REGISTRATIONS; i++) { + if (H5FDunregister(driver_id) < 0) + TEST_ERROR; + } + + /* Close FAPL, which holds last reference to null VFD */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* The null VFD should not be registered now */ + if ((is_registered = H5FDis_driver_registered_by_value(NULL_VFD_VALUE)) < 0) + TEST_ERROR; + if (TRUE == is_registered) + FAIL_PUTS_ERROR("NULL VFD is inappropriately registered"); + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } + H5E_END_TRY; + + return FAIL; +} +#undef N_REGISTRATIONS + +/*------------------------------------------------------------------------- + * Function: test_get_config_str() + * + * Purpose: Tests if we can retrieve a configuration string set for a + * VFL driver. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +test_get_config_str(void) +{ + const char *const config_str = "{name: sec2}"; + ssize_t config_str_len = 0; + hid_t fapl_id = H5I_INVALID_HID; + char config_str_buf[128]; + + TESTING("Retrieval of VFD configuration string"); + + if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + + /* Try to retrieve length of default configuration string - should be 0 */ + HDmemset(config_str_buf, 0, 128); + + if ((config_str_len = H5Pget_driver_config_str(fapl_id, config_str_buf, 128)) < 0) + TEST_ERROR; + if (0 != config_str_len) + TEST_ERROR; + if (HDstrlen(config_str_buf) > 0) + TEST_ERROR; + + /* Set a new configuration string on the FAPL and retrieve it */ + if (H5Pset_driver_by_name(fapl_id, DEFAULT_DRIVER_NAME, config_str) < 0) + TEST_ERROR; + if ((config_str_len = H5Pget_driver_config_str(fapl_id, config_str_buf, 128)) < 0) + TEST_ERROR; + if (HDstrlen(config_str) != config_str_len) + TEST_ERROR; + if (HDstrncmp(config_str_buf, config_str, 128)) + TEST_ERROR; + + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + + /* Set default driver and driver configuration using environment variables */ + if (HDsetenv(HDF5_DRIVER, "sec2", 1) < 0) + TEST_ERROR; + if (HDsetenv(HDF5_DRIVER_CONFIG, config_str, 1) < 0) + TEST_ERROR; + + /* Close and re-open HDF5 to have it parse the environment variables */ + if (H5close() < 0) + TEST_ERROR; + if (H5open() < 0) + TEST_ERROR; + + /* Retrieve configuration string from default FAPL */ + HDmemset(config_str_buf, 0, 128); + if ((config_str_len = H5Pget_driver_config_str(H5P_FILE_ACCESS_DEFAULT, config_str_buf, 128)) < 0) + TEST_ERROR; + if (HDstrlen(config_str) != config_str_len) + TEST_ERROR; + if (HDstrncmp(config_str_buf, config_str, 128)) + TEST_ERROR; + + /* Unset environment variables */ + if (HDsetenv(HDF5_DRIVER, "", 1) < 0) + TEST_ERROR; + if (HDsetenv(HDF5_DRIVER_CONFIG, "", 1) < 0) + TEST_ERROR; + + PASSED(); + + return SUCCEED; + +error: + H5E_BEGIN_TRY + { + H5Pclose(fapl_id); + } + H5E_END_TRY; + + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests VFD plugin operations + * + * Return: EXIT_SUCCESS/EXIT_FAILURE + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + int nerrors = 0; + + h5_reset(); + + HDputs("Testing VFD plugin functionality."); + + nerrors += (test_set_by_name() < 0) ? 1 : 0; + nerrors += (test_set_by_value() < 0) ? 1 : 0; + nerrors += (test_set_multi() < 0) ? 1 : 0; + nerrors += (test_get_config_str() < 0) ? 1 : 0; + + if (nerrors) { + HDprintf("***** %d VFD plugin TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); + HDexit(EXIT_FAILURE); + } + + HDputs("All VFD plugin tests passed."); + + HDexit(EXIT_SUCCESS); +} @@ -814,9 +814,11 @@ test_basic_file_operation(const char *env_h5_drvr) if ((obj_count = H5Fget_obj_ids((hid_t)H5F_OBJ_ALL, H5F_OBJ_DATASET, 2, obj_id_list)) < 0) TEST_ERROR; - /* Can't compare VFD properties for split / multi / family VFDs */ + /* Can't compare VFD properties for several VFDs */ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0)) { + HDstrcmp(env_h5_drvr, "family") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0 && + HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0) && + HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -876,9 +878,11 @@ test_basic_file_operation(const char *env_h5_drvr) if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR; - /* Can't compare VFD properties for split / multi / family VFDs */ + /* Can't compare VFD properties for several VFDs */ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0)) { + HDstrcmp(env_h5_drvr, "family") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0 && + HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0) && + HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -891,9 +895,11 @@ test_basic_file_operation(const char *env_h5_drvr) if ((fid_reopen = H5Freopen(fid)) < 0) TEST_ERROR; - /* Can't compare VFD properties for split / multi / family VFDs */ + /* Can't compare VFD properties for several VFDs */ if ((hbool_t)(HDstrcmp(env_h5_drvr, "split") != 0 && HDstrcmp(env_h5_drvr, "multi") != 0 && - HDstrcmp(env_h5_drvr, "family") != 0)) { + HDstrcmp(env_h5_drvr, "family") != 0 && HDstrcmp(env_h5_drvr, "direct") != 0 && + HDstrcmp(env_h5_drvr, "core") != 0 && HDstrcmp(env_h5_drvr, "core_paged") != 0) && + HDstrcmp(env_h5_drvr, "mpio") != 0 && HDstrcmp(env_h5_drvr, "splitter") != 0) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) TEST_ERROR; @@ -942,7 +948,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_basic_group_operation(void) +test_basic_group_operation(const char *env_h5_drvr) { hid_t fid = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -985,9 +991,10 @@ test_basic_group_operation(void) if (H5Gget_info_by_idx(fid, "/", H5_INDEX_NAME, H5_ITER_NATIVE, 0, &info, H5P_DEFAULT) < 0) TEST_ERROR; - /* H5Gflush */ - if (H5Gflush(gid) < 0) - TEST_ERROR; + /* H5Gflush - skip for MPIO file driver as flush calls cause assertions in the library */ + if (HDstrcmp(env_h5_drvr, "mpio") != 0) + if (H5Gflush(gid) < 0) + TEST_ERROR; /* H5Gclose */ if (H5Gclose(gid) < 0) @@ -1045,7 +1052,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_basic_dataset_operation(void) +test_basic_dataset_operation(const char *env_h5_drvr) { hid_t fid = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -1110,9 +1117,10 @@ test_basic_dataset_operation(void) if (H5Dset_extent(did, &curr_dims) < 0) TEST_ERROR; - /* H5Dflush */ - if (H5Dflush(did) < 0) - TEST_ERROR; + /* H5Dflush - skip for MPIO file driver as flush calls cause assertions in the library */ + if (HDstrcmp(env_h5_drvr, "mpio") != 0) + if (H5Dflush(did) < 0) + TEST_ERROR; /* H5Dwrite */ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, in_buf) < 0) @@ -1384,10 +1392,10 @@ test_basic_object_operation(void) if (H5Oclose(oid) < 0) TEST_ERROR; - if (H5Fclose(fid) < 0) - TEST_ERROR; if (H5Gclose(gid) < 0) TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; h5_delete_test_file(FILENAME[0], fapl_id); @@ -1463,10 +1471,10 @@ test_basic_link_operation(void) H5P_DEFAULT) < 0) TEST_ERROR; - if (H5Fclose(fid) < 0) - TEST_ERROR; if (H5Gclose(gid) < 0) TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; h5_delete_test_file(FILENAME[0], fapl_id); @@ -1500,7 +1508,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_basic_datatype_operation(void) +test_basic_datatype_operation(const char *env_h5_drvr) { hid_t fid = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; @@ -1524,9 +1532,10 @@ test_basic_datatype_operation(void) if (H5Tcommit2(fid, NATIVE_VOL_TEST_DATATYPE_NAME, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR; - /* H5Tflush */ - if (H5Tflush(tid) < 0) - TEST_ERROR; + /* H5Tflush - skip for MPIO file driver as flush calls cause assertions in the library */ + if (HDstrcmp(env_h5_drvr, "mpio") != 0) + if (H5Tflush(tid) < 0) + TEST_ERROR; /* H5Trefresh */ if (H5Trefresh(tid) < 0) @@ -1975,11 +1984,11 @@ test_async_vol_props(void) FAIL_STACK_ERROR; /* Override possible environment variable & re-initialize default VOL connector */ - conn_env_str = HDgetenv("HDF5_VOL_CONNECTOR"); + conn_env_str = HDgetenv(HDF5_VOL_CONNECTOR); if (conn_env_str) { if (NULL == (conn_env_str = HDstrdup(conn_env_str))) TEST_ERROR - if (HDunsetenv("HDF5_VOL_CONNECTOR") < 0) + if (HDunsetenv(HDF5_VOL_CONNECTOR) < 0) TEST_ERROR if (H5VL__reparse_def_vol_conn_variable_test() < 0) TEST_ERROR @@ -2004,7 +2013,7 @@ test_async_vol_props(void) FAIL_STACK_ERROR; /* Set environment variable to use 'fake async' connector & re-init default connector */ - if (HDsetenv("HDF5_VOL_CONNECTOR", "fake_async", TRUE) < 0) + if (HDsetenv(HDF5_VOL_CONNECTOR, "fake_async", TRUE) < 0) TEST_ERROR if (H5VL__reparse_def_vol_conn_variable_test() < 0) TEST_ERROR @@ -2022,7 +2031,7 @@ test_async_vol_props(void) TEST_ERROR /* Reset environment variable & re-init default connector */ - if (HDunsetenv("HDF5_VOL_CONNECTOR") < 0) + if (HDunsetenv(HDF5_VOL_CONNECTOR) < 0) TEST_ERROR if (H5VL__reparse_def_vol_conn_variable_test() < 0) TEST_ERROR @@ -2072,7 +2081,7 @@ test_async_vol_props(void) /* Restore environment variable, if there was one */ if (conn_env_str) { - if (HDsetenv("HDF5_VOL_CONNECTOR", conn_env_str, TRUE) < 0) + if (HDsetenv(HDF5_VOL_CONNECTOR, conn_env_str, TRUE) < 0) TEST_ERROR HDfree(conn_env_str); @@ -2112,7 +2121,7 @@ main(void) int nerrors = 0; /* Get the VFD to use */ - env_h5_drvr = HDgetenv("HDF5_DRIVER"); + env_h5_drvr = HDgetenv(HDF5_DRIVER); if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; @@ -2124,12 +2133,12 @@ main(void) nerrors += test_register_opt_operation() < 0 ? 1 : 0; nerrors += test_native_vol_init() < 0 ? 1 : 0; nerrors += test_basic_file_operation(env_h5_drvr) < 0 ? 1 : 0; - nerrors += test_basic_group_operation() < 0 ? 1 : 0; - nerrors += test_basic_dataset_operation() < 0 ? 1 : 0; + nerrors += test_basic_group_operation(env_h5_drvr) < 0 ? 1 : 0; + nerrors += test_basic_dataset_operation(env_h5_drvr) < 0 ? 1 : 0; nerrors += test_basic_attribute_operation() < 0 ? 1 : 0; nerrors += test_basic_object_operation() < 0 ? 1 : 0; nerrors += test_basic_link_operation() < 0 ? 1 : 0; - nerrors += test_basic_datatype_operation() < 0 ? 1 : 0; + nerrors += test_basic_datatype_operation(env_h5_drvr) < 0 ? 1 : 0; nerrors += test_async_vol_props() < 0 ? 1 : 0; if (nerrors) { diff --git a/test/vol_plugin.c b/test/vol_plugin.c index 7656870..c7baf5a 100644 --- a/test/vol_plugin.c +++ b/test/vol_plugin.c @@ -150,8 +150,8 @@ error: static herr_t test_multiple_registration(void) { - htri_t is_registered = FAIL; - hid_t vol_ids[N_REGISTRATIONS]; + htri_t is_registered = FAIL; + hid_t vol_ids[N_REGISTRATIONS] = {0}; int i; TESTING("registering a VOL connector multiple times"); |