Skip to content

Commit

Permalink
Add macro for default VFD name
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendersonHDF committed Mar 22, 2024
1 parent 4b440e4 commit 0b7a716
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
5 changes: 3 additions & 2 deletions src/H5FDtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
* 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
*
Expand All @@ -92,7 +93,7 @@ H5FD__supports_swmr_test(const char *vfd_name)
if (!vfd_name)
vfd_name = getenv("HDF5_TEST_DRIVER");

if (!vfd_name || !strcmp(vfd_name, ""))
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");
Expand Down
3 changes: 2 additions & 1 deletion src/H5private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions test/h5test.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,8 @@ h5_fileaccess_flags(unsigned flags)
* Function: h5_get_vfd_fapl
*
* Purpose: Sets the file driver for a FAPL according to the value
* specified in the constant "HDF5_DRIVER" or environment
* variable "HDF5_DRIVER" or "HDF5_TEST_DRIVER".
* specified in the environment variable "HDF5_DRIVER" or
* "HDF5_TEST_DRIVER".
*
* Return: Non-negative on success/Negative on failure
*
Expand Down Expand Up @@ -2457,7 +2457,7 @@ h5_get_test_driver_name(void)
else if ((envval = getenv("HDF5_TEST_DRIVER")))
return envval;
else
return "sec2";
return H5_DEFAULT_VFD_NAME;
}

/*-------------------------------------------------------------------------
Expand All @@ -2483,7 +2483,7 @@ h5_using_default_driver(const char *drv_name)
drv_name = h5_get_test_driver_name();

if (drv_name)
return !strcmp(drv_name, "sec2");
return !strcmp(drv_name, H5_DEFAULT_VFD_NAME);

return ret_val;
}
Expand Down
2 changes: 1 addition & 1 deletion test/swmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_name || !strcmp(driver_name, "") || !strcmp(driver_name, "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 */
Expand Down
4 changes: 1 addition & 3 deletions test/vfd_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#include "null_vfd_plugin.h"

#define DEFAULT_DRIVER_NAME "sec2"

/*-------------------------------------------------------------------------
* Function: test_set_by_name()
*
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions tools/libtest/h5tools_test_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
{
Expand Down

0 comments on commit 0b7a716

Please sign in to comment.