From 68abd201b2aa56cbc5c7bfee99bcb8d9612eb73a Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 23 May 2023 13:47:24 -0700 Subject: Fix missing/misplaced h5_reset calls (#3001) Fixes failures when running tests after building with thread-safety w/ code stacks on. Fixes #2990 --- src/H5FDtest.c | 6 ------ test/accum_swmr_reader.c | 12 ++++++------ test/swmr.c | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/H5FDtest.c b/src/H5FDtest.c index dc9ad93..87d24b6 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -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 @@ -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 diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 1269c5a..b667b07 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -35,17 +35,14 @@ 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 */ @@ -53,6 +50,9 @@ main(void) 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. */ diff --git a/test/swmr.c b/test/swmr.c index d3a0d13..4abf779 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -7728,12 +7728,15 @@ error: 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. @@ -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 @@ -7761,9 +7764,6 @@ main(void) return EXIT_FAILURE; } - /* Set up */ - h5_reset(); - /* Get file access property list */ fapl = h5_fileaccess(); @@ -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). -- cgit v0.12