From cf2b9d600a72cbe3caa87ee11ea2c828f48a561c Mon Sep 17 00:00:00 2001 From: vchoi Date: Wed, 8 Jun 2022 01:05:04 -0500 Subject: (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 --- test/vfd_swmr.c | 18 ++++-------------- test/vfd_swmr_bigset_writer.c | 16 +++++++++------- 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; } -- cgit v0.12 From 3848c783b659db101ccc83665cbd80de7b445652 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 8 Jun 2022 06:08:34 +0000 Subject: Committing clang-format changes --- test/vfd_swmr.c | 1 - test/vfd_swmr_bigset_writer.c | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c index 279145c..1233314 100644 --- a/test/vfd_swmr.c +++ b/test/vfd_swmr.c @@ -5527,7 +5527,6 @@ test_vfds_same_file_opens(hid_t orig_fapl, const char *env_h5_drvr) if (H5Pclose(fapl) < 0) FAIL_STACK_ERROR; - /* Free buffers */ HDfree(config); diff --git a/test/vfd_swmr_bigset_writer.c b/test/vfd_swmr_bigset_writer.c index 4ee77d9..508fc3b 100644 --- a/test/vfd_swmr_bigset_writer.c +++ b/test/vfd_swmr_bigset_writer.c @@ -2011,8 +2011,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 */ + 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"); @@ -2022,8 +2022,7 @@ verify_extensible_dset(state_t *s, unsigned int which, mat_t *mat, unsigned fini dset_id = s->dataset[which]; /* 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); + 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) { -- cgit v0.12