diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2019-11-20 22:23:03 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2019-11-20 22:23:03 (GMT) |
commit | 12438c22b727f210c85dd74fb147f666c273a127 (patch) | |
tree | b1c5ee0e9674e86531546e834a6d4602f5f25021 /test | |
parent | 68ad19d9ccf24e81cf2199602d3d8ffeaf69e1e4 (diff) | |
download | hdf5-12438c22b727f210c85dd74fb147f666c273a127.zip hdf5-12438c22b727f210c85dd74fb147f666c273a127.tar.gz hdf5-12438c22b727f210c85dd74fb147f666c273a127.tar.bz2 |
Fix for punch list #28:
Given that the VFD SWMR configuration FAPL property is set, the writer field must
be consistent with the flags passed in the H5Fopen() (either H5F_ACC_RDWR for the
VFD SWMR writer, or H5F_ACC_RDONLY for the VFD SWMR readers).
Diffstat (limited to 'test')
-rw-r--r-- | test/vfd_swmr.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c index c4085b3..6e5c82a 100644 --- a/test/vfd_swmr.c +++ b/test/vfd_swmr.c @@ -190,7 +190,10 @@ error: * Purpose: A) Verify that page buffering and paged aggregation * have to be enabled for a file to be configured * with VFD SWMR. - * B) Verify the VFD SWMR configuration set in fapl + * B) Verify that the "writer" setting in the fapl's VFD + * SWMR configuration should be consistent with the + * file access flags. + * C) Verify the VFD SWMR configuration set in fapl * used to create/open the file is the same as the * configuration retrieved from the file's fapl. * @@ -239,6 +242,32 @@ test_file_fapl(void) if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR; + /* Configured as VFD SWMR reader */ + config1->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; + config1->tick_len = 4; + config1->max_lag = 6; + config1->writer = FALSE; + config1->md_pages_reserved = 2; + HDstrcpy(config1->md_file_path, MD_FILENAME); + + /* Should succeed in setting the VFD SWMR configuration */ + if(H5Pset_vfd_swmr_config(fapl1, config1) < 0) + TEST_ERROR; + + /* Should fail to create: file access is writer but VFD SWMR config is reader */ + H5E_BEGIN_TRY { + fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl1); + } H5E_END_TRY; + if(fid >= 0) + TEST_ERROR; + + if(H5Pclose(fapl1) < 0) + FAIL_STACK_ERROR + + /* Create a copy of the file access property list */ + if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + /* Configured as VFD SWMR writer */ config1->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; config1->tick_len = 4; @@ -258,6 +287,7 @@ test_file_fapl(void) if(fid >= 0) TEST_ERROR; + /* Create a copy of the file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) FAIL_STACK_ERROR @@ -299,8 +329,14 @@ test_file_fapl(void) if(H5Pclose(file_fapl) < 0) FAIL_STACK_ERROR; + /* Should fail to open: file access is reader but VFD SWMR config is writer */ + H5E_BEGIN_TRY { + fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, fapl1); + } H5E_END_TRY; + if(fid >= 0) + TEST_ERROR; - /* Should succeed to open the file as VFD SWMR writer */ + /* Should succeed to open: file access and VFD SWMR config are consistent */ if((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl1)) < 0) TEST_ERROR; |