Skip to content

Commit

Permalink
Fix missing/misplaced h5_reset calls (#3001)
Browse files Browse the repository at this point in the history
Fixes failures when running tests after building with thread-safety
w/ code stacks on.

Fixes #2990
  • Loading branch information
derobins authored May 23, 2023
1 parent ee91960 commit 68abd20
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
6 changes: 0 additions & 6 deletions src/H5FDtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
* VFD feature flags (which do not exist until the driver
* is instantiated).
*
* See test/Makefile.am for a list of the VFD strings.
*
* 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
Expand All @@ -82,10 +80,6 @@
*
* This function cannot fail at this time so there is no
* error return value.
*
* Programmer: Dana Robinson
* Fall 2014
*
*-------------------------------------------------------------------------
*/
hbool_t
Expand Down
12 changes: 6 additions & 6 deletions test/accum_swmr_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ const char *FILENAME[] = {"accum", "accum_swmr_big", NULL};
*
* Return: Success: EXIT_SUCCESS
* Failure: EXIT_FAILURE
*
* Programmer: Vailin Choi; June 2013
*
*-------------------------------------------------------------------------
*/
int
main(void)
{
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* file access property list ID */
H5F_t *f = NULL; /* File pointer */
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) */
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */

/* Testing setup */
h5_reset();

/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
Expand Down
22 changes: 11 additions & 11 deletions test/swmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -7728,12 +7728,15 @@ test_multiple_same(hid_t in_fapl, hbool_t new_format)
int
main(void)
{
int nerrors = 0; /* The # of errors */
hid_t fapl = -1; /* File access property list ID */
char *driver = NULL; /* VFD string (from env variable) */
char *lock_env_var = NULL; /* file locking env var pointer */
hbool_t use_file_locking; /* read from env var */
hbool_t file_locking_enabled = FALSE; /* Checks if the file system supports locks */
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 */
hbool_t use_file_locking; /* read from env var */
hbool_t file_locking_enabled = FALSE; /* Checks if the file system supports locks */

/* Testing setup */
h5_reset();

/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
Expand All @@ -7742,7 +7745,7 @@ main(void)
if (!H5FD__supports_swmr_test(driver)) {
HDprintf("This VFD does not support SWMR I/O\n");
return EXIT_SUCCESS;
} /* end if */
}

/* Check the environment variable that determines if we care
* about file locking. File locking should be used unless explicitly
Expand All @@ -7761,9 +7764,6 @@ main(void)
return EXIT_FAILURE;
}

/* Set up */
h5_reset();

/* Get file access property list */
fapl = h5_fileaccess();

Expand Down Expand Up @@ -7822,7 +7822,7 @@ main(void)
*/
nerrors += test_file_lock_swmr_same(fapl);
nerrors += test_file_lock_swmr_concur(fapl);
} /* end if */
}

/* Tests SWMR VFD compatibility flag.
* Only needs to run when the VFD is the default (sec2).
Expand Down

0 comments on commit 68abd20

Please sign in to comment.