From e66bf948a7acba0ddc76239f6d02f17c8b10eb0f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 26 Apr 2019 12:10:54 -0700 Subject: Fix for split VFD and file cleanup when testing H5Fis_hdf5 and H5Fis_accessible in tfile.c. --- test/h5test.c | 30 ++++++++++++++++++++++++++---- test/tfile.c | 6 ++++++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/test/h5test.c b/test/h5test.c index 3b17c72..dba8cf7 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -574,6 +574,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock) { const char *prefix = NULL; + const char *env = NULL; /* HDF5_DRIVER environment variable */ char *ptr, last = '\0'; const char *suffix = _suffix; size_t i, j; @@ -598,10 +599,31 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, suffix = nest_printf ? "%%05d.h5" : "%05d.h5"; } else if (H5FD_MULTI == driver) { - if(subst_for_superblock) - suffix = "-s.h5"; - else - suffix = NULL; + + /* Get the environment variable, if it exists, in case + * we are using the split driver since both of those + * use the multi VFD under the hood. + */ + env = HDgetenv("HDF5_DRIVER"); +#ifdef HDF5_DRIVER + /* Use the environment variable, then the compile-time constant */ + if(!env) + env = HDF5_DRIVER; +#endif + if(!HDstrcmp(env, "split")) { + /* split VFD */ + if(subst_for_superblock) + suffix = "-m.h5"; + else + suffix = NULL; + } + else { + /* multi VFD */ + if(subst_for_superblock) + suffix = "-s.h5"; + else + suffix = NULL; + } } } } diff --git a/test/tfile.c b/test/tfile.c index adeec94..695d437 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1715,6 +1715,9 @@ test_file_is_accessible(const char *env_h5_drvr) VERIFY(is_hdf5, FALSE, "H5Fis_accessible (non-HDF5 file)"); + /* Clean up files */ + h5_delete_test_file(filename, fapl_id); + /* Close property list */ ret = H5Pclose(fapl_id); CHECK(ret, FAIL, "H5Pclose"); @@ -1837,6 +1840,9 @@ test_file_ishdf5(const char *env_h5_drvr) VERIFY(is_hdf5, FALSE, "H5Fis_hdf5"); + /* Clean up files */ + h5_delete_test_file(filename, fapl_id); + /* Close property list */ ret = H5Pclose(fapl_id); CHECK(ret, FAIL, "H5Pclose"); -- cgit v0.12