diff options
author | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2018-10-30 21:53:09 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@jam.ad.hdfgroup.org> | 2018-10-30 21:53:09 (GMT) |
commit | d1d2cf776d4f7b809e3cc1bda1a001ea147dfa89 (patch) | |
tree | 4d3cb63d4f3245f0d63fae01252f6e352fb67d3c /test/use_append_mchunks.c | |
parent | 3145690c9590778b857def090489c6d890e42a5b (diff) | |
download | hdf5-d1d2cf776d4f7b809e3cc1bda1a001ea147dfa89.zip hdf5-d1d2cf776d4f7b809e3cc1bda1a001ea147dfa89.tar.gz hdf5-d1d2cf776d4f7b809e3cc1bda1a001ea147dfa89.tar.bz2 |
Fix for HDFFV-10554 use_append_chunks in swmr use case test failure
Fix the timing issue of the test by moving the open/close of the test file for the writer to
use_append_chunk.c and use_append_mchunks.c.
Diffstat (limited to 'test/use_append_mchunks.c')
-rw-r--r-- | test/use_append_mchunks.c | 68 |
1 files changed, 51 insertions, 17 deletions
diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c index 9ee37cb..2dc7bdb 100644 --- a/test/use_append_mchunks.c +++ b/test/use_append_mchunks.c @@ -117,6 +117,9 @@ main(int argc, char *argv[]) int ret_value = 0; int child_ret_value; hbool_t send_wait = 0; + hid_t fapl = -1; /* File access property list */ + hid_t fid = -1; /* File ID */ + char *name; /* Test file name */ /* initialization */ if (setup_parameters(argc, argv) < 0){ @@ -175,29 +178,60 @@ main(int argc, char *argv[]) /* ============= */ /* this process continues to launch the writer */ printf("%d: continue as the writer process\n", mypid); - if (write_uc_file(send_wait) < 0){ - fprintf(stderr, "write_uc_file encountered error\n"); - Hgoto_error(1); + + name = UC_opts.filename; + + /* Set the file access property list */ + if((fapl = h5_fileaccess()) < 0) + Hgoto_error(1); + + if(UC_opts.use_swmr) + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + Hgoto_error(1); + + /* Open the file */ + if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) { + fprintf(stderr, "H5Fopen failed\n"); + Hgoto_error(1); + } + + if(write_uc_file(send_wait, fid) < 0) { + fprintf(stderr, "write_uc_file encountered error\n"); + Hgoto_error(1); } + /* ================================================ */ /* If readwrite, collect exit code of child process */ /* ================================================ */ if (UC_opts.launch == UC_READWRITE){ - if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0){ - perror("waitpid"); - Hgoto_error(1); - } - if (WIFEXITED(child_status)){ - if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ - printf("%d: child process exited with non-zero code (%d)\n", - mypid, child_ret_value); - Hgoto_error(2); - } - } else { - printf("%d: child process terminated abnormally\n", mypid); - Hgoto_error(2); - } + if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0){ + perror("waitpid"); + Hgoto_error(1); + } + + /* Close the file */ + if(H5Fclose(fid) < 0) { + fprintf(stderr, "Failed to close file id\n"); + Hgoto_error(1); + } + + /* Close the property list */ + if(H5Pclose(fapl) < 0) { + fprintf(stderr, "Failed to property list\n"); + Hgoto_error(1); + } + + if (WIFEXITED(child_status)){ + if ((child_ret_value=WEXITSTATUS(child_status)) != 0){ + printf("%d: child process exited with non-zero code (%d)\n", + mypid, child_ret_value); + Hgoto_error(1); + } + } else { + printf("%d: child process terminated abnormally\n", mypid); + Hgoto_error(2); + } } done: |