From 86ca181bd8c636607db1cc9a5f7d31ad9baab0f1 Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Fri, 22 Mar 2024 21:31:16 -0500 Subject: [PATCH] Fix 'make check-vfd' target for Autotools (#4211) Changes Autotools testing to use HDF5_TEST_DRIVER environment variable to avoid running tests that don't work well with several VFDs Restores old h5_get_vfd_fapl() testing function to setup a FAPL with a particular VFD Adds a macro for the default VFD name --- config/cmake/HDF5Macros.cmake | 26 +- config/conclude.am | 40 ++- doc/getting-started-with-hdf5-development.md | 2 +- src/H5FDtest.c | 14 +- src/H5private.h | 3 +- test/CMakeVFDTests.cmake | 3 + test/accum.c | 25 +- test/accum_swmr_reader.c | 22 +- test/app_ref.c | 8 +- test/btree2.c | 14 +- test/cache_image.c | 8 +- test/cork.c | 5 +- test/dangle.c | 8 +- test/dsets.c | 54 ++-- test/dtypes.c | 8 +- test/error_test.c | 8 +- test/fheap.c | 8 +- test/filenotclosed.c | 8 +- test/flush1.c | 16 +- test/flush2.c | 6 +- test/flushrefresh.c | 6 +- test/h5test.c | 310 ++++++++++++++++-- test/h5test.h | 5 +- test/links.c | 21 +- test/links_env.c | 8 +- test/mf.c | 324 +++++++++---------- test/objcopy.c | 8 +- test/ohdr.c | 10 +- test/onion.c | 10 +- test/page_buffer.c | 66 ++-- test/reserved.c | 11 +- test/select_io_dset.c | 15 +- test/set_extent.c | 9 +- test/stab.c | 16 +- test/swmr.c | 18 +- test/tarray.c | 16 +- test/test_flush_refresh.sh.in | 8 +- test/test_swmr.pwsh.in | 8 +- test/test_swmr.sh.in | 8 +- test/test_use_cases.sh.in | 8 +- test/test_vds_swmr.pwsh.in | 8 +- test/test_vds_swmr.sh.in | 8 +- test/tfile.c | 104 +++--- test/tmisc.c | 22 +- test/trefer.c | 8 +- test/tselect.c | 8 +- test/tsohm.c | 11 +- test/vds.c | 8 +- test/vds_env.c | 8 +- test/vfd.c | 16 +- test/vfd_plugin.c | 4 +- test/vol.c | 38 ++- testpar/t_pflush1.c | 8 +- testpar/t_pflush2.c | 17 +- tools/lib/h5tools.c | 20 +- tools/lib/h5tools.h | 2 + tools/libtest/h5tools_test_utils.c | 8 +- utils/test/swmr_check_compat_vfd.c | 13 +- 58 files changed, 867 insertions(+), 615 deletions(-) diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index 54543e0c715..e17d6bc46b2 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -70,8 +70,17 @@ macro (H5_SET_VFD_LIST) split multi family - splitter - #log - log VFD currently has file space allocation bugs + # Splitter VFD currently can't be tested with the h5_fileaccess() + # approach due to it trying to lock the same W/O file when two + # files are created/opened with the same FAPL that has the VFD + # set on it. When tested with the environment variable and a + # default FAPL, the VFD appends "_wo" to the filename when the + # W/O path isn't specified, which works for all the tests. + #splitter + # Log VFD currently has file space allocation bugs + #log + # Onion VFD not currently tested with VFD tests + #onion ) if (H5_HAVE_DIRECT) @@ -82,16 +91,21 @@ macro (H5_SET_VFD_LIST) # list (APPEND VFD_LIST mpio) endif () if (H5_HAVE_MIRROR_VFD) - list (APPEND VFD_LIST mirror) + # Mirror VFD needs network configuration, etc. and isn't easy to set + # reasonable defaults for that info. + # list (APPEND VFD_LIST mirror) endif () if (H5_HAVE_ROS3_VFD) - list (APPEND VFD_LIST ros3) + # This would require a custom test suite + # list (APPEND VFD_LIST ros3) endif () if (H5_HAVE_LIBHDFS) - list (APPEND VFD_LIST hdfs) + # This would require a custom test suite + # list (APPEND VFD_LIST hdfs) endif () if (H5_HAVE_SUBFILING_VFD) - list (APPEND VFD_LIST subfiling) + # Subfiling has a few VFD test failures to be resolved + # list (APPEND VFD_LIST subfiling) endif () if (H5_HAVE_WINDOWS) list (APPEND VFD_LIST windows) diff --git a/config/conclude.am b/config/conclude.am index a1fda99ba35..9b73ae77792 100644 --- a/config/conclude.am +++ b/config/conclude.am @@ -155,15 +155,15 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: if test -n "$(HDF5_VOL_CONNECTOR)"; then \ echo "VOL connector: $(HDF5_VOL_CONNECTOR)" | tee -a $${log}; \ fi; \ - if test -n "$(HDF5_DRIVER)"; then \ - echo "Virtual file driver (VFD): $(HDF5_DRIVER)" | tee -a $${log}; \ + if test -n "$(HDF5_TEST_DRIVER)"; then \ + echo "Virtual file driver (VFD): $(HDF5_TEST_DRIVER)" | tee -a $${log}; \ fi; \ else \ if test -n "$(HDF5_VOL_CONNECTOR)"; then \ echo "VOL connector: $(HDF5_VOL_CONNECTOR)" >> $${log}; \ fi; \ - if test -n "$(HDF5_DRIVER)"; then \ - echo "Virtual file driver (VFD): $(HDF5_DRIVER)" >> $${log}; \ + if test -n "$(HDF5_TEST_DRIVER)"; then \ + echo "Virtual file driver (VFD): $(HDF5_TEST_DRIVER)" >> $${log}; \ fi; \ fi; \ if test -n "$(REALTIMEOUTPUT)"; then \ @@ -276,11 +276,22 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS) echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ fi -VFD_LIST = sec2 stdio core core_paged split multi family splitter +VFD_LIST = sec2 stdio core core_paged split multi family + +# Splitter VFD currently can't be tested with the h5_fileaccess() +# approach due to it trying to lock the same W/O file when two +# files are created/opened with the same FAPL that has the VFD +# set on it. When tested with the environment variable and a +# default FAPL, the VFD appends "_wo" to the filename when the +# W/O path isn't specified, which works for all the tests. +# VFD_LIST += splitter # log VFD currently has file space allocation bugs # VFD_LIST += log +# Not currently tested with VFD tests +# VFD_LIST += onion + if DIRECT_VFD_CONDITIONAL VFD_LIST += direct endif @@ -302,21 +313,20 @@ if HDFS_VFD_CONDITIONAL # VFD_LIST += hdfs endif if SUBFILING_VFD_CONDITIONAL - # Several VFD tests fail with Subfiling since it - # doesn't currently support collective I/O + # Subfiling has a few VFD test failures to be resolved # VFD_LIST += subfiling endif # Run test with different Virtual File Driver check-vfd: $(LIB) $(PROGS) $(chk_TESTS) - @for vfd in $(VFD_LIST) dummy; do \ - if test $$vfd != dummy; then \ - echo "============================"; \ - echo "Testing Virtual File Driver $$vfd"; \ - echo "============================"; \ - $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \ - HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ - fi; \ + @for vfd in $(VFD_LIST) dummy; do \ + if test $$vfd != dummy; then \ + echo "============================"; \ + echo "Testing Virtual File Driver $$vfd"; \ + echo "============================"; \ + $(MAKE) $(AM_MAKEFLAGS) check-clean || exit 1; \ + HDF5_TEST_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ + fi; \ done # Test with just the native connector, with a single pass-through connector diff --git a/doc/getting-started-with-hdf5-development.md b/doc/getting-started-with-hdf5-development.md index b6771dca76e..687a1ea7cca 100644 --- a/doc/getting-started-with-hdf5-development.md +++ b/doc/getting-started-with-hdf5-development.md @@ -726,7 +726,7 @@ are others in `h5test.h` if you want to emit custom text, dump the HDF5 error stack when it would not normally be triggered, etc. Most tests will be set up to run with arbitrary VFDs. To do this, you set the -fapl ID using the `h5_fileaccess()` function, which will check the `HDF5_DRIVER` +fapl ID using the `h5_fileaccess()` function, which will check the `HDF5_TEST_DRIVER` environment variable and set the fapl's VFD accordingly. The `h5_fixname()` call can then be used to get a VFD-appropriate filename for the `H5Fcreate()`, etc. call. diff --git a/src/H5FDtest.c b/src/H5FDtest.c index 694bae482e5..2a48fb5b8cd 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -67,14 +67,15 @@ * Purpose: Determines if a VFD supports SWMR. * * The function determines SWMR support by inspecting the - * HDF5_DRIVER environment variable, not by checking the - * VFD feature flags (which do not exist until the driver - * is instantiated). + * HDF5_DRIVER and HDF5_TEST_DRIVER environment variables, not + * by checking the VFD feature flags (which do not exist until + * the driver is instantiated). * * This function is only intended for use in the test code. * * Return: true (1) if the VFD supports SWMR I/O or vfd_name is - * NULL or the empty string (which implies the default VFD). + * NULL or the empty string (which implies the default VFD) or + * compares equal to the default VFD's name. * * false (0) if it does not * @@ -89,7 +90,10 @@ H5FD__supports_swmr_test(const char *vfd_name) FUNC_ENTER_NOAPI_NOINIT_NOERR - if (!vfd_name || !strcmp(vfd_name, "") || !strcmp(vfd_name, "nomatch")) + if (!vfd_name) + vfd_name = getenv("HDF5_TEST_DRIVER"); + + if (!vfd_name || !strcmp(vfd_name, "") || !strcmp(vfd_name, H5_DEFAULT_VFD_NAME)) ret_value = true; else ret_value = !strcmp(vfd_name, "log") || !strcmp(vfd_name, "sec2"); diff --git a/src/H5private.h b/src/H5private.h index 8cee9586769..a3b37e5d834 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -110,7 +110,8 @@ * H5_init_library(); also, make sure that the initializer for default * VFD does *not* call H5_init_library(). */ -#define H5_DEFAULT_VFD H5FD_SEC2 +#define H5_DEFAULT_VFD H5FD_SEC2 +#define H5_DEFAULT_VFD_NAME "sec2" /* Define the default VOL driver */ #define H5_DEFAULT_VOL H5VL_NATIVE diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index f2466ba40cf..a3b40a6107a 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -71,6 +71,9 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD links_env external_env vds_env + mirror_vfd + ros3 + hdfs ) # Skip several tests with subfiling VFD, mostly due diff --git a/test/accum.c b/test/accum.c index 9876998d9b4..cabd4a84c7c 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2049,17 +2049,16 @@ fprintf(stderr, "Random # seed was: %u\n", seed); unsigned test_swmr_write_big(bool newest_format) { - - hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t fapl = H5I_INVALID_HID; /* File access property list */ - H5F_t *rf = NULL; /* File pointer */ - char filename[1024]; - uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */ - uint8_t wbuf[1024]; /* Buffer for reading & writing */ - unsigned u; /* Local index variable */ - bool process_success = false; - char *driver = NULL; /* VFD string (from env variable) */ - bool api_ctx_pushed = false; /* Whether API context pushed */ + const char *driver_name = NULL; /* VFD string (from env variable) */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + H5F_t *rf = NULL; /* File pointer */ + char filename[1024]; + uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */ + uint8_t wbuf[1024]; /* Buffer for reading & writing */ + unsigned u; /* Local index variable */ + bool process_success = false; + bool api_ctx_pushed = false; /* Whether API context pushed */ if (newest_format) TESTING("SWMR write of large metadata: with latest format"); @@ -2077,8 +2076,8 @@ test_swmr_write_big(bool newest_format) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = getenv(HDF5_DRIVER); - if (!H5FD__supports_swmr_test(driver)) { + driver_name = h5_get_test_driver_name(); + if (!H5FD__supports_swmr_test(driver_name)) { SKIPPED(); puts(" Test skipped due to VFD not supporting SWMR I/O."); return 0; diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 5b3ecd8a7fc..a5b16eba860 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -40,15 +40,15 @@ static const char *FILENAME[] = {"accum", "accum_swmr_big", NULL}; int main(void) { - hid_t fid = H5I_INVALID_HID; /* File ID */ - hid_t fapl = H5I_INVALID_HID; /* file access property list ID */ - H5F_t *f = NULL; /* File pointer */ - char filename[1024]; - unsigned u; /* Local index variable */ - uint8_t rbuf[1024]; /* Buffer for reading */ - uint8_t buf[1024]; /* Buffer for holding the expected data */ - char *driver = NULL; /* VFD string (from env variable) */ - bool api_ctx_pushed = false; /* Whether API context pushed */ + const char *driver_name = NULL; /* VFD string (from env variable) */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* file access property list ID */ + H5F_t *f = NULL; /* File pointer */ + char filename[1024]; + unsigned u; /* Local index variable */ + uint8_t rbuf[1024]; /* Buffer for reading */ + uint8_t buf[1024]; /* Buffer for holding the expected data */ + bool api_ctx_pushed = false; /* Whether API context pushed */ /* Testing setup */ h5_reset(); @@ -56,8 +56,8 @@ main(void) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = getenv(HDF5_DRIVER); - if (!H5FD__supports_swmr_test(driver)) + driver_name = h5_get_test_driver_name(); + if (!H5FD__supports_swmr_test(driver_name)) return EXIT_SUCCESS; /* Initialize buffers */ diff --git a/test/app_ref.c b/test/app_ref.c index 729862ee39f..1315f03c86b 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -79,7 +79,7 @@ Abrt_Handler(int H5_ATTR_UNUSED sig) int main(void) { - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ hid_t ids[T_NUMCLASSES]; hid_t fapl; /* File Access Property List */ int ninc; @@ -94,14 +94,12 @@ main(void) TESTING("library shutdown with reference count > 1"); /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* 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 (!strcmp(env_h5_drvr, "multi") || !strcmp(env_h5_drvr, "split")) { + if (!strcmp(driver_name, "multi") || !strcmp(driver_name, "split")) { puts("\n -- SKIPPED for incompatible VFD --"); return 0; } diff --git a/test/btree2.c b/test/btree2.c index 32700d64bd4..fc7748c7b27 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -8598,7 +8598,7 @@ gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam, had *------------------------------------------------------------------------- */ static unsigned -test_remove_lots(const char *env_h5_drvr, hid_t fapl, const H5B2_create_t *cparam) +test_remove_lots(const char *driver_name, hid_t fapl, const H5B2_create_t *cparam) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[1024]; /* Filename to use */ @@ -8656,7 +8656,7 @@ fprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); TEST_ERROR; /* Check for VFD which stores data in multiple files */ - single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, H5_EXCLUDE_NON_MULTIPART_DRIVERS); + single_file_vfd = !h5_driver_uses_multiple_files(driver_name, H5_EXCLUDE_NON_MULTIPART_DRIVERS); if (single_file_vfd) { /* Make a copy of the file in memory, in order to speed up deletion testing */ @@ -9916,12 +9916,10 @@ main(void) unsigned nerrors = 0; /* Cumulative error count */ unsigned reopen; /* Whether to reopen B-tree during tests */ int ExpressMode; - const char *envval = NULL; + const char *driver_name; bool api_ctx_pushed = false; /* Whether API context pushed */ - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Reset library */ h5_reset(); @@ -9929,7 +9927,7 @@ main(void) ExpressMode = GetTestExpress(); /* For the Direct I/O driver, skip intensive tests due to poor performance */ - if (!strcmp(envval, "direct")) + if (!strcmp(driver_name, "direct")) ExpressMode = 2; if (ExpressMode > 1) @@ -10013,7 +10011,7 @@ main(void) if (ExpressMode > 1) printf("***Express test mode on. test_remove_lots skipped\n"); else - nerrors += test_remove_lots(envval, fapl, &cparam); + nerrors += test_remove_lots(driver_name, fapl, &cparam); /* Test more complex B-tree queries */ nerrors += test_find_neighbor(fapl, &cparam, &tparam); diff --git a/test/cache_image.c b/test/cache_image.c index 60e23984366..d2499631878 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -7752,15 +7752,13 @@ evict_on_close_test(bool H5_ATTR_PARALLEL_UNUSED single_file_vfd) int main(void) { - const char *env_h5_drvr; /* File driver value from environment */ + const char *driver_name; /* File driver value from environment */ bool single_file_vfd; /* Whether VFD used stores data in a single file */ unsigned nerrs = 0; int express_test; /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); H5open(); @@ -7772,7 +7770,7 @@ main(void) printf("=========================================\n"); /* Check for VFD which stores data in multiple files */ - single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, H5_EXCLUDE_NON_MULTIPART_DRIVERS); + single_file_vfd = !h5_driver_uses_multiple_files(driver_name, 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/cork.c b/test/cork.c index e0a7196b601..65e19d5be55 100644 --- a/test/cork.c +++ b/test/cork.c @@ -2229,13 +2229,12 @@ main(void) for (swmr = 0; swmr <= 1; swmr++) { if (swmr) { - char *driver = NULL; + const char *driver_name = h5_get_test_driver_name(); /* Skip these tests if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = getenv(HDF5_DRIVER); - if (!H5FD__supports_swmr_test(driver)) { + if (!H5FD__supports_swmr_test(driver_name)) { puts("-- SKIPPED SWMR tests for SWMR-incompatible VFD --"); continue; } diff --git a/test/dangle.c b/test/dangle.c index 4079fce6f51..cad7fe202df 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -623,18 +623,16 @@ test_dangle_force(void) int main(void) { - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ int nerrors = 0; /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* 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 (!strcmp(env_h5_drvr, "multi") || !strcmp(env_h5_drvr, "split")) { + if (!strcmp(driver_name, "multi") || !strcmp(driver_name, "split")) { puts(" -- SKIPPED for incompatible VFD --"); return 0; } diff --git a/test/dsets.c b/test/dsets.c index 8f2d2c4d528..3cc9ccbeae6 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -526,7 +526,7 @@ test_create(hid_t file) *------------------------------------------------------------------------- */ static herr_t -test_simple_io(const char *env_h5_drvr, hid_t fapl) +test_simple_io(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t file = H5I_INVALID_HID, dataset = H5I_INVALID_HID, space = H5I_INVALID_HID, xfer = H5I_INVALID_HID; @@ -541,8 +541,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) TESTING("simple I/O"); /* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */ - if (strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0) { + if (strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0) { h5_fixname(FILENAME[4], fapl, filename, sizeof filename); /* Set up data array */ @@ -688,7 +688,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_userblock_offset(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_userblock_offset(const char *driver_name, hid_t fapl, bool new_format) { char filename[FILENAME_BUF_SIZE]; hid_t file = H5I_INVALID_HID, fcpl = H5I_INVALID_HID, dataset = H5I_INVALID_HID, space = H5I_INVALID_HID; @@ -702,8 +702,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, bool new_format) TESTING("dataset offset with user block"); /* Can't run this test with multi-file VFDs because of HDopen/read/seek the file directly */ - if (strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0) { + if (strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0) { h5_fixname(FILENAME[2], fapl, filename, sizeof filename); /* Set up data array */ @@ -9630,7 +9630,7 @@ test_big_chunks_bypass_cache(hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_chunk_fast(const char *env_h5_driver, hid_t fapl) +test_chunk_fast(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -9693,7 +9693,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) /* Skip this iteration if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if (swmr && !H5FD__supports_swmr_test(env_h5_driver)) + if (swmr && !H5FD__supports_swmr_test(driver_name)) continue; #ifdef H5_HAVE_FILTER_DEFLATE @@ -12200,7 +12200,7 @@ test_zero_dim_dset(hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) +test_swmr_non_latest(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -12221,7 +12221,7 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if (!H5FD__supports_swmr_test(env_h5_driver)) { + if (!H5FD__supports_swmr_test(driver_name)) { SKIPPED(); puts(" Test skipped due to VFD not supporting SWMR I/O."); return SUCCEED; @@ -12470,7 +12470,7 @@ test_swmr_non_latest(const char *env_h5_driver, hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) +test_earray_hdr_fd(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = H5I_INVALID_HID; @@ -12491,7 +12491,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if (!H5FD__supports_swmr_test(env_h5_driver)) { + if (!H5FD__supports_swmr_test(driver_name)) { SKIPPED(); puts(" Test skipped due to VFD not supporting SWMR I/O."); return SUCCEED; @@ -12591,7 +12591,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) +test_farray_hdr_fd(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = H5I_INVALID_HID; @@ -12612,7 +12612,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if (!H5FD__supports_swmr_test(env_h5_driver)) { + if (!H5FD__supports_swmr_test(driver_name)) { SKIPPED(); puts(" Test skipped due to VFD not supporting SWMR I/O."); return SUCCEED; @@ -12712,7 +12712,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl) *------------------------------------------------------------------------- */ static herr_t -test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) +test_bt2_hdr_fd(const char *driver_name, hid_t fapl) { char filename[FILENAME_BUF_SIZE]; hid_t fid = H5I_INVALID_HID; @@ -12739,7 +12739,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - if (!H5FD__supports_swmr_test(env_h5_driver)) { + if (!H5FD__supports_swmr_test(driver_name)) { SKIPPED(); puts(" Test skipped due to VFD not supporting SWMR I/O."); return SUCCEED; @@ -15909,18 +15909,16 @@ main(void) size_t rdcc_nbytes; double rdcc_w0; int nerrors = 0; - const char *envval; + const char *driver_name; bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */ bool driver_is_default_compatible; int i; /* Don't run this test using certain file drivers */ - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(envval, "split") != 0 && strcmp(envval, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -16049,7 +16047,7 @@ main(void) goto error; nerrors += (test_create(file) < 0 ? 1 : 0); - nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_simple_io(driver_name, my_fapl) < 0 ? 1 : 0); nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0); @@ -16075,7 +16073,7 @@ main(void) nerrors += (test_multiopen(file) < 0 ? 1 : 0); nerrors += (test_types(file) < 0 ? 1 : 0); nerrors += (test_floattypes(file) < 0 ? 1 : 0); - nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0); + nerrors += (test_userblock_offset(driver_name, my_fapl, new_format) < 0 ? 1 : 0); if (driver_is_default_compatible) { nerrors += (test_missing_filter(file) < 0 ? 1 : 0); @@ -16105,7 +16103,7 @@ main(void) nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0); nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_fast(driver_name, my_fapl) < 0 ? 1 : 0); nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); @@ -16123,10 +16121,10 @@ main(void) nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0); nerrors += (test_power2up(my_fapl) < 0 ? 1 : 0); - nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_swmr_non_latest(driver_name, my_fapl) < 0 ? 1 : 0); + nerrors += (test_earray_hdr_fd(driver_name, my_fapl) < 0 ? 1 : 0); + nerrors += (test_farray_hdr_fd(driver_name, my_fapl) < 0 ? 1 : 0); + nerrors += (test_bt2_hdr_fd(driver_name, my_fapl) < 0 ? 1 : 0); nerrors += (test_downsize_vlen_scalar_dataset(file) < 0 ? 1 : 0); diff --git a/test/dtypes.c b/test/dtypes.c index bebaef0b602..836d6d89eb0 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -6051,7 +6051,7 @@ test__Float16(void) { #ifdef H5_HAVE__FLOAT16 H5T_path_t *path = NULL; - const char *env_h5_driver; + const char *driver_name; hsize_t dims[1]; htri_t is_little_endian; H5T_t *native_dtype = NULL; @@ -6065,9 +6065,7 @@ test__Float16(void) TESTING("_Float16 datatype"); - env_h5_driver = getenv(HDF5_DRIVER); - if (env_h5_driver == NULL) - env_h5_driver = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Check that native macro maps to a valid type */ if (0 == H5Tget_size(H5T_NATIVE_FLOAT16)) { @@ -6402,7 +6400,7 @@ test__Float16(void) if (H5Fclose(fid) < 0) TEST_ERROR; - if (!h5_driver_uses_multiple_files(env_h5_driver, H5_EXCLUDE_NON_MULTIPART_DRIVERS)) { + if (!h5_driver_uses_multiple_files(driver_name, H5_EXCLUDE_NON_MULTIPART_DRIVERS)) { bool is_default_vfd_compat = false; if (h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &is_default_vfd_compat) < 0) diff --git a/test/error_test.c b/test/error_test.c index 57b1eb7a6b3..bb780215574 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -781,14 +781,12 @@ main(void) hid_t fapl = H5I_INVALID_HID; hid_t estack_id = H5I_INVALID_HID; char filename[1024]; - const char *env_h5_drvr; /* File driver value from environment */ + const char *driver_name; /* File driver value from environment */ const char *FUNC_main = "main"; int i; /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); fprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n"); @@ -879,7 +877,7 @@ main(void) * the test file was pre-generated. */ h5_fixname(DATAFILE, H5P_DEFAULT, filename, sizeof filename); - if (!h5_using_default_driver(env_h5_drvr) && strcmp(env_h5_drvr, "stdio")) { + if (!h5_using_default_driver(driver_name) && strcmp(driver_name, "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. diff --git a/test/fheap.c b/test/fheap.c index 19a1e6adc16..cd1f0c5ec1f 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -15958,17 +15958,15 @@ main(void) unsigned nerrors = 0; /* Cumulative error count */ unsigned num_pb_fs = 1; /* The number of settings to test for page buffering and file space handling */ int ExpressMode; /* Express testing level */ - const char *envval; /* Environment variable */ + const char *driver_name; /* Environment variable */ bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */ bool api_ctx_pushed = false; /* Whether API context pushed */ /* Don't run this test using certain file drivers */ - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(envval, "split") != 0 && strcmp(envval, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Reset library */ h5_reset(); diff --git a/test/filenotclosed.c b/test/filenotclosed.c index 806a7a498d9..a42e1a8c43e 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -59,20 +59,18 @@ main(void) hsize_t chunk_dim[1] = {10}; /* Chunk dimension sizes */ int buf[5] = {1, 2, 3, 4, 5}; /* The data to be written to the dataset */ char filename[100]; /* File name */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool contig_addr_vfd; /* Contiguous address vfd */ /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. * Further investigation is needed to resolve the test failure with the * split/multi driver. Please see HDFFV-10160. */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (!contig_addr_vfd) { SKIPPED(); puts(" Temporary skipped for a spilt/multi driver"); diff --git a/test/flush1.c b/test/flush1.c index 566d5614c9c..f9ecb15fa1e 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -176,20 +176,20 @@ add_dset_to_file(hid_t fid, const char *dset_name) int main(void) { - char *driver = NULL; /* name of current VFD (from env var) */ - bool vfd_supports_swmr; /* whether the current VFD supports SWMR */ - hid_t fid = H5I_INVALID_HID; /* file ID */ - hid_t fapl_id = H5I_INVALID_HID; /* file access proplist ID */ - char filename[1024]; /* filename */ - bool use_swmr; /* whether or not to use SWMR I/O */ + const char *driver_name; /* name of current VFD (from env var) */ + bool vfd_supports_swmr; /* whether the current VFD supports SWMR */ + hid_t fid = H5I_INVALID_HID; /* file ID */ + hid_t fapl_id = H5I_INVALID_HID; /* file access proplist ID */ + char filename[1024]; /* filename */ + bool use_swmr; /* whether or not to use SWMR I/O */ h5_reset(); if ((fapl_id = h5_fileaccess()) < 0) TEST_ERROR; /* Check if the current VFD supports SWMR */ - driver = getenv(HDF5_DRIVER); - vfd_supports_swmr = H5FD__supports_swmr_test(driver); + driver_name = h5_get_test_driver_name(); + vfd_supports_swmr = H5FD__supports_swmr_test(driver_name); /*************************************************/ /* NOTE: Not closing the file ID is intentional! */ diff --git a/test/flush2.c b/test/flush2.c index ccec232e3d7..12daa2be87f 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -223,7 +223,7 @@ clear_status_flags(const char *filename, hid_t fapl_id) int main(void) { - char *driver = NULL; /* name of current VFD (from env var) */ + const char *driver_name; /* name of current VFD (from env var) */ bool vfd_supports_swmr; /* whether the current VFD supports SWMR */ hid_t fapl_id = H5I_INVALID_HID; /* file access proplist ID */ char filename[1024]; /* filename */ @@ -236,8 +236,8 @@ main(void) PUTS_ERROR("bad vfd-dependent fapl"); /* Check if the current VFD supports SWMR */ - driver = getenv(HDF5_DRIVER); - vfd_supports_swmr = H5FD__supports_swmr_test(driver); + driver_name = h5_get_test_driver_name(); + vfd_supports_swmr = H5FD__supports_swmr_test(driver_name); if (h5_driver_is_default_vfd_compatible(fapl_id, &driver_is_default_vfd_compatible) < 0) { printf("Can't check if VFD is compatible with default VFD\n"); diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 297db60e7ac..bab334f1c68 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) { /* Variables */ - const char *envval = NULL; + const char *driver_name = NULL; /* Initialize library */ if (H5open() < 0) @@ -146,9 +146,9 @@ main(int argc, char *argv[]) * anything. */ /* Determine driver being used */ - envval = getenv(HDF5_DRIVER); + driver_name = h5_get_test_driver_name(); - if (envval == NULL || H5FD__supports_swmr_test(envval)) { + if (driver_name == NULL || H5FD__supports_swmr_test(driver_name)) { if (test_flush() != SUCCEED) TEST_ERROR; if (test_refresh() != SUCCEED) diff --git a/test/h5test.c b/test/h5test.c index 567f8438622..e921dc85c52 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -35,8 +35,10 @@ * this test support library. The environment variable is used in preference * 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. + * HDF5_DRIVER/HDF5_TEST_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. * * HDF5_LIBVER_BOUNDS: This string describes what library version bounds to * use for HDF5 file access. See h5_get_libver_fapl() for details. @@ -452,7 +454,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu bool nest_printf, bool subst_for_superblock) { const char *prefix = NULL; - const char *driver_env_var = NULL; /* HDF5_DRIVER environment variable */ + const char *driver_env_var = NULL; /* HDF5_DRIVER/HDF5_TEST_DRIVER environment variable */ char *ptr, last = '\0'; const char *suffix = _suffix; size_t i, j; @@ -467,7 +469,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu /* 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 = getenv(HDF5_DRIVER); + driver_env_var = h5_get_test_driver_name(); if (driver_env_var && (H5P_DEFAULT == fapl) && subst_for_superblock) fapl = H5P_FILE_ACCESS_DEFAULT; @@ -491,19 +493,16 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fu } else if (H5FD_MULTI == driver) { - /* 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. + /* Check the HDF5_DRIVER/HDF5_TEST_DRIVER environment + * variable in case we are using the split driver since + * both of those use the multi VFD under the hood. */ -#ifdef HDF5_DRIVER - /* Use the environment variable, then the compile-time constant */ - if (!driver_env_var) - driver_env_var = HDF5_DRIVER; -#endif if (driver_env_var && !strcmp(driver_env_var, "split")) { /* split VFD */ if (subst_for_superblock) suffix = ".h5.meta"; + else + suffix = NULL; } else { /* multi VFD */ @@ -728,6 +727,10 @@ 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; + /* Check for libver bounds */ if (h5_get_libver_fapl(fapl_id) < 0) goto error; @@ -760,6 +763,10 @@ 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; + /* Check for libver bounds */ if ((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0) goto error; @@ -772,6 +779,241 @@ h5_fileaccess_flags(unsigned flags) return H5I_INVALID_HID; } /* end h5_fileaccess_flags() */ +/*------------------------------------------------------------------------- + * Function: h5_get_vfd_fapl + * + * Purpose: Sets the file driver for a FAPL according to the value + * specified in the environment variable "HDF5_DRIVER" or + * "HDF5_TEST_DRIVER". + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +h5_get_vfd_fapl(hid_t fapl) +{ + const char *env = NULL; /* HDF5_DRIVER/HDF5_TEST_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 = getenv(HDF5_DRIVER); + if (!env) + env = getenv("HDF5_TEST_DRIVER"); + + /* 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. + */ + strncpy(buf, env, sizeof(buf)); + buf[sizeof(buf) - 1] = '\0'; + if (NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) + goto done; + + if (!strcmp(tok, "sec2")) { + /* POSIX (section 2) read() and write() system calls */ + if (H5Pset_fapl_sec2(fapl) < 0) + goto error; + } + else if (!strcmp(tok, "stdio")) { + /* Standard C fread() and fwrite() system calls */ + if (H5Pset_fapl_stdio(fapl) < 0) + goto error; + } + else if (!strcmp(tok, "core")) { + /* In-memory driver settings (backing store on, 1 MB increment) */ + if (H5Pset_fapl_core(fapl, H5_MB, TRUE) < 0) + goto error; + } + else if (!strcmp(tok, "core_paged")) { + /* In-memory driver with write tracking and paging on */ + if (H5Pset_fapl_core(fapl, H5_MB, TRUE) < 0) + goto error; + if (H5Pset_core_write_tracking(fapl, TRUE, 4096) < 0) + goto error; + } + else if (!strcmp(tok, "split")) { + /* Split meta data and raw data each using default driver */ + if (H5Pset_fapl_split(fapl, ".meta", H5P_DEFAULT, ".raw", H5P_DEFAULT) < 0) + goto error; + } + else if (!strcmp(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; + const int multi_memname_maxlen = 1024; + + memset(memb_map, 0, sizeof(memb_map)); + memset(memb_fapl, 0, sizeof(memb_fapl)); + memset(memb_name, 0, sizeof(memb_name)); + memset(memb_addr, 0, sizeof(memb_addr)); + + assert(strlen(multi_letters) == H5FD_MEM_NTYPES); + for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { + memb_fapl[mt] = H5P_DEFAULT; + if (NULL == (sv[mt] = malloc(multi_memname_maxlen))) + goto error; + snprintf(sv[mt], multi_memname_maxlen, "%%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++) + free(sv[mt]); + } + else if (!strcmp(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)(strtod(tok, NULL) * 1024 * 1024); + if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) + goto error; + } + else if (!strcmp(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)strtol(tok, NULL, 0); + + if (H5Pset_fapl_log(fapl, NULL, log_flags, 0) < 0) + goto error; + } +#ifdef H5_HAVE_DIRECT + else if (!strcmp(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 if (!strcmp(tok, "splitter")) { + H5FD_splitter_vfd_config_t *splitter_config; + static size_t file_count = 0; + + if (NULL == (splitter_config = malloc(sizeof(*splitter_config)))) + goto error; + + splitter_config->magic = H5FD_SPLITTER_MAGIC; + splitter_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; + splitter_config->ignore_wo_errs = false; + memset(splitter_config->log_file_path, 0, H5FD_SPLITTER_PATH_MAX + 1); + + /* + * We need access to the base filename to generate a unique name + * for the W/O file for this FAPL. Until this is refactored, just + * generate unique names with a counter. + */ + snprintf(splitter_config->wo_path, H5FD_SPLITTER_PATH_MAX + 1, "splitter_wo_file_%zu.h5", + file_count++); + + /* Setup R/W and W/O channel FAPLs since the default FAPL + * has the splitter driver set on it from the environment + */ + if ((splitter_config->rw_fapl_id = H5Pcopy(H5P_FILE_ACCESS_DEFAULT)) < 0) { + free(splitter_config); + goto error; + } + if ((splitter_config->wo_fapl_id = H5Pcopy(H5P_FILE_ACCESS_DEFAULT)) < 0) { + H5Pclose(splitter_config->rw_fapl_id); + free(splitter_config); + goto error; + } + if (H5Pset_fapl_sec2(splitter_config->rw_fapl_id) < 0) { + H5Pclose(splitter_config->rw_fapl_id); + H5Pclose(splitter_config->wo_fapl_id); + free(splitter_config); + goto error; + } + if (H5Pset_fapl_sec2(splitter_config->wo_fapl_id) < 0) { + H5Pclose(splitter_config->rw_fapl_id); + H5Pclose(splitter_config->wo_fapl_id); + free(splitter_config); + goto error; + } + + if (H5Pset_fapl_splitter(fapl, splitter_config) < 0) { + H5Pclose(splitter_config->rw_fapl_id); + H5Pclose(splitter_config->wo_fapl_id); + free(splitter_config); + goto error; + } + + free(splitter_config); + } + else if (!strcmp(tok, "onion")) { + /* TODO */ + return 0; + } +#ifdef H5_HAVE_SUBFILING_VFD + else if (!strcmp(tok, H5FD_SUBFILING_NAME)) { + /* Use default subfiling configuration */ + if (H5Pset_fapl_subfiling(fapl, NULL) < 0) + goto error; + } +#endif +#ifdef H5_HAVE_PARALLEL + else if (!strcmp(tok, "mpio")) { + int mpi_initialized, mpi_finalized; + + MPI_Initialized(&mpi_initialized); + MPI_Finalized(&mpi_finalized); + + if (mpi_initialized && !mpi_finalized) { + if (H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0) + goto error; + } + } +#endif +#ifdef H5_HAVE_MIRROR_VFD + else if (!strcmp(tok, "mirror")) { + /* TODO */ + return 0; + } +#endif +#ifdef H5_HAVE_LIBHDFS + else if (!strcmp(tok, "hdfs")) { + /* TODO */ + return 0; + } +#endif +#ifdef H5_HAVE_ROS3_VFD + else if (!strcmp(tok, "ros3")) { + /* TODO */ + return 0; + } +#endif + else { + /* Unknown driver */ + goto error; + } + +done: + return 0; + +error: + return -1; +} /* end h5_get_vfd_fapl() */ + /*------------------------------------------------------------------------- * Function: h5_get_libver_fapl * @@ -786,10 +1028,10 @@ h5_fileaccess_flags(unsigned flags) herr_t h5_get_libver_fapl(hid_t fapl) { - const char *env = NULL; /* HDF5_DRIVER environment variable */ + const char *env = NULL; /* HDF5_LIBVER_BOUNDS 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 */ + char buf[1024]; /* buffer for tokenizing HDF5_LIBVER_BOUNDS */ /* Get the environment variable, if it exists */ env = getenv("HDF5_LIBVER_BOUNDS"); @@ -1099,9 +1341,9 @@ h5_get_file_size(const char *filename, hid_t fapl) else if (driver == H5FD_MULTI) { H5FD_mem_t mt; h5_stat_size_t tot_size = 0; - char *driver_env_var = NULL; + const char *driver_env_var = NULL; - driver_env_var = getenv(HDF5_DRIVER); + driver_env_var = h5_get_test_driver_name(); if (driver_env_var && !strcmp(driver_env_var, "split")) { for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { if (mt != H5FD_MEM_DRAW && mt != H5FD_MEM_SUPER) @@ -2193,12 +2435,38 @@ h5_using_native_vol(hid_t fapl_id, hid_t obj_id, bool *is_native_vol) return ret_value; } +/*------------------------------------------------------------------------- + * Function: h5_get_test_driver_name + * + * Purpose: Checks the HDF5_DRIVER and HDF5_TEST_DRIVER environment + * variables to see if a driver name has been set for testing. + * + * Return: Driver name if set/NULL otherwise + * + *------------------------------------------------------------------------- + */ +const char * +h5_get_test_driver_name(void) +{ + char *envval; + + assert(H5_DEFAULT_VFD == H5FD_SEC2); + + if ((envval = getenv(HDF5_DRIVER))) + return envval; + else if ((envval = getenv("HDF5_TEST_DRIVER"))) + return envval; + else + return H5_DEFAULT_VFD_NAME; +} + /*------------------------------------------------------------------------- * 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). + * default VFD. If `drv_name` is NULL, the HDF5_DRIVER and + * HDF5_TEST_DRIVER environment variables are checked instead + * (if set). * * Return: true/false * @@ -2212,10 +2480,10 @@ h5_using_default_driver(const char *drv_name) assert(H5_DEFAULT_VFD == H5FD_SEC2); if (!drv_name) - drv_name = getenv(HDF5_DRIVER); + drv_name = h5_get_test_driver_name(); if (drv_name) - return (!strcmp(drv_name, "sec2") || !strcmp(drv_name, "nomatch")); + return !strcmp(drv_name, H5_DEFAULT_VFD_NAME); return ret_val; } @@ -2333,7 +2601,7 @@ h5_driver_uses_multiple_files(const char *drv_name, unsigned flags) bool ret_val = false; if (!drv_name) - drv_name = getenv(HDF5_DRIVER); + drv_name = h5_get_test_driver_name(); if (drv_name) { if ((flags & H5_EXCLUDE_MULTIPART_DRIVERS) == 0) { diff --git a/test/h5test.h b/test/h5test.h index 8f785674abc..9ef94943a81 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -230,7 +230,8 @@ 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_LIBVER 0x01 +#define H5_FILEACCESS_VFD 0x01 +#define H5_FILEACCESS_LIBVER 0x02 /* Flags for h5_driver_uses_multiple_files() */ #define H5_EXCLUDE_MULTIPART_DRIVERS 0x01 @@ -292,12 +293,14 @@ H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const cha H5TEST_DLL herr_t h5_check_if_file_locking_enabled(bool *are_enabled); H5TEST_DLL void h5_check_file_locking_env_var(htri_t *use_locks, htri_t *ignore_disabled_locks); H5TEST_DLL herr_t h5_using_native_vol(hid_t fapl_id, hid_t obj_id, bool *is_native_vol); +H5TEST_DLL const char *h5_get_test_driver_name(void); H5TEST_DLL bool h5_using_default_driver(const char *drv_name); H5TEST_DLL herr_t h5_using_parallel_driver(hid_t fapl_id, bool *driver_is_parallel); H5TEST_DLL herr_t h5_driver_is_default_vfd_compatible(hid_t fapl_id, bool *default_vfd_compatible); H5TEST_DLL bool 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/links.c b/test/links.c index 87efae8107b..4ea612ebdfd 100644 --- a/test/links.c +++ b/test/links.c @@ -9537,7 +9537,7 @@ external_set_elink_fapl3(bool new_format) *------------------------------------------------------------------------- */ static int -external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, bool new_format) +external_set_elink_acc_flags(const char *driver_name, hid_t fapl, bool new_format) { hid_t file1 = H5I_INVALID_HID, file2 = H5I_INVALID_HID, group = H5I_INVALID_HID, subgroup = H5I_INVALID_HID, gapl = H5I_INVALID_HID; @@ -9671,7 +9671,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, bool new_forma TEST_ERROR; /* Only run this part with VFDs that support SWMR */ - if (H5FD__supports_swmr_test(env_h5_drvr)) { + if (H5FD__supports_swmr_test(driver_name)) { /* Reopen file1, with read-write and SWMR-write access */ /* Only supported under the latest file format */ @@ -12663,7 +12663,7 @@ external_link_strong(hid_t fapl, bool new_format) *------------------------------------------------------------------------- */ static int -external_symlink(const char *env_h5_drvr, hid_t fapl, bool new_format) +external_symlink(const char *driver_name, hid_t fapl, bool new_format) { #ifdef H5_HAVE_SYMLINK hid_t file1 = H5I_INVALID_HID; @@ -12698,8 +12698,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, bool new_format) /* Skip test when using VFDs that can't provide a POSIX compatible file * descriptor. */ - have_posix_compat_vfd = (bool)(!strcmp(env_h5_drvr, "sec2") || !strcmp(env_h5_drvr, "core") || - !strcmp(env_h5_drvr, "nomatch")); + have_posix_compat_vfd = (bool)(!strcmp(driver_name, "sec2") || !strcmp(driver_name, "core")); if (!have_posix_compat_vfd) { SKIPPED(); puts(" Current VFD doesn't support POSIX I/O calls"); @@ -23108,12 +23107,10 @@ main(void) unsigned new_format; /* Whether to use the new format or not */ unsigned minimize_dset_oh; unsigned efc; /* Whether to use the external file cache */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool driver_is_default_compatible; - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); h5_reset(); fapl = h5_fileaccess(); @@ -23182,7 +23179,7 @@ main(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Skip external link tests for splitter VFD, which has external link-related bugs */ - if (strcmp(env_h5_drvr, "splitter")) { + if (strcmp(driver_name, "splitter")) { /* tests for external link */ /* Test external file cache first, so it sees the default efc setting on the fapl @@ -23197,7 +23194,7 @@ main(void) /* 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; + nerrors += external_set_elink_acc_flags(driver_name, 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++) { @@ -23269,7 +23266,7 @@ main(void) 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_symlink(driver_name, 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; diff --git a/test/links_env.c b/test/links_env.c index 1eae52a5128..ed9c3ba7f0c 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -144,17 +144,15 @@ external_link_env(hid_t fapl, bool new_format) int main(void) { - const char *env_h5_drvr; /* File driver value from environment */ + const char *driver_name; /* 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 = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Splitter VFD has issues with external links */ - if (!strcmp(env_h5_drvr, "splitter")) { + if (!strcmp(driver_name, "splitter")) { puts(" -- SKIPPED for incompatible VFD --"); exit(EXIT_SUCCESS); } diff --git a/test/mf.c b/test/mf.c index 269419f546c..909a7ec89f1 100644 --- a/test/mf.c +++ b/test/mf.c @@ -108,47 +108,47 @@ typedef enum { static int check_stats(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *state); -static unsigned test_mf_eoa(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl); +static unsigned test_mf_eoa(const char *driver_name, hid_t fapl); +static unsigned test_mf_eoa_shrink(const char *driver_name, hid_t fapl); +static unsigned test_mf_eoa_extend(const char *driver_name, hid_t fapl); static unsigned test_dichotomy(hid_t fapl); static unsigned test_mf_fs_start(hid_t fapl); static unsigned test_mf_fs_alloc_free(hid_t fapl); static unsigned test_mf_fs_extend(hid_t fapl); -static unsigned test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl); -static unsigned test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); -static unsigned test_mf_tmp(const char *env_h5_drvr, hid_t fapl, bool new_format); -static unsigned test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, bool new_format); -static unsigned test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, bool new_format); -static unsigned test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, bool new_format); -static unsigned test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, bool new_format); +static unsigned test_mf_fs_absorb(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc1(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc2(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc3(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc4(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc5(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc6(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_alloc7(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_extend(const char *driver_name, hid_t fapl); +static unsigned test_mf_aggr_absorb(const char *driver_name, hid_t fapl); +static unsigned test_mf_align_eoa(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_fs(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc1(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc2(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc3(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc4(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc5(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_align_alloc6(const char *driver_name, hid_t fapl, hid_t new_fapl); +static unsigned test_mf_tmp(const char *driver_name, hid_t fapl, bool new_format); +static unsigned test_mf_fs_gone(const char *driver_name, hid_t fapl, bool new_format); +static unsigned test_mf_strat_thres_gone(const char *driver_name, hid_t fapl, bool new_format); +static unsigned test_mf_fs_persist(const char *driver_name, hid_t fapl, bool new_format); +static unsigned test_mf_strat_thres_persist(const char *driver_name, hid_t fapl, bool new_format); #ifdef PB_OUT static unsigned test_mf_fs_persist_split(void); static unsigned test_mf_fs_persist_multi(void); #endif -static unsigned test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_small(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_large(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_try_shrink(const char *env_h5_drvr, hid_t fapl); -static unsigned test_page_alignment(const char *env_h5_drvr, hid_t fapl); +static unsigned test_page_alloc_xfree(const char *driver_name, hid_t fapl); +static unsigned test_page_small(const char *driver_name, hid_t fapl); +static unsigned test_page_large(const char *driver_name, hid_t fapl); +static unsigned test_page_large_try_extend(const char *driver_name, hid_t fapl); +static unsigned test_page_small_try_extend(const char *driver_name, hid_t fapl); +static unsigned test_page_try_shrink(const char *driver_name, hid_t fapl); +static unsigned test_page_alignment(const char *driver_name, hid_t fapl); /* * Verify statistics for the free-space manager @@ -210,7 +210,7 @@ check_stats(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *state) *------------------------------------------------------------------------- */ static unsigned -test_mf_eoa(const char *env_h5_drvr, hid_t fapl) +test_mf_eoa(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fapl_new = H5I_INVALID_HID; /* copy of fapl */ @@ -228,8 +228,8 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -359,7 +359,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) +test_mf_eoa_shrink(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fapl_new = H5I_INVALID_HID; /* copy of fapl */ @@ -377,8 +377,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -646,7 +646,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) +test_mf_eoa_extend(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fapl_new = H5I_INVALID_HID; /* copy of fapl */ @@ -665,8 +665,8 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) /* Skip test when using VFDs that has different address spaces for each * type of metadata allocation. Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -861,7 +861,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_tmp(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_mf_tmp(const char *driver_name, hid_t fapl, bool new_format) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fapl2 = H5I_INVALID_HID; /* File access property list */ @@ -873,7 +873,7 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, bool new_format) TESTING("'temporary' file space allocation with old library format"); /* Can't run this test with multi-file VFDs */ - if (!h5_driver_uses_multiple_files(env_h5_drvr, 0)) { + if (!h5_driver_uses_multiple_files(driver_name, 0)) { char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -2002,7 +2002,7 @@ test_mf_fs_extend(hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) +test_mf_fs_absorb(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2017,7 +2017,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) TESTING("A free-space section absorbs an aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2177,7 +2177,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc1(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2193,8 +2193,8 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 1"); /* Skip test when using VFDs that don't use the metadata aggregator. Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2330,7 +2330,7 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc2(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2345,8 +2345,8 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 2"); /* Skip test when using VFDs that don't use the metadata aggregator. Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2487,7 +2487,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc3(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2504,7 +2504,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator: test 3"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2657,7 +2657,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc4(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2672,7 +2672,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 4"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2806,7 +2806,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc5(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2821,7 +2821,7 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 5"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -2943,7 +2943,7 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc6(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -2959,7 +2959,7 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 6"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3117,7 +3117,7 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_alloc7(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -3133,7 +3133,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_alloc() of meta/sdata aggregator:test 7"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3288,7 +3288,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_extend(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -3304,7 +3304,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_extend() of meta/sdata aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3585,7 +3585,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) +test_mf_aggr_absorb(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -3602,7 +3602,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 1"); /* Skip test when using VFDs that don't use the metadata aggregator */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -3835,7 +3835,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_eoa(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fapl1 = H5I_INVALID_HID; @@ -3857,8 +3857,8 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4132,7 +4132,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_fs(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -4307,8 +4307,8 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { if ((file_size = h5_get_file_size(filename, new_fapl)) < 0) TEST_ERROR; @@ -4493,7 +4493,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc1(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -4514,8 +4514,8 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -4757,7 +4757,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc2(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -4777,8 +4777,8 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5102,7 +5102,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc3(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -5123,8 +5123,8 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "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,7 +5417,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc4(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -5437,8 +5437,8 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "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,7 +5635,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc5(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -5656,8 +5656,8 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -5906,7 +5906,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) *------------------------------------------------------------------------- */ static unsigned -test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) +test_mf_align_alloc6(const char *driver_name, hid_t fapl, hid_t new_fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ char filename[FILENAME_LEN]; /* Filename to use */ @@ -5927,8 +5927,8 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * don't push mis-aligned space fragments on the file free space list. * Also skip test for Direct VFD. */ - suitable_vfd = (bool)(strcmp(env_h5_drvr, "stdio") != 0 && strcmp(env_h5_drvr, "split") != 0 && - strcmp(env_h5_drvr, "multi") != 0 && strcmp(env_h5_drvr, "direct") != 0); + suitable_vfd = (bool)(strcmp(driver_name, "stdio") != 0 && strcmp(driver_name, "split") != 0 && + strcmp(driver_name, "multi") != 0 && strcmp(driver_name, "direct") != 0); if (suitable_vfd) { /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -6116,7 +6116,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * endpoint is extended to allocate an aligned object */ static unsigned -test_mf_bug1(const char *env_h5_drvr, hid_t fapl) +test_mf_bug1(const char *driver_name, hid_t fapl) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t copied_fapl = H5I_INVALID_HID; /* FAPL to use for this test */ @@ -6147,9 +6147,9 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) TEST_ERROR; /* Check for split or multi driver */ - if (!strcmp(env_h5_drvr, "split")) + if (!strcmp(driver_name, "split")) split = true; - else if (!strcmp(env_h5_drvr, "multi")) + else if (!strcmp(driver_name, "multi")) multi = true; /* Add alignment to member files for split/multi driver */ @@ -6931,7 +6931,7 @@ test_mf_fs_persist_multi(void) *------------------------------------------------------------------------- */ static unsigned -test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_mf_fs_persist(const char *driver_name, hid_t fapl, bool new_format) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */ @@ -6949,7 +6949,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, bool new_format) else TESTING("File's free-space is persistent with old library format"); - if (strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0) { + if (strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0) { /* File creation property list template */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) @@ -7106,7 +7106,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, bool new_format) *------------------------------------------------------------------------- */ static unsigned -test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_mf_fs_gone(const char *driver_name, hid_t fapl, bool new_format) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ @@ -7126,7 +7126,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, bool new_format) TESTING("File's free-space is going away with old library format"); /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { @@ -7296,7 +7296,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, bool new_format) *------------------------------------------------------------------------- */ static unsigned -test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_mf_strat_thres_persist(const char *driver_name, hid_t fapl, bool new_format) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list template */ @@ -7317,7 +7317,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, bool new_format TESTING("File space strategy/persisting/threshold with old library format"); /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -7465,7 +7465,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, bool new_format *------------------------------------------------------------------------- */ static unsigned -test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, bool new_format) +test_mf_strat_thres_gone(const char *driver_name, hid_t fapl, bool new_format) { hid_t file = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list template */ @@ -7487,7 +7487,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, bool new_format) TESTING("File space merge/shrink for section size < threshold with old library format"); /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -7801,7 +7801,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, bool is_multi_or_split) *------------------------------------------------------------------------- */ static unsigned -test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) +test_page_alloc_xfree(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -7819,9 +7819,9 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_alloc/H5MF_xfree"); /* Check for split or multi driver */ - if (!strcmp(env_h5_drvr, "split")) + if (!strcmp(driver_name, "split")) split = true; - else if (!strcmp(env_h5_drvr, "multi")) + else if (!strcmp(driver_name, "multi")) multi = true; if (!multi && !split) { @@ -8031,7 +8031,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) +test_page_try_shrink(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -8048,7 +8048,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_try_shrink()"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { @@ -8160,7 +8160,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) +test_page_small_try_extend(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -8175,8 +8175,8 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_try_extend() a small block"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0); if (contig_addr_vfd) { @@ -8338,7 +8338,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) +test_page_large_try_extend(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -8352,7 +8352,7 @@ test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: H5MF_try_extend() a large block"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { @@ -8499,7 +8499,7 @@ test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_large(const char *env_h5_drvr, hid_t fapl) +test_page_large(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -8514,7 +8514,7 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: large allocations and de-allocations"); /* Current VFD that does not support continuous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); if (contig_addr_vfd) { @@ -8652,7 +8652,7 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_small(const char *env_h5_drvr, hid_t fapl) +test_page_small(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ @@ -8666,11 +8666,11 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation for file space: small allocations and de-allocations"); - if (!strcmp(env_h5_drvr, "split")) + if (!strcmp(driver_name, "split")) split = true; - else if (!strcmp(env_h5_drvr, "multi")) + else if (!strcmp(driver_name, "multi")) multi = true; - else if (!strcmp(env_h5_drvr, "family")) + else if (!strcmp(driver_name, "family")) family = true; if (!multi && !split) { @@ -8822,7 +8822,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) *------------------------------------------------------------------------- */ static unsigned -test_page_alignment(const char *env_h5_drvr, hid_t fapl) +test_page_alignment(const char *driver_name, hid_t fapl) { hid_t fid = H5I_INVALID_HID; /* File ID */ @@ -8839,9 +8839,9 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) TESTING("Paged aggregation and H5Pset_alignment: verify proper alignment is used"); /* Check for split or multi driver */ - if (!strcmp(env_h5_drvr, "split")) + if (!strcmp(driver_name, "split")) split = true; - else if (!strcmp(env_h5_drvr, "multi")) + else if (!strcmp(driver_name, "multi")) multi = true; if (!multi && !split) { @@ -9130,13 +9130,11 @@ main(void) hid_t new_fapl = H5I_INVALID_HID; /* File access property list for alignment & aggr setting */ unsigned nerrors = 0; /* Cumulative error count */ test_type_t curr_test; /* Current test being worked on */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool api_ctx_pushed = false; /* Whether API context pushed */ /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); h5_reset(); @@ -9151,9 +9149,9 @@ main(void) if ((new_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR; /* For old library format--interaction with file allocation */ - nerrors += test_mf_eoa(env_h5_drvr, fapl); - nerrors += test_mf_eoa_shrink(env_h5_drvr, fapl); - nerrors += test_mf_eoa_extend(env_h5_drvr, fapl); + nerrors += test_mf_eoa(driver_name, fapl); + nerrors += test_mf_eoa_shrink(driver_name, fapl); + nerrors += test_mf_eoa_extend(driver_name, fapl); /* For old library format */ nerrors += test_dichotomy(new_fapl); @@ -9162,18 +9160,18 @@ main(void) nerrors += test_mf_fs_start(fapl); nerrors += test_mf_fs_alloc_free(fapl); nerrors += test_mf_fs_extend(fapl); - nerrors += test_mf_fs_absorb(env_h5_drvr, fapl); + nerrors += test_mf_fs_absorb(driver_name, fapl); /* For old library format--interaction with meta/sdata aggregator */ - nerrors += test_mf_aggr_alloc1(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc2(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc3(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc4(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc5(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc6(env_h5_drvr, fapl); - nerrors += test_mf_aggr_alloc7(env_h5_drvr, fapl); - nerrors += test_mf_aggr_extend(env_h5_drvr, fapl); - nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl); + nerrors += test_mf_aggr_alloc1(driver_name, fapl); + nerrors += test_mf_aggr_alloc2(driver_name, fapl); + nerrors += test_mf_aggr_alloc3(driver_name, fapl); + nerrors += test_mf_aggr_alloc4(driver_name, fapl); + nerrors += test_mf_aggr_alloc5(driver_name, fapl); + nerrors += test_mf_aggr_alloc6(driver_name, fapl); + nerrors += test_mf_aggr_alloc7(driver_name, fapl); + nerrors += test_mf_aggr_extend(driver_name, fapl); + nerrors += test_mf_aggr_absorb(driver_name, fapl); /* For old library format--tests for alignment */ for (curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) { @@ -9195,43 +9193,43 @@ main(void) break; } /* end switch */ - nerrors += test_mf_align_eoa(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_fs(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc1(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc2(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc3(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc4(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc5(env_h5_drvr, fapl, new_fapl); - nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl); + nerrors += test_mf_align_eoa(driver_name, fapl, new_fapl); + nerrors += test_mf_align_fs(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc1(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc2(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc3(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc4(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc5(driver_name, fapl, new_fapl); + nerrors += test_mf_align_alloc6(driver_name, fapl, new_fapl); } /* end for */ /* For old and new format--interaction with temporary file space allocation */ - nerrors += test_mf_tmp(env_h5_drvr, fapl, false); - nerrors += test_mf_tmp(env_h5_drvr, fapl, true); + nerrors += test_mf_tmp(driver_name, fapl, false); + nerrors += test_mf_tmp(driver_name, fapl, true); /* For old and new format--free-space merge/shrunk away */ /* Temporary: modify to skip testing for multi/split driver: fail file create when persisting free-space or using paged aggregation strategy */ - nerrors += test_mf_fs_gone(env_h5_drvr, fapl, false); - nerrors += test_mf_fs_gone(env_h5_drvr, fapl, true); + nerrors += test_mf_fs_gone(driver_name, fapl, false); + nerrors += test_mf_fs_gone(driver_name, fapl, true); /* Temporary: modify to skip testing multi/split driver: fail file create when persisting free-space or using paged aggregation strategy */ - nerrors += test_mf_strat_thres_gone(env_h5_drvr, fapl, false); - nerrors += test_mf_strat_thres_gone(env_h5_drvr, fapl, true); + nerrors += test_mf_strat_thres_gone(driver_name, fapl, false); + nerrors += test_mf_strat_thres_gone(driver_name, fapl, true); /* For old and new format--persisting free-space */ /* Temporary: Modify to skip testing for multi/split driver: fail file create when persisting free-space or using paged aggregation strategy */ - nerrors += test_mf_fs_persist(env_h5_drvr, fapl, false); - nerrors += test_mf_fs_persist(env_h5_drvr, fapl, true); + nerrors += test_mf_fs_persist(driver_name, fapl, false); + nerrors += test_mf_fs_persist(driver_name, fapl, true); /* Temporary: modify to skip testing for multi/split driver: fail file create when persisting free-space or using paged aggregation strategy */ - nerrors += test_mf_strat_thres_persist(env_h5_drvr, fapl, false); - nerrors += test_mf_strat_thres_persist(env_h5_drvr, fapl, true); + nerrors += test_mf_strat_thres_persist(driver_name, fapl, false); + nerrors += test_mf_strat_thres_persist(driver_name, fapl, true); /* Temporary skipped for multi/split drivers: fail file create when persisting free-space or using paged aggregation strategy */ @@ -9246,16 +9244,16 @@ main(void) */ /* Temporary: The following 7 tests are modified to skip testing for multi/split driver: fail file create when persisting free-space or using paged aggregation strategy */ - nerrors += test_page_small(env_h5_drvr, fapl); - nerrors += test_page_large(env_h5_drvr, fapl); - nerrors += test_page_large_try_extend(env_h5_drvr, fapl); - nerrors += test_page_small_try_extend(env_h5_drvr, fapl); - nerrors += test_page_try_shrink(env_h5_drvr, fapl); - nerrors += test_page_alloc_xfree(env_h5_drvr, fapl); /* can handle multi/split */ - nerrors += test_page_alignment(env_h5_drvr, fapl); /* can handle multi/split */ + nerrors += test_page_small(driver_name, fapl); + nerrors += test_page_large(driver_name, fapl); + nerrors += test_page_large_try_extend(driver_name, fapl); + nerrors += test_page_small_try_extend(driver_name, fapl); + nerrors += test_page_try_shrink(driver_name, fapl); + nerrors += test_page_alloc_xfree(driver_name, fapl); /* can handle multi/split */ + nerrors += test_page_alignment(driver_name, fapl); /* can handle multi/split */ /* tests for specific bugs */ - nerrors += test_mf_bug1(env_h5_drvr, fapl); + nerrors += test_mf_bug1(driver_name, fapl); if (H5Pclose(new_fapl) < 0) FAIL_STACK_ERROR; diff --git a/test/objcopy.c b/test/objcopy.c index 08e7b07fbe5..9205e961c22 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -17124,13 +17124,11 @@ main(void) unsigned max_compact, min_dense; int configuration; /* Configuration of tests. */ int ExpressMode; - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool same_file; /* Whether to run tests that only use one file */ bool driver_is_default_compatible; - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Setup */ h5_reset(); @@ -17292,7 +17290,7 @@ main(void) false, "H5Ocopy(): expand external link"); /* Splitter VFD currently has external link-related bugs */ - if (strcmp(env_h5_drvr, "splitter")) { + if (strcmp(driver_name, "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"); diff --git a/test/ohdr.c b/test/ohdr.c index 99b979b0777..87f88f64ac5 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -1827,7 +1827,7 @@ main(void) hid_t fapl = H5I_INVALID_HID; hid_t file = H5I_INVALID_HID; H5F_t *f = NULL; - const char *env_h5_drvr; /* File driver value from environment */ + const char *driver_name; /* File driver value from environment */ bool single_file_vfd; /* Whether VFD used stores data in a single file */ char filename[1024]; H5O_hdr_info_t hdr_info; /* Object info */ @@ -1839,12 +1839,10 @@ main(void) herr_t ret; /* Generic return value */ /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Check for VFD which stores data in multiple files */ - single_file_vfd = !h5_driver_uses_multiple_files(env_h5_drvr, 0); + single_file_vfd = !h5_driver_uses_multiple_files(driver_name, 0); /* Reset library */ h5_reset(); @@ -2132,7 +2130,7 @@ main(void) if (h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR; - if (H5FD__supports_swmr_test(env_h5_drvr)) { + if (H5FD__supports_swmr_test(driver_name)) { /* A test to exercise the re-read of the object header for SWMR access */ if (test_ohdr_swmr(true) < 0) TEST_ERROR; diff --git a/test/onion.c b/test/onion.c index 5b9bb929dc6..1632c410b83 100644 --- a/test/onion.c +++ b/test/onion.c @@ -4908,8 +4908,8 @@ test_integration_create_by_name(void) int main(void) { - const char *env_h5_drvr = NULL; /* VFD value from environment */ - int nerrors = 0; + const char *driver_name; /* VFD value from environment */ + int nerrors = 0; printf("Testing Onion VFD functionality.\n"); @@ -4918,10 +4918,8 @@ main(void) /* The onion VFD only supports the sec2 VFD under the hood, so skip this * test when the environment variable has been set to something else */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; - if ((0 != strcmp(env_h5_drvr, "nomatch")) && (0 != strcmp(env_h5_drvr, "sec2"))) { + driver_name = h5_get_test_driver_name(); + if (0 != strcmp(driver_name, "sec2")) { SKIPPED(); puts("Onion VFD test skipped due to non-sec2 default VFD"); exit(EXIT_SUCCESS); diff --git a/test/page_buffer.c b/test/page_buffer.c index 651e84a348c..8c977fedf44 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -39,17 +39,17 @@ /* test routines */ #ifdef H5_HAVE_PARALLEL -static unsigned verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr); +static unsigned verify_page_buffering_disabled(hid_t orig_fapl, const char *driver_name); #else #define NUM_DSETS 5 #define NX 100 #define NY 50 -static unsigned test_args(hid_t fapl, const char *env_h5_drvr); -static unsigned test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr); -static unsigned test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr); -static unsigned test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr); -static unsigned test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr); +static unsigned test_args(hid_t fapl, const char *driver_name); +static unsigned test_raw_data_handling(hid_t orig_fapl, const char *driver_name); +static unsigned test_lru_processing(hid_t orig_fapl, const char *driver_name); +static unsigned test_min_threshold(hid_t orig_fapl, const char *driver_name); +static unsigned test_stats_collection(hid_t orig_fapl, const char *driver_name); /* helper routines */ static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl); @@ -299,7 +299,7 @@ open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size * */ static unsigned -set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) +set_multi_split(const char *driver_name, hid_t fapl, hsize_t pagesize) { bool split = false; bool multi = false; @@ -311,9 +311,9 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) H5FD_mem_t mt; /* Check for split or multi driver */ - if (!strcmp(env_h5_drvr, "split")) + if (!strcmp(driver_name, "split")) split = true; - else if (!strcmp(env_h5_drvr, "multi")) + else if (!strcmp(driver_name, "multi")) multi = true; if (split || multi) { @@ -374,7 +374,7 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) *------------------------------------------------------------------------- */ static unsigned -test_args(hid_t orig_fapl, const char *env_h5_drvr) +test_args(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -440,7 +440,7 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) if (ret >= 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, 512) != 0) + if (set_multi_split(driver_name, fapl, 512) != 0) TEST_ERROR; /* Test setting a page buffer with a size equal to a single page size */ @@ -477,7 +477,7 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) if (open_file(filename, fapl, 512, 512) != 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, 4194304) != 0) + if (set_multi_split(driver_name, fapl, 4194304) != 0) TEST_ERROR; /* Test setting a large page buffer size and page size */ @@ -496,7 +496,7 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) if (open_file(filename, fapl, 4194304, 16777216) != 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, 1) != 0) + if (set_multi_split(driver_name, fapl, 1) != 0) TEST_ERROR; /* Test setting a 512 byte page buffer size and page size */ @@ -545,7 +545,7 @@ test_args(hid_t orig_fapl, const char *env_h5_drvr) *------------------------------------------------------------------------- */ static unsigned -test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) +test_raw_data_handling(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -565,7 +565,7 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) if ((fapl = H5Pcopy(orig_fapl)) < 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0) + if (set_multi_split(driver_name, fapl, sizeof(int) * 200) != 0) TEST_ERROR; if ((data = (int *)calloc((size_t)num_elements, sizeof(int))) == NULL) @@ -808,7 +808,7 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr) */ static unsigned -test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) +test_lru_processing(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -830,7 +830,7 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) if ((fapl = H5Pcopy(orig_fapl)) < 0) FAIL_STACK_ERROR; - if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0) + if (set_multi_split(driver_name, fapl, sizeof(int) * 200) != 0) TEST_ERROR; if ((data = (int *)calloc((size_t)num_elements, sizeof(int))) == NULL) @@ -1047,7 +1047,7 @@ test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr) */ static unsigned -test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) +test_min_threshold(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -1071,7 +1071,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) if ((fapl = H5Pcopy(orig_fapl)) < 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0) + if (set_multi_split(driver_name, fapl, sizeof(int) * 200) != 0) TEST_ERROR; if ((data = (int *)calloc((size_t)num_elements, sizeof(int))) == NULL) @@ -1665,7 +1665,7 @@ test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr) *------------------------------------------------------------------------- */ static unsigned -test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) +test_stats_collection(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -1687,7 +1687,7 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) if ((fapl = H5Pcopy(orig_fapl)) < 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, sizeof(int) * 200) != 0) + if (set_multi_split(driver_name, fapl, sizeof(int) * 200) != 0) TEST_ERROR; if ((data = (int *)calloc((size_t)num_elements, sizeof(int))) == NULL) @@ -1954,7 +1954,7 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr) #ifdef H5_HAVE_PARALLEL static unsigned -verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr) +verify_page_buffering_disabled(hid_t orig_fapl, const char *driver_name) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file_id = H5I_INVALID_HID; /* File ID */ @@ -1969,7 +1969,7 @@ verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr) if ((fapl = H5Pcopy(orig_fapl)) < 0) TEST_ERROR; - if (set_multi_split(env_h5_drvr, fapl, 4096) != 0) + if (set_multi_split(driver_name, fapl, 4096) != 0) TEST_ERROR; if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) @@ -2066,21 +2066,19 @@ main(void) { hid_t fapl = H5I_INVALID_HID; /* File access property list for data files */ unsigned nerrors = 0; /* Cumulative error count */ - const char *env_h5_drvr = NULL; /* File Driver value from environment */ + const char *driver_name = NULL; /* File Driver value from environment */ bool api_ctx_pushed = false; /* Whether API context pushed */ h5_reset(); /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Temporary skip testing with multi/split drivers: * Page buffering depends on paged aggregation which is * currently disabled for multi/split drivers. */ - if ((0 == strcmp(env_h5_drvr, "multi")) || (0 == strcmp(env_h5_drvr, "split"))) { + if ((0 == strcmp(driver_name, "multi")) || (0 == strcmp(driver_name, "split"))) { SKIPPED(); puts("Skip page buffering test because paged aggregation is disabled for multi/split drivers"); @@ -2100,15 +2098,15 @@ main(void) #ifdef H5_HAVE_PARALLEL puts("Page Buffering is disabled for parallel."); - nerrors += verify_page_buffering_disabled(fapl, env_h5_drvr); + nerrors += verify_page_buffering_disabled(fapl, driver_name); #else /* H5_HAVE_PARALLEL */ - nerrors += test_args(fapl, env_h5_drvr); - nerrors += test_raw_data_handling(fapl, env_h5_drvr); - nerrors += test_lru_processing(fapl, env_h5_drvr); - nerrors += test_min_threshold(fapl, env_h5_drvr); - nerrors += test_stats_collection(fapl, env_h5_drvr); + nerrors += test_args(fapl, driver_name); + nerrors += test_raw_data_handling(fapl, driver_name); + nerrors += test_lru_processing(fapl, driver_name); + nerrors += test_min_threshold(fapl, driver_name); + nerrors += test_stats_collection(fapl, driver_name); #endif /* H5_HAVE_PARALLEL */ diff --git a/test/reserved.c b/test/reserved.c index 5540d044b62..3762bd9deb4 100644 --- a/test/reserved.c +++ b/test/reserved.c @@ -462,16 +462,15 @@ main(void) * (Also, we should try to make this test work with all the VFDs) */ #ifdef BROKEN + const char *driver_name; int num_errs = 0; hid_t fapl; - const char *envval = NULL; - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); + /* QAK: should be able to use the core driver? */ - if (strcmp(envval, "core") && strcmp(envval, "split") && strcmp(envval, "multi") && - strcmp(envval, "family")) { + if (strcmp(driver_name, "core") && strcmp(driver_name, "split") && strcmp(driver_name, "multi") && + strcmp(driver_name, "family")) { num_errs += rsrv_ohdr(); num_errs += rsrv_heap(); num_errs += rsrv_vlen(); diff --git a/test/select_io_dset.c b/test/select_io_dset.c index 1ff7fe22f9e..2f440d8eec0 100644 --- a/test/select_io_dset.c +++ b/test/select_io_dset.c @@ -2934,12 +2934,11 @@ test_no_selection_io_cause_mode(const char *filename, hid_t fapl, uint32_t test_ /* Check for (currently) incompatible combinations */ if (test_mode & TEST_PAGE_BUFFER) { - char *env_h5_drvr = NULL; + const char *driver_name = h5_get_test_driver_name(); /* The split and multi driver are not compatible with page buffering. No message since the other * cases aren't skipped. */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr && (!strcmp(env_h5_drvr, "split") || !strcmp(env_h5_drvr, "multi"))) + if (driver_name && (!strcmp(driver_name, "split") || !strcmp(driver_name, "multi"))) return 0; } @@ -3389,9 +3388,19 @@ main(void) h5_cleanup(FILENAME, fapl); + H5Pclose(fapl2); + exit(EXIT_SUCCESS); error: + H5E_BEGIN_TRY + { + H5Pclose(fapl); + H5Pclose(fapl2); + H5Fclose(fid); + } + H5E_END_TRY + nerrors = MAX(1, nerrors); printf("***** %d SELECTION I/O DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); exit(EXIT_FAILURE); diff --git a/test/set_extent.c b/test/set_extent.c index 6e2b7c5d1bd..018421df45f 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -110,14 +110,13 @@ main(void) unsigned new_format; /* Whether to use the latest file format */ unsigned chunk_cache; /* Whether to enable chunk caching */ int nerrors = 0; - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); + /* Current VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Initialize random number seed */ HDsrandom((unsigned)HDtime(NULL)); diff --git a/test/stab.c b/test/stab.c index 1b7da018822..357f7682712 100644 --- a/test/stab.c +++ b/test/stab.c @@ -1375,18 +1375,16 @@ main(void) hid_t fapl, fapl2; /* File access property list IDs */ hid_t fcpl, fcpl2; /* File creation property list ID */ unsigned new_format; /* Whether to use the new format or not */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool contig_addr_vfd; /* Whether VFD used has a contiguous address space */ bool driver_is_default_compatible; int nerrors = 0; /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* VFD that does not support contiguous address space */ - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); /* Reset library */ h5_reset(); @@ -1433,8 +1431,8 @@ main(void) nerrors += test_large(my_fcpl, my_fapl, new_format); } /* end for */ - /* New format group specific tests (require new format features) */ if (contig_addr_vfd) { + /* New format group specific tests (require new format features) */ nerrors += lifecycle(fcpl2, fapl2); nerrors += long_compact(fcpl2, fapl2); @@ -1444,10 +1442,10 @@ main(void) nerrors += no_compact(fcpl2, fapl2); nerrors += gcpl_on_root(fapl2); - } - /* Old group API specific tests */ - nerrors += old_api(fapl); + /* Old group API specific tests */ + nerrors += old_api(fapl); + } if (driver_is_default_compatible) { nerrors += corrupt_stab_msg(); diff --git a/test/swmr.c b/test/swmr.c index aacf498b22e..94c98737c59 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -7729,12 +7729,12 @@ test_multiple_same(hid_t in_fapl, bool new_format) int main(void) { - int nerrors = 0; /* The # of errors */ - hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ - char *driver = NULL; /* VFD string (from env variable) */ - char *lock_env_var = NULL; /* file locking env var pointer */ - bool use_file_locking; /* read from env var */ - bool file_locking_enabled = false; /* Checks if the file system supports locks */ + const char *driver_name = NULL; /* VFD string (from env variable) */ + int nerrors = 0; /* The # of errors */ + hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ + char *lock_env_var = NULL; /* file locking env var pointer */ + bool use_file_locking; /* read from env var */ + bool file_locking_enabled = false; /* Checks if the file system supports locks */ /* Testing setup */ h5_reset(); @@ -7742,8 +7742,8 @@ main(void) /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ - driver = getenv(HDF5_DRIVER); - if (!H5FD__supports_swmr_test(driver)) { + driver_name = h5_get_test_driver_name(); + if (!H5FD__supports_swmr_test(driver_name)) { printf("This VFD does not support SWMR I/O\n"); return EXIT_SUCCESS; } @@ -7828,7 +7828,7 @@ main(void) /* Tests SWMR VFD compatibility flag. * Only needs to run when the VFD is the default (sec2). */ - if (NULL == driver || !strcmp(driver, "") || !strcmp(driver, "sec2")) + if (NULL == driver_name || !strcmp(driver_name, "") || !strcmp(driver_name, H5_DEFAULT_VFD_NAME)) nerrors += test_swmr_vfd_flag(); /* Test multiple opens via different locking flags */ diff --git a/test/tarray.c b/test/tarray.c index 09f300dc311..0f9e3e44faa 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1935,6 +1935,14 @@ test_compat(void) * the tarrold.h5 file. */ + /* Check if VFD used is native file format compatible */ + CHECK(h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &driver_is_default_compatible), FAIL, + "h5_driver_is_default_vfd_compatible"); + if (!driver_is_default_compatible) { + MESSAGE(5, (" -- SKIPPED --\n")); + return; + } + /* Open the testfile */ fid1 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK_I(fid1, "H5Fopen"); @@ -1946,14 +1954,6 @@ test_compat(void) MESSAGE(5, (" -- SKIPPED --\n")); return; } - /* Check if VFD used is native file format compatible */ - CHECK(h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &driver_is_default_compatible), FAIL, - "h5_driver_is_default_vfd_compatible"); - if (!driver_is_default_compatible) { - CHECK(H5Fclose(fid1), FAIL, "H5Fclose"); - MESSAGE(5, (" -- SKIPPED --\n")); - return; - } /* Only try to proceed if the file is around */ if (fid1 >= 0) { diff --git a/test/test_flush_refresh.sh.in b/test/test_flush_refresh.sh.in index ff24913d0ac..14cdfbba6eb 100644 --- a/test/test_flush_refresh.sh.in +++ b/test/test_flush_refresh.sh.in @@ -58,14 +58,14 @@ srcdir=@srcdir@ utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $utils_testdir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR." + echo "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + echo "environment variable does not support SWMR." echo echo "flush/refresh tests skipped" echo diff --git a/test/test_swmr.pwsh.in b/test/test_swmr.pwsh.in index 8f09740c2c5..becebb3d454 100644 --- a/test/test_swmr.pwsh.in +++ b/test/test_swmr.pwsh.in @@ -87,14 +87,14 @@ function Wait-Message { ## ############################################################################### -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $testprog = Join-Path -Path $utils_testdir -ChildPath swmr_check_compat_vfd.exe $rp = Start-Process -FilePath $testprog -PassThru -Wait -NoNewWindow if ($rp.ExitCode -ne 0) { Write-Output "" - Write-Output "The VFD specified by the HDF5_DRIVER environment variable" - Write-Output "does not support SWMR." + Write-Output "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + Write-Output "environment variable does not support SWMR." Write-Output "" Write-Output "SWMR acceptance tests skipped" Write-Output "" diff --git a/test/test_swmr.sh.in b/test/test_swmr.sh.in index e4c75466b40..38a32041538 100644 --- a/test/test_swmr.sh.in +++ b/test/test_swmr.sh.in @@ -85,14 +85,14 @@ WAIT_MESSAGE() { ## ############################################################################### -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $utils_testdir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR." + echo "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + echo "environment variable does not support SWMR." echo echo "SWMR acceptance tests skipped" echo diff --git a/test/test_use_cases.sh.in b/test/test_use_cases.sh.in index f1d7ec587f4..2b327f8b5fe 100644 --- a/test/test_use_cases.sh.in +++ b/test/test_use_cases.sh.in @@ -34,14 +34,14 @@ srcdir=@srcdir@ utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $utils_testdir/swmr_check_compat_vfd rc=$? if [[ $rc != 0 ]] ; then echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR" + echo "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + echo "environment variable does not support SWMR." echo echo "SWMR use case tests skipped" echo diff --git a/test/test_vds_swmr.pwsh.in b/test/test_vds_swmr.pwsh.in index bf5aabbd14a..97761935599 100644 --- a/test/test_vds_swmr.pwsh.in +++ b/test/test_vds_swmr.pwsh.in @@ -80,14 +80,14 @@ function Wait-Message { ## Main ############################################################################### -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $testprog = Join-Path -Path $utils_testdir -ChildPath swmr_check_compat_vfd.exe $rp = Start-Process -FilePath $testprog -PassThru -Wait -NoNewWindow if ($rp.ExitCode -ne 0) { Write-Output "" - Write-Output "The VFD specified by the HDF5_DRIVER environment variable" - Write-Output "does not support SWMR." + Write-Output "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + Write-Output "environment variable does not support SWMR." Write-Output "" Write-Output "SWMR acceptance tests skipped" Write-Output "" diff --git a/test/test_vds_swmr.sh.in b/test/test_vds_swmr.sh.in index 8eae3edceb8..f5a9043bf06 100644 --- a/test/test_vds_swmr.sh.in +++ b/test/test_vds_swmr.sh.in @@ -77,14 +77,14 @@ WAIT_MESSAGE() { ## Main ############################################################################### -# Check to see if the VFD specified by the HDF5_DRIVER environment variable -# supports SWMR. +# Check to see if the VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER +# environment variable supports SWMR. $utils_testdir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR." + echo "The VFD specified by the HDF5_DRIVER or HDF5_TEST_DRIVER" + echo "environment variable does not support SWMR." echo echo "SWMR acceptance tests skipped" echo diff --git a/test/tfile.c b/test/tfile.c index bc50b94647b..de476eadf51 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -185,8 +185,8 @@ static const char *FILESPACE_NAME[] = {"tfilespace", NULL}; #define DSET_DS1 "DS1" /* Local test function declarations for version bounds */ -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_low_high(const char *driver_name); +static void test_libver_bounds_super(hid_t fapl, const char *driver_name); 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); @@ -533,7 +533,7 @@ test_file_create(void) ** ****************************************************************/ static void -test_file_open(const char *env_h5_drvr) +test_file_open(const char *driver_name) { hid_t fid1, fid2; /*HDF5 File IDs */ hid_t did; /*dataset ID */ @@ -553,7 +553,7 @@ test_file_open(const char *env_h5_drvr) */ /* Only run this test with sec2/default driver */ - if (!h5_using_default_driver(env_h5_drvr)) + if (!h5_using_default_driver(driver_name)) return; /* Output message about test being performed */ @@ -1747,7 +1747,7 @@ test_file_perm2(void) #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) +test_file_is_accessible(const char *driver_name) { hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */ hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */ @@ -1832,7 +1832,7 @@ test_file_is_accessible(const char *env_h5_drvr) /* This test is not currently working for the family VFD. * There are failures when creating files with userblocks. */ - if (0 != strcmp(env_h5_drvr, "family")) { + if (0 != strcmp(driver_name, "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"); @@ -1918,7 +1918,7 @@ test_file_is_accessible(const char *env_h5_drvr) *****************************************************************/ #ifndef H5_NO_DEPRECATED_SYMBOLS static void -test_file_ishdf5(const char *env_h5_drvr) +test_file_ishdf5(const char *driver_name) { hid_t fid = H5I_INVALID_HID; /* File opened with read-write permission */ hid_t fcpl_id = H5I_INVALID_HID; /* File creation property list */ @@ -1934,7 +1934,7 @@ test_file_ishdf5(const char *env_h5_drvr) bool vol_is_native; herr_t ret; /* Return value from HDF5 calls */ - if (!h5_using_default_driver(env_h5_drvr)) + if (!h5_using_default_driver(driver_name)) return; /* Output message about test being performed */ @@ -3055,7 +3055,7 @@ test_file_double_datatype_open(void) ** *****************************************************************/ static void -test_userblock_file_size(const char *env_h5_drvr) +test_userblock_file_size(const char *driver_name) { hid_t file1_id, file2_id; hid_t group1_id, group2_id; @@ -3069,8 +3069,8 @@ test_userblock_file_size(const char *env_h5_drvr) herr_t ret; /* Generic return value */ /* Don't run with multi/split, family or direct drivers */ - if (!strcmp(env_h5_drvr, "multi") || !strcmp(env_h5_drvr, "split") || !strcmp(env_h5_drvr, "family") || - !strcmp(env_h5_drvr, "direct")) + if (!strcmp(driver_name, "multi") || !strcmp(driver_name, "split") || !strcmp(driver_name, "family") || + !strcmp(driver_name, "direct")) return; /* Output message about test being performed */ @@ -3495,7 +3495,7 @@ test_userblock_alignment_helper2(hid_t fapl, bool open_rw) ** *****************************************************************/ static void -test_userblock_alignment(const char *env_h5_drvr) +test_userblock_alignment(const char *driver_name) { hid_t fid; /* File ID */ hid_t fcpl; /* File creation property list ID */ @@ -3503,7 +3503,7 @@ test_userblock_alignment(const char *env_h5_drvr) herr_t ret; /* Generic return value */ /* Only run with sec2 driver */ - if (!h5_using_default_driver(env_h5_drvr)) + if (!h5_using_default_driver(driver_name)) return; /* Output message about test being performed */ @@ -3715,7 +3715,7 @@ test_userblock_alignment(const char *env_h5_drvr) ** *****************************************************************/ static void -test_userblock_alignment_paged(const char *env_h5_drvr) +test_userblock_alignment_paged(const char *driver_name) { hid_t fid; /* File ID */ hid_t fcpl; /* File creation property list ID */ @@ -3723,7 +3723,7 @@ test_userblock_alignment_paged(const char *env_h5_drvr) herr_t ret; /* Generic return value */ /* Only run with sec2 driver */ - if (!h5_using_default_driver(env_h5_drvr)) + if (!h5_using_default_driver(driver_name)) return; /* Output message about test being performed */ @@ -4139,7 +4139,7 @@ test_userblock_alignment_paged(const char *env_h5_drvr) ** ****************************************************************/ static void -test_filespace_info(const char *env_h5_drvr) +test_filespace_info(const char *driver_name) { hid_t fid; /* File IDs */ hid_t fapl, new_fapl; /* File access property lists */ @@ -4161,7 +4161,7 @@ test_filespace_info(const char *env_h5_drvr) MESSAGE(5, ("Testing file creation public routines: H5Pget/set_file_space_strategy & " "H5Pget/set_file_space_page_size\n")); - contig_addr_vfd = (bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0); + contig_addr_vfd = (bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0); fapl = h5_fileaccess(); h5_fixname(FILESPACE_NAME[0], fapl, filename, sizeof filename); @@ -4556,7 +4556,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, bool split) ** *****************************************************************/ static void -test_file_freespace(const char *env_h5_drvr) +test_file_freespace(const char *driver_name) { hid_t file; /* File opened with read-write permission */ h5_stat_size_t empty_filesize; /* Size of file when empty */ @@ -4578,8 +4578,8 @@ test_file_freespace(const char *env_h5_drvr) bool vol_is_native; herr_t ret; /* Return value */ - split_vfd = !strcmp(env_h5_drvr, "split"); - multi_vfd = !strcmp(env_h5_drvr, "multi"); + split_vfd = !strcmp(driver_name, "split"); + multi_vfd = !strcmp(driver_name, "multi"); if (split_vfd || multi_vfd) return; @@ -4731,7 +4731,7 @@ test_file_freespace(const char *env_h5_drvr) ** *****************************************************************/ static void -test_sects_freespace(const char *env_h5_drvr, bool new_format) +test_sects_freespace(const char *driver_name, bool new_format) { char filename[FILENAME_LEN]; /* Filename to use */ hid_t file; /* File ID */ @@ -4762,8 +4762,8 @@ test_sects_freespace(const char *env_h5_drvr, bool new_format) /* Output message about test being performed */ MESSAGE(5, ("Testing H5Fget_free_sections()--free-space section info in the file\n")); - split_vfd = !strcmp(env_h5_drvr, "split"); - multi_vfd = !strcmp(env_h5_drvr, "multi"); + split_vfd = !strcmp(driver_name, "split"); + multi_vfd = !strcmp(driver_name, "multi"); if (split_vfd || multi_vfd) { MESSAGE(5, (" -- SKIPPED --\n")); @@ -5900,7 +5900,7 @@ test_libver_bounds(void) ** **************************************************************************************/ static void -test_libver_bounds_low_high(const char *env_h5_drvr) +test_libver_bounds_low_high(const char *driver_name) { hid_t fapl = H5I_INVALID_HID; /* File access property list */ H5F_libver_t low, high; /* Low and high bounds */ @@ -5948,7 +5948,7 @@ test_libver_bounds_low_high(const char *env_h5_drvr) VERIFY(ret, SUCCEED, "H5Pset_libver_bounds"); /* Tests to verify version bounds */ - test_libver_bounds_super(fapl, env_h5_drvr); + test_libver_bounds_super(fapl, driver_name); test_libver_bounds_obj(fapl); test_libver_bounds_dataset(fapl); test_libver_bounds_dataspace(fapl); @@ -5981,7 +5981,7 @@ test_libver_bounds_low_high(const char *env_h5_drvr) ** *************************************************************************/ static void -test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) +test_libver_bounds_super(hid_t fapl, const char *driver_name) { hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ herr_t ret; /* The return value */ @@ -5993,13 +5993,13 @@ test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) /* Verify superblock version when creating a file with input fapl, fcpl #A and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) 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 */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_open(fapl, fcpl, true, false); test_libver_bounds_super_open(fapl, fcpl, false, false); @@ -6016,13 +6016,13 @@ test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) /* Verify superblock version when creating a file with input fapl, fcpl #B and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) 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 */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_open(fapl, fcpl, true, false); test_libver_bounds_super_open(fapl, fcpl, false, false); @@ -6041,13 +6041,13 @@ test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) /* Verify superblock version when creating a file with input fapl, fcpl #C and with/without SWMR access */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) 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 */ - if (H5FD__supports_swmr_test(env_h5_drvr)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_open(fapl, fcpl, true, false); test_libver_bounds_super_open(fapl, fcpl, false, false); @@ -6055,7 +6055,7 @@ test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) ret = H5Pclose(fcpl); CHECK(ret, FAIL, "H5Pclose"); - if (h5_using_default_driver(env_h5_drvr)) { + if (h5_using_default_driver(driver_name)) { /* Create a fcpl with persistent free-space manager enabled: #D */ /* This will result in superblock version 2 */ fcpl = H5Pcreate(H5P_FILE_CREATE); @@ -6065,13 +6065,13 @@ test_libver_bounds_super(hid_t fapl, const char *env_h5_drvr) /* 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)) + if (H5FD__supports_swmr_test(driver_name)) 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)) + if (H5FD__supports_swmr_test(driver_name)) test_libver_bounds_super_open(fapl, fcpl, true, true); test_libver_bounds_super_open(fapl, fcpl, false, true); @@ -8104,7 +8104,7 @@ test_min_dset_ohdr(void) ****************************************************************/ #ifndef H5_NO_DEPRECATED_SYMBOLS static void -test_deprec(const char *env_h5_drvr) +test_deprec(const char *driver_name) { hid_t file; /* File IDs for old & new files */ hid_t fcpl; /* File creation property list */ @@ -8167,7 +8167,7 @@ test_deprec(const char *env_h5_drvr) CHECK(ret, FAIL, "H5Fclose"); /* Only run this part of the test with the sec2/default driver */ - if (h5_using_default_driver(env_h5_drvr)) { + if (h5_using_default_driver(driver_name)) { /* Create a file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); CHECK(fcpl, FAIL, "H5Pcreate"); @@ -8342,7 +8342,7 @@ test_deprec(const char *env_h5_drvr) void test_file(void) { - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ hid_t fapl_id = H5I_INVALID_HID; /* VFD-dependent fapl ID */ bool driver_is_default_compatible; herr_t ret; @@ -8351,9 +8351,7 @@ test_file(void) MESSAGE(5, ("Testing Low-Level File I/O\n")); /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Improved version of VFD-dependent checks */ fapl_id = h5_fileaccess(); @@ -8363,14 +8361,14 @@ test_file(void) CHECK(ret, FAIL, "h5_driver_is_default_vfd_compatible"); test_file_create(); /* Test file creation(also creation templates)*/ - test_file_open(env_h5_drvr); /* Test file opening */ + test_file_open(driver_name); /* Test file opening */ test_file_reopen(); /* Test file reopening */ test_file_close(); /* Test file close behavior */ test_get_file_id(); /* Test H5Iget_file_id */ test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ test_file_perm(); /* Test file access permissions */ test_file_perm2(); /* Test file access permission again */ - test_file_is_accessible(env_h5_drvr); /* Test detecting HDF5 files correctly */ + test_file_is_accessible(driver_name); /* Test detecting HDF5 files correctly */ test_file_delete(fapl_id); /* Test H5Fdelete */ test_file_open_dot(); /* Test opening objects with "." for a name */ test_file_open_overlap(); /* Test opening files in an overlapping manner */ @@ -8382,7 +8380,7 @@ test_file(void) test_file_double_file_dataset_open(true); test_file_double_file_dataset_open(false); test_userblock_file_size( - env_h5_drvr); /* Tests that files created with a userblock have the correct size */ + driver_name); /* 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_is_default_compatible) { @@ -8390,20 +8388,20 @@ test_file(void) } 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 + driver_name); /* Tests that files created with a userblock and alignment interact properly */ + test_userblock_alignment_paged(driver_name); /* 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_filespace_info(driver_name); /* 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() */ + test_file_freespace(driver_name); /* Test file public routine H5Fget_freespace() */ /* Skipped testing for multi/split drivers */ /* Setup for multi/split drivers are there already */ - test_sects_freespace(env_h5_drvr, + test_sects_freespace(driver_name, true); /* Test file public routine H5Fget_free_sections() for new format */ /* Skipped testing for multi/split drivers */ /* Setup for multi/split drivers are there already */ - test_sects_freespace(env_h5_drvr, false); /* Test file public routine H5Fget_free_sections() */ + test_sects_freespace(driver_name, false); /* Test file public routine H5Fget_free_sections() */ /* Skipped testing for multi/split drivers */ if (driver_is_default_compatible) { @@ -8416,14 +8414,14 @@ test_file(void) } test_libver_bounds(); /* Test compatibility for file space management */ - test_libver_bounds_low_high(env_h5_drvr); + test_libver_bounds_low_high(driver_name); 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 dataset object header minimization */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_file_ishdf5(env_h5_drvr); /* Test detecting HDF5 files correctly */ - test_deprec(env_h5_drvr); /* Test deprecated routines */ + test_file_ishdf5(driver_name); /* Test detecting HDF5 files correctly */ + test_deprec(driver_name); /* Test deprecated routines */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ ret = H5Pclose(fapl_id); diff --git a/test/tmisc.c b/test/tmisc.c index 67e92c0898b..e08d76cb7ac 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -1828,6 +1828,14 @@ test_misc10(void) /* Output message about test being performed */ MESSAGE(5, ("Testing using old dataset creation property list\n")); + /* Check if VFD used is native file format compatible */ + CHECK(h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &driver_is_default_compatible), FAIL, + "h5_driver_is_default_vfd_compatible"); + if (!driver_is_default_compatible) { + MESSAGE(5, (" -- SKIPPED --\n")); + return; + } + /* * Open the old file and the dataset and get old settings. */ @@ -1841,14 +1849,6 @@ test_misc10(void) MESSAGE(5, (" -- SKIPPED --\n")); return; } - /* Check if VFD used is native file format compatible */ - CHECK(h5_driver_is_default_vfd_compatible(H5P_DEFAULT, &driver_is_default_compatible), FAIL, - "h5_driver_is_default_vfd_compatible"); - if (!driver_is_default_compatible) { - CHECK(H5Fclose(file), FAIL, "H5Fclose"); - MESSAGE(5, (" -- SKIPPED --\n")); - return; - } fcpl = H5Fget_create_plist(file); CHECK(fcpl, FAIL, "H5Fget_create_plist"); @@ -6893,7 +6893,11 @@ test_misc(void) } 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 (default_driver) { + 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 */ diff --git a/test/trefer.c b/test/trefer.c index b8f91a03363..fc0d8942045 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -3592,15 +3592,13 @@ void test_reference(void) { H5F_libver_t low, high; /* Low and high bounds */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ /* Output message about test being performed */ MESSAGE(5, ("Testing References\n")); /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); test_reference_params(); /* Test for correct parameter checking */ test_reference_obj(); /* Test basic H5R object reference code */ @@ -3622,7 +3620,7 @@ test_reference(void) } /* end low bound */ /* The following test is currently broken with the Direct VFD */ - if (strcmp(env_h5_drvr, "direct") != 0) { + if (strcmp(driver_name, "direct") != 0) { test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */ } diff --git a/test/tselect.c b/test/tselect.c index 20b85916739..e07b1b62dfb 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -16078,16 +16078,14 @@ test_select(void) 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 */ + const char *driver_name; /* 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 = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Create a dataset transfer property list */ plist_id = H5Pcreate(H5P_DATASET_XFER); @@ -16152,7 +16150,7 @@ test_select(void) test_select_hyper_valid_combination(); /* Test different input combinations */ /* The following tests are currently broken with the Direct VFD */ - if (strcmp(env_h5_drvr, "direct") != 0) { + if (strcmp(driver_name, "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 */ diff --git a/test/tsohm.c b/test/tsohm.c index 542fd688b81..e6b9e0b5e2a 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -3208,7 +3208,7 @@ test_sohm_extlink(void) CHECK_I(ret, "h5_driver_is_default_vfd_compatible"); if (!driver_is_default_compatible) { - printf("-- SKIPPED --\n"); + MESSAGE(5, ("-- SKIPPED --\n")); return; } @@ -3710,7 +3710,7 @@ test_sohm_external_dtype(void) void test_sohm(void) { - const char *env_h5_drvr; + const char *driver_name; bool vol_is_native; bool default_driver; @@ -3724,11 +3724,8 @@ test_sohm(void) } /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; - - default_driver = h5_using_default_driver(env_h5_drvr); + driver_name = h5_get_test_driver_name(); + default_driver = h5_using_default_driver(driver_name); test_sohm_fcpl(); /* Test SOHMs and file creation plists */ test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */ diff --git a/test/vds.c b/test/vds.c index c2546e57f00..c08eec09288 100644 --- a/test/vds.c +++ b/test/vds.c @@ -12316,13 +12316,11 @@ main(void) int test_api_config; unsigned bit_config; H5F_libver_t low, high; /* Low and high bounds */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool driver_is_parallel; int nerrors = 0; - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Testing setup */ h5_reset(); @@ -12336,7 +12334,7 @@ main(void) * doesn't support parallel reads and the splitter VFD has external * link-related bugs. */ - if (driver_is_parallel || !strcmp(env_h5_drvr, "splitter")) { + if (driver_is_parallel || !strcmp(driver_name, "splitter")) { puts(" -- SKIPPED for incompatible VFD --"); exit(EXIT_SUCCESS); } diff --git a/test/vds_env.c b/test/vds_env.c index e9649566fd9..4432e0aad53 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -327,13 +327,11 @@ main(void) hid_t fapl, my_fapl; unsigned bit_config; H5F_libver_t low, high; /* Low and high bounds */ - const char *env_h5_drvr; /* File Driver value from environment */ + const char *driver_name; /* File Driver value from environment */ bool driver_is_parallel; int nerrors = 0; - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); /* Testing setup */ h5_reset(); @@ -347,7 +345,7 @@ main(void) * doesn't support parallel reads and the splitter VFD has external * link-related bugs. */ - if (driver_is_parallel || !strcmp(env_h5_drvr, "splitter")) { + if (driver_is_parallel || !strcmp(driver_name, "splitter")) { puts(" -- SKIPPED for incompatible VFD --"); exit(EXIT_SUCCESS); } diff --git a/test/vfd.c b/test/vfd.c index 5a86920652e..7025de907df 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -5873,16 +5873,16 @@ test_selection_io(const char *vfd_name) int main(void) { - char *env_h5_drvr = NULL; - int nerrors = 0; + const char *driver_name; + 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. + /* Don't run VFD tests when HDF5_DRIVER or HDF5_TEST_DRIVER is set. These + * tests expect a specific VFD to be set and HDF5_DRIVER/HDF5_TEST_DRIVER + * being set can interfere with that. */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr) { - printf(" -- SKIPPED VFD tests because %s is set -- \n", HDF5_DRIVER); + driver_name = h5_get_test_driver_name(); + if (driver_name) { + printf(" -- SKIPPED VFD tests because driver environment variable is set -- \n"); exit(EXIT_SUCCESS); } diff --git a/test/vfd_plugin.c b/test/vfd_plugin.c index 8bfc09f07aa..91f8ec50c41 100644 --- a/test/vfd_plugin.c +++ b/test/vfd_plugin.c @@ -19,8 +19,6 @@ #include "null_vfd_plugin.h" -#define DEFAULT_DRIVER_NAME "sec2" - /*------------------------------------------------------------------------- * Function: test_set_by_name() * @@ -301,7 +299,7 @@ test_get_config_str(void) 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) + if (H5Pset_driver_by_name(fapl_id, H5_DEFAULT_VFD_NAME, config_str) < 0) TEST_ERROR; if ((config_str_len = H5Pget_driver_config_str(fapl_id, config_str_buf, 128)) < 0) TEST_ERROR; diff --git a/test/vol.c b/test/vol.c index e29c6bb940f..395b164bfe7 100644 --- a/test/vol.c +++ b/test/vol.c @@ -857,7 +857,7 @@ test_native_vol_init(void) *------------------------------------------------------------------------- */ static herr_t -test_basic_file_operation(const char *env_h5_drvr) +test_basic_file_operation(const char *driver_name) { hid_t fid = H5I_INVALID_HID; hid_t fid_reopen = H5I_INVALID_HID; @@ -933,10 +933,10 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't compare VFD properties for several VFDs */ - if ((bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0 && strcmp(env_h5_drvr, "direct") != 0 && - strcmp(env_h5_drvr, "core") != 0 && strcmp(env_h5_drvr, "core_paged") != 0 && - strcmp(env_h5_drvr, "mpio") != 0 && strcmp(env_h5_drvr, "splitter") != 0)) { + if ((bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0 && strcmp(driver_name, "direct") != 0 && + strcmp(driver_name, "core") != 0 && strcmp(driver_name, "core_paged") != 0 && + strcmp(driver_name, "mpio") != 0 && strcmp(driver_name, "splitter") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -957,8 +957,8 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't retrieve VFD handle for split / multi / family VFDs */ - if ((bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0)) { + if ((bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0)) { /* H5Fget_vfd_handle */ if (H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) TEST_ERROR; @@ -997,10 +997,10 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't compare VFD properties for several VFDs */ - if ((bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0 && strcmp(env_h5_drvr, "direct") != 0 && - strcmp(env_h5_drvr, "core") != 0 && strcmp(env_h5_drvr, "core_paged") != 0 && - strcmp(env_h5_drvr, "mpio") != 0 && strcmp(env_h5_drvr, "splitter") != 0)) { + if ((bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0 && strcmp(driver_name, "direct") != 0 && + strcmp(driver_name, "core") != 0 && strcmp(driver_name, "core_paged") != 0 && + strcmp(driver_name, "mpio") != 0 && strcmp(driver_name, "splitter") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; @@ -1014,10 +1014,10 @@ test_basic_file_operation(const char *env_h5_drvr) TEST_ERROR; /* Can't compare VFD properties for several VFDs */ - if ((bool)(strcmp(env_h5_drvr, "split") != 0 && strcmp(env_h5_drvr, "multi") != 0 && - strcmp(env_h5_drvr, "family") != 0 && strcmp(env_h5_drvr, "direct") != 0 && - strcmp(env_h5_drvr, "core") != 0 && strcmp(env_h5_drvr, "core_paged") != 0 && - strcmp(env_h5_drvr, "mpio") != 0 && strcmp(env_h5_drvr, "splitter") != 0)) { + if ((bool)(strcmp(driver_name, "split") != 0 && strcmp(driver_name, "multi") != 0 && + strcmp(driver_name, "family") != 0 && strcmp(driver_name, "direct") != 0 && + strcmp(driver_name, "core") != 0 && strcmp(driver_name, "core_paged") != 0 && + strcmp(driver_name, "mpio") != 0 && strcmp(driver_name, "splitter") != 0)) { /* H5Fget_access_plist */ if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) TEST_ERROR; @@ -2645,13 +2645,11 @@ test_query_optional(void) int main(void) { - const char *env_h5_drvr; /* File driver value from environment */ + const char *driver_name; /* File driver value from environment */ int nerrors = 0; /* Get the VFD to use */ - env_h5_drvr = getenv(HDF5_DRIVER); - if (env_h5_drvr == NULL) - env_h5_drvr = "nomatch"; + driver_name = h5_get_test_driver_name(); h5_reset(); @@ -2660,7 +2658,7 @@ main(void) nerrors += test_vol_registration() < 0 ? 1 : 0; 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_file_operation(driver_name) < 0 ? 1 : 0; nerrors += test_basic_group_operation() < 0 ? 1 : 0; nerrors += test_basic_dataset_operation() < 0 ? 1 : 0; nerrors += test_basic_attribute_operation() < 0 ? 1 : 0; diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c index a61e6749a53..733898f9839 100644 --- a/testpar/t_pflush1.c +++ b/testpar/t_pflush1.c @@ -107,7 +107,7 @@ main(int argc, char *argv[]) hid_t fapl_id = H5I_INVALID_HID; MPI_File *mpifh_p = NULL; char name[1024]; - const char *envval = NULL; + const char *driver_name; int mpi_size; int mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -121,11 +121,9 @@ main(int argc, char *argv[]) TESTING("H5Fflush (part1)"); /* Don't run using the split VFD */ - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); - if (!strcmp(envval, "split")) { + if (!strcmp(driver_name, "split")) { if (mpi_rank == 0) { SKIPPED(); puts(" Test not compatible with current Virtual File Driver"); diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c index e1dce1bbfd7..2f860d4417d 100644 --- a/testpar/t_pflush2.c +++ b/testpar/t_pflush2.c @@ -132,12 +132,11 @@ main(int argc, char *argv[]) hid_t fapl_id2 = H5I_INVALID_HID; H5E_auto2_t func; char name[1024]; - const char *envval = NULL; - - int mpi_size; - int mpi_rank; - MPI_Comm comm = MPI_COMM_WORLD; - MPI_Info info = MPI_INFO_NULL; + const char *driver_name; + int mpi_size; + int mpi_rank; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; MPI_Init(&argc, &argv); MPI_Comm_size(comm, &mpi_size); @@ -147,11 +146,9 @@ main(int argc, char *argv[]) TESTING("H5Fflush (part2 with flush)"); /* Don't run using the split VFD */ - envval = getenv(HDF5_DRIVER); - if (envval == NULL) - envval = "nomatch"; + driver_name = h5_get_test_driver_name(); - if (!strcmp(envval, "split")) { + if (!strcmp(driver_name, "split")) { if (mpi_rank == 0) { SKIPPED(); puts(" Test not compatible with current Virtual File Driver"); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index ca6bba21854..16253b195d5 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -79,20 +79,12 @@ const char *volnames[] = { * */ const char *drivernames[] = { - [SEC2_VFD_IDX] = "sec2", - [DIRECT_VFD_IDX] = "direct", - [LOG_VFD_IDX] = "log", - [WINDOWS_VFD_IDX] = "windows", - [STDIO_VFD_IDX] = "stdio", - [CORE_VFD_IDX] = "core", - [FAMILY_VFD_IDX] = "family", - [SPLIT_VFD_IDX] = "split", - [MULTI_VFD_IDX] = "multi", - [MPIO_VFD_IDX] = "mpio", - [ROS3_VFD_IDX] = "ros3", - [HDFS_VFD_IDX] = "hdfs", - [SUBFILING_VFD_IDX] = H5FD_SUBFILING_NAME, - [ONION_VFD_IDX] = "onion", + [SEC2_VFD_IDX] = "sec2", [DIRECT_VFD_IDX] = "direct", [LOG_VFD_IDX] = "log", + [WINDOWS_VFD_IDX] = "windows", [STDIO_VFD_IDX] = "stdio", [CORE_VFD_IDX] = "core", + [FAMILY_VFD_IDX] = "family", [SPLIT_VFD_IDX] = "split", [MULTI_VFD_IDX] = "multi", + [MPIO_VFD_IDX] = "mpio", [MIRROR_VFD_IDX] = "mirror", [SPLITTER_VFD_IDX] = "splitter", + [ROS3_VFD_IDX] = "ros3", [HDFS_VFD_IDX] = "hdfs", [SUBFILING_VFD_IDX] = H5FD_SUBFILING_NAME, + [ONION_VFD_IDX] = "onion", }; #define NUM_VOLS (sizeof(volnames) / sizeof(volnames[0])) diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index b636806e2e9..b4ace197d7f 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -602,6 +602,8 @@ typedef enum { SPLIT_VFD_IDX, MULTI_VFD_IDX, MPIO_VFD_IDX, + MIRROR_VFD_IDX, + SPLITTER_VFD_IDX, ROS3_VFD_IDX, HDFS_VFD_IDX, SUBFILING_VFD_IDX, diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 32f109b0caf..369472e8d86 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -983,28 +983,28 @@ test_set_configured_fapl(void) "(common) H5P_DEFAULT with no struct should succeed", 1, UTIL_TEST_DEFAULT, - "sec2", + H5_DEFAULT_VFD_NAME, NULL, }, { "(common) H5P_DEFAULT with (ignored) struct should succeed", 1, UTIL_TEST_DEFAULT, - "sec2", + H5_DEFAULT_VFD_NAME, &wrong_fa, }, { "(common) provided fapl entry should not fail", 1, UTIL_TEST_CREATE, - "sec2", + H5_DEFAULT_VFD_NAME, NULL, }, { "(common) provided fapl entry should not fail; ignores struct", 1, UTIL_TEST_CREATE, - "sec2", + H5_DEFAULT_VFD_NAME, &wrong_fa, }, { diff --git a/utils/test/swmr_check_compat_vfd.c b/utils/test/swmr_check_compat_vfd.c index b5cfb1ba35c..eeaae726f47 100644 --- a/utils/test/swmr_check_compat_vfd.c +++ b/utils/test/swmr_check_compat_vfd.c @@ -10,8 +10,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Purpose: This is a small program that checks if the HDF5_DRIVER - * environment variable is set to a value that supports SWMR. +/* Purpose: This is a small program that checks if the HDF5_DRIVER or + * HDF5_TEST_DRIVER environment variable is set to a value that + * supports SWMR. * * It is intended for use in shell scripts. */ @@ -26,9 +27,9 @@ /*------------------------------------------------------------------------- * Function: main * - * Purpose: Inspects the HDF5_DRIVER environment variable, which - * determines the VFD that the test harness will use with - * the majority of the tests. + * Purpose: Inspects the HDF5_DRIVER and HDF5_TEST_DRIVER environment + * variables, which determines the VFD that the test harness + * will use with the majority of the tests. * * Return: VFD supports SWMR: EXIT_SUCCESS * @@ -43,6 +44,8 @@ main(void) char *driver = NULL; driver = getenv(HDF5_DRIVER); + if (!driver) + driver = getenv("HDF5_TEST_DRIVER"); if (H5FD__supports_swmr_test(driver)) return EXIT_SUCCESS;