summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvchoi <vchoi@jelly.ad.hdfgroup.org>2022-06-08 06:05:04 (GMT)
committervchoi <vchoi@jelly.ad.hdfgroup.org>2022-06-08 06:05:04 (GMT)
commitcf2b9d600a72cbe3caa87ee11ea2c828f48a561c (patch)
treef1870f6f97baae6bbec2593a986c2e9e699bfca3
parent7bbe45e71d74b342aadd086ac9174414542b2063 (diff)
downloadhdf5-cf2b9d600a72cbe3caa87ee11ea2c828f48a561c.zip
hdf5-cf2b9d600a72cbe3caa87ee11ea2c828f48a561c.tar.gz
hdf5-cf2b9d600a72cbe3caa87ee11ea2c828f48a561c.tar.bz2
(1) Modify test/vfd_swmr_bigset_writer.c to use h5_retry routines instead of "for loop for NUM_ATTEMPTS" times.
(2) Clean up test/vfd_swmr.c
-rw-r--r--test/vfd_swmr.c18
-rw-r--r--test/vfd_swmr_bigset_writer.c16
2 files changed, 13 insertions, 21 deletions
diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c
index 16efaed..c6b777e 100644
--- a/test/vfd_swmr.c
+++ b/test/vfd_swmr.c
@@ -5268,15 +5268,11 @@ error:
*
* Case #4:
* --Open a file as writer with both legacy SWMR and VFD SWMR configured .
- * --NOTE: The open should fail when John's changes are merged but for
- * now it succeeds.
- * This test is #if 0 out for now.
+ * --The open should fail.
*
* Case #5:
* --Open a file as reader with both legacy SWMR and VFD SWMR configured.
- * --NOTE: The open should fail when John's changes are merged for
- * now it succeeds.
- * This test is #if 0 out for now.
+ * --The open should fail.
*
* Return: 0 if test is successful
* 1 if test fails
@@ -5462,11 +5458,9 @@ test_vfds_same_file_opens(hid_t orig_fapl, const char *env_h5_drvr)
if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
-#if 1 /* Use test cases #4 and #5 when John's changes are merged */
/*
* Case #4
* --Open the file as writer with both legacy SWMR and VFD SWMR configured .
- * --NOTE: The open should fail when John's changes are merged but for now it succeeds.
*/
/*
@@ -5491,11 +5485,10 @@ test_vfds_same_file_opens(hid_t orig_fapl, const char *env_h5_drvr)
fid1 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl);
}
H5E_END_TRY;
- /* Change the section of code inside "for loop" to TEST_ERROR when John's changes are merged */
if (fid1 >= 0) {
- printf("The writer open succeeds which shouldn't be\n");
if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR;
+ TEST_ERROR;
}
if (H5Pclose(fapl) < 0)
@@ -5504,7 +5497,6 @@ test_vfds_same_file_opens(hid_t orig_fapl, const char *env_h5_drvr)
/*
* Case #5:
* --Open the file as reader with both legacy SWMR and VFD SWMR configured .
- * --NOTE: The open should fail when John's changes are merged but for now it succeeds.
*/
/* config, tick_len, max_lag, presume_posix_semantics, writer,
@@ -5526,17 +5518,15 @@ test_vfds_same_file_opens(hid_t orig_fapl, const char *env_h5_drvr)
fid1 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl);
}
H5E_END_TRY;
- /* Change the section of code inside the "for loop" to TEST_ERROR when John's changes are merged */
if (fid1 >= 0) {
- printf("The reader open succeeds which shouldn't be\n");
if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR;
+ TEST_ERROR;
}
if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
-#endif
/* Free buffers */
HDfree(config);
diff --git a/test/vfd_swmr_bigset_writer.c b/test/vfd_swmr_bigset_writer.c
index 7d4c9d8..07eff66 100644
--- a/test/vfd_swmr_bigset_writer.c
+++ b/test/vfd_swmr_bigset_writer.c
@@ -81,6 +81,7 @@
#include "H5VLprivate.h"
#include "testhdf5.h"
+#include "H5retry_private.h"
#include "vfd_swmr_common.h"
#ifndef H5_HAVE_WIN32_API
@@ -2008,6 +2009,8 @@ verify_extensible_dset(state_t *s, unsigned int which, mat_t *mat, unsigned fini
base_t base, last;
unsigned int nchunks, step, ofs;
int i;
+ h5_retry_t retry;
+ hbool_t do_try; /* more tries remain */
if (which >= s->ndatasets) {
HDfprintf(stderr, "the dataset order is bigger than the number of datasets");
@@ -2016,9 +2019,11 @@ verify_extensible_dset(state_t *s, unsigned int which, mat_t *mat, unsigned fini
dset_id = s->dataset[which];
- /* Attempt to check the availability of the chunks for a number times
- * (NUM_ATTEMPTS) before reporting it as a failure */
- for (i = 0; i < NUM_ATTEMPTS; i++) {
+ /* Probably can do the same things in other parts that use NUM_ATTEMPTS */
+ for (do_try = H5_retry_init(&retry, NUM_ATTEMPTS, H5_RETRY_DEFAULT_MINIVAL,
+ H5_RETRY_DEFAULT_MAXIVAL);
+ do_try; do_try = H5_retry_next(&retry)) {
+
if (H5Drefresh(dset_id) < 0) {
HDfprintf(stderr, "H5Drefresh failed\n");
TEST_ERROR;
@@ -2057,11 +2062,8 @@ verify_extensible_dset(state_t *s, unsigned int which, mat_t *mat, unsigned fini
/* Make sure the chunks show up on the reader side. Otherwise sleep a while and try again */
if (nchunks >= last_step)
break;
- else
- decisleep(1);
}
-
- if (i == NUM_ATTEMPTS) {
+ if (!do_try) {
HDfprintf(stderr, "chunk verification reached the maximal number of attempts");
TEST_ERROR;
}