diff options
Diffstat (limited to 'test/swmr.c')
-rw-r--r-- | test/swmr.c | 336 |
1 files changed, 168 insertions, 168 deletions
diff --git a/test/swmr.c b/test/swmr.c index 54afb9d..0354744 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -48,10 +48,10 @@ #define H5O_TESTING #include "H5Opkg.h" /* Object headers */ -const char *FILENAME[] = {"swmr0", /* 0 */ - "swmr1", /* 1 */ - "swmr2", /* 2 */ - NULL}; +static const char *FILENAME[] = {"swmr0", /* 0 */ + "swmr1", /* 1 */ + "swmr2", /* 2 */ + NULL}; #define NAME_BUF_SIZE 1024 /* Length of file name */ @@ -170,7 +170,7 @@ test_metadata_read_attempts(hid_t in_fapl) { ret = H5Pset_metadata_read_attempts(fapl, 0); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -834,7 +834,7 @@ error: H5Fclose(fid1); H5Fclose(fid2); } - H5E_END_TRY; + H5E_END_TRY return -1; @@ -1531,7 +1531,7 @@ error: H5Fclose(fid); H5Fclose(fid1); } - H5E_END_TRY; + H5E_END_TRY return -1; @@ -1662,7 +1662,7 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (new_format) { if (ret < 0) TEST_ERROR; @@ -1879,7 +1879,7 @@ error: H5Sclose(sid2); H5Sclose(sid3); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_start_swmr_write() */ @@ -1990,7 +1990,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2016,7 +2016,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2043,7 +2043,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2072,7 +2072,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2091,7 +2091,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2110,7 +2110,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2143,7 +2143,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2156,7 +2156,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2204,7 +2204,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2231,7 +2231,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid2); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2260,7 +2260,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid2); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2290,7 +2290,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { bad_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, new_fapl); } - H5E_END_TRY; + H5E_END_TRY if (bad_fid >= 0) TEST_ERROR; @@ -2302,7 +2302,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { bad_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } - H5E_END_TRY; + H5E_END_TRY if (bad_fid >= 0) TEST_ERROR; @@ -2317,7 +2317,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2335,7 +2335,7 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format) { ret = H5Fstart_swmr_write(fid); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -2368,7 +2368,7 @@ error: */ H5Fclose(bad_fid); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_err_start_swmr_write() */ @@ -2491,7 +2491,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* @@ -2501,7 +2501,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) */ /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -2523,7 +2523,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) /* Open the test file */ fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) exit(EXIT_FAILURE); @@ -2552,7 +2552,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) + if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) FAIL_STACK_ERROR; /* Check exit status of child process */ @@ -2574,13 +2574,13 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) */ /* Create 2 pipes */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; - if (HDpipe(in_pdf) < 0) + if (pipe(in_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -2745,7 +2745,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) + if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) FAIL_STACK_ERROR; /* Check exit status of child process */ @@ -2768,11 +2768,11 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) * will fail with H5Fstart_swmr_write() */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -2793,7 +2793,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) { fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) exit(EXIT_FAILURE); @@ -2822,7 +2822,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) + if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) FAIL_STACK_ERROR; /* Check exit status of child process */ @@ -2844,11 +2844,11 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -2869,7 +2869,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) { fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) exit(EXIT_FAILURE); @@ -2902,7 +2902,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) + if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) FAIL_STACK_ERROR; /* Check exit status of child process */ @@ -2924,11 +2924,11 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -2949,7 +2949,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) exit(EXIT_FAILURE); @@ -2982,7 +2982,7 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) + if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) FAIL_STACK_ERROR; /* Check exit status of child process */ @@ -3012,7 +3012,7 @@ error: H5Pclose(fapl); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; @@ -3177,7 +3177,7 @@ error: H5Pclose(fapl); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_start_swmr_write_stress_ohdr() */ @@ -3287,7 +3287,7 @@ error: H5Pclose(vds_dapl1); H5Pclose(vds_dapl2); } - H5E_END_TRY; + H5E_END_TRY return FAIL; } /* tssw_persist_dapl_verify() */ @@ -3545,7 +3545,7 @@ error: H5Dclose(vdsid2); H5Sclose(sid); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_start_swmr_write_persist_dapl() */ @@ -3608,7 +3608,7 @@ test_object_flush_cb(hid_t in_fapl) { ret = H5Pset_object_flush_cb(fapl, NULL, &flush_ct); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -3812,7 +3812,7 @@ error: H5Gclose(gid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_object_flush_cb() */ @@ -3912,7 +3912,7 @@ test_append_flush_generic(void) { ret = H5Pset_append_flush(dapl, 0, NULL, NULL, &count); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -3921,7 +3921,7 @@ test_append_flush_generic(void) { ret = H5Pset_append_flush(dapl, H5S_MAX_RANK + 1, NULL, NULL, &count); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -3930,7 +3930,7 @@ test_append_flush_generic(void) { ret = H5Pset_append_flush(dapl, 2, NULL, NULL, &count); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -3943,7 +3943,7 @@ test_append_flush_generic(void) { ret = H5Pset_append_flush(dapl, 2, boundary, NULL, &count); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -3954,7 +3954,7 @@ test_append_flush_generic(void) { ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -3965,7 +3965,7 @@ test_append_flush_generic(void) { ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0) TEST_ERROR; @@ -4011,7 +4011,7 @@ error: { H5Pclose(dapl); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_append_flush_generic() */ @@ -4132,7 +4132,7 @@ test_append_flush_dataset_chunked(hid_t in_fapl) { did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl); } - H5E_END_TRY; + H5E_END_TRY if (did2 >= 0) TEST_ERROR; @@ -4146,7 +4146,7 @@ test_append_flush_dataset_chunked(hid_t in_fapl) { did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl); } - H5E_END_TRY; + H5E_END_TRY if (did2 >= 0) TEST_ERROR; @@ -4161,7 +4161,7 @@ test_append_flush_dataset_chunked(hid_t in_fapl) { did2 = H5Dopen2(fid, "dataset2", dapl); } - H5E_END_TRY; + H5E_END_TRY if (did2 >= 0) TEST_ERROR; @@ -4240,7 +4240,7 @@ error: H5Sclose(sid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_append_flush_dataset_chunked() */ @@ -4447,7 +4447,7 @@ error: H5Sclose(sid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_append_flush_dataset_fixed() */ @@ -4689,7 +4689,7 @@ error: H5Sclose(sid); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_append_flush_dataset_multiple() */ @@ -4803,7 +4803,7 @@ test_file_lock_same(hid_t in_fapl) { fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid2 >= 0) TEST_ERROR; @@ -4857,7 +4857,7 @@ error: H5Fclose(fid); H5Fclose(fid2); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* end test_file_lock_same() */ @@ -4911,7 +4911,7 @@ test_file_lock_swmr_same(hid_t in_fapl) { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_READ, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) TEST_ERROR; @@ -4922,7 +4922,7 @@ test_file_lock_swmr_same(hid_t in_fapl) { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) TEST_ERROR; @@ -4933,7 +4933,7 @@ test_file_lock_swmr_same(hid_t in_fapl) { fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) TEST_ERROR; @@ -4944,7 +4944,7 @@ test_file_lock_swmr_same(hid_t in_fapl) { fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) TEST_ERROR; @@ -4962,7 +4962,7 @@ test_file_lock_swmr_same(hid_t in_fapl) { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid2 >= 0) TEST_ERROR; @@ -5058,7 +5058,7 @@ test_file_lock_swmr_same(hid_t in_fapl) { fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY if (fid2 >= 0) TEST_ERROR; @@ -5076,7 +5076,7 @@ test_file_lock_swmr_same(hid_t in_fapl) { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid2 >= 0) TEST_ERROR; @@ -5126,7 +5126,7 @@ test_file_lock_swmr_same(hid_t in_fapl) { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid2 >= 0) TEST_ERROR; @@ -5144,7 +5144,7 @@ test_file_lock_swmr_same(hid_t in_fapl) { fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid2 >= 0) TEST_ERROR; @@ -5167,7 +5167,7 @@ error: H5Fclose(fid); H5Fclose(fid2); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* end test_file_lock_swmr_same() */ @@ -5232,11 +5232,11 @@ test_file_lock_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -5258,7 +5258,7 @@ test_file_lock_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -5289,7 +5289,7 @@ test_file_lock_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -5309,11 +5309,11 @@ test_file_lock_concur(hid_t in_fapl) * Case 2: 1) RDWR 2) RDONLY : should fail */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -5335,7 +5335,7 @@ test_file_lock_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -5366,7 +5366,7 @@ test_file_lock_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -5387,11 +5387,11 @@ test_file_lock_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -5413,7 +5413,7 @@ test_file_lock_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -5444,7 +5444,7 @@ test_file_lock_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -5465,11 +5465,11 @@ test_file_lock_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -5491,7 +5491,7 @@ test_file_lock_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should succeed */ if (child_fid >= 0) { @@ -5527,7 +5527,7 @@ test_file_lock_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -5557,7 +5557,7 @@ error: H5Pclose(fapl); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; @@ -5629,11 +5629,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -5655,7 +5655,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -5686,7 +5686,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -5707,11 +5707,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -5733,7 +5733,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -5764,7 +5764,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -5785,11 +5785,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -5811,7 +5811,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -5842,7 +5842,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -5862,11 +5862,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 4: 1) RDWR|SWMR_WRITE 2) RDWR|SWMR_WRITE : should fail */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -5888,7 +5888,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -5919,7 +5919,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -5939,11 +5939,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 5: 1) RDWR|SWMR_WRITE 2) RDONLY|SWMR_READ : should succeed */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -5965,7 +5965,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should succeed */ if (child_fid >= 0) { @@ -5999,7 +5999,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -6019,11 +6019,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) * Case 6: 1) RDWR|SWMR_WRITE 2) RDONLY : should fail */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -6045,7 +6045,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -6076,7 +6076,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -6097,11 +6097,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -6123,7 +6123,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -6154,7 +6154,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -6175,11 +6175,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -6201,7 +6201,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -6232,7 +6232,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -6253,11 +6253,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -6279,7 +6279,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should succeed */ if (child_fid >= 0) { @@ -6313,7 +6313,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -6334,11 +6334,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -6391,7 +6391,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -6412,11 +6412,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -6438,7 +6438,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should fail */ if (child_fid == FAIL) @@ -6469,7 +6469,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -6490,11 +6490,11 @@ test_file_lock_swmr_concur(hid_t in_fapl) */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -6516,7 +6516,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); } - H5E_END_TRY; + H5E_END_TRY /* Should succeed */ if (child_fid >= 0) { @@ -6550,7 +6550,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) FAIL_STACK_ERROR; /* Check if child terminated normally */ @@ -6580,7 +6580,7 @@ error: H5Pclose(fapl); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; @@ -6669,11 +6669,11 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri */ /* Create 1 pipe */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) TEST_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) TEST_ERROR; if (childpid == 0) { @@ -6699,7 +6699,7 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); ret = H5Fclose(child_fid); } - H5E_END_TRY; + H5E_END_TRY /* Close the pipe */ if (HDclose(out_pdf[0]) < 0) @@ -6729,7 +6729,7 @@ test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_overri TEST_ERROR; /* Wait for child process to complete */ - if (HDwaitpid(childpid, &child_status, child_wait_option) < 0) + if (waitpid(childpid, &child_status, child_wait_option) < 0) TEST_ERROR; /* Check exit status of the child */ @@ -6772,7 +6772,7 @@ error: H5Pclose(fapl); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; @@ -6826,7 +6826,7 @@ test_different_lock_flags(hid_t in_fapl) { fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); } - H5E_END_TRY; + H5E_END_TRY if (H5I_INVALID_HID != fid3) FAIL_PUTS_ERROR("Should not have been able to open a file with different locking flags"); @@ -6852,7 +6852,7 @@ error: H5Fclose(fid2); H5Fclose(fid3); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* end test_different_lock_flags() */ @@ -6897,7 +6897,7 @@ test_swmr_vfd_flag(void) { fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, bad_fapl); } - H5E_END_TRY; + H5E_END_TRY if (fid >= 0) TEST_ERROR; @@ -6917,7 +6917,7 @@ error: H5Pclose(bad_fapl); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_swmr_vfd_flag() */ @@ -7037,7 +7037,7 @@ error: H5Pclose(fapl); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; } /* test_bug_refresh() */ @@ -7166,13 +7166,13 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Create 2 pipes */ - if (HDpipe(out_pdf) < 0) + if (pipe(out_pdf) < 0) FAIL_STACK_ERROR; - if (HDpipe(in_pdf) < 0) + if (pipe(in_pdf) < 0) FAIL_STACK_ERROR; /* Fork child process */ - if ((childpid = HDfork()) < 0) + if ((childpid = fork()) < 0) FAIL_STACK_ERROR; if (childpid == 0) { /* Child process */ @@ -7347,7 +7347,7 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format) FAIL_STACK_ERROR; /* Wait for child process to complete */ - if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) + if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) FAIL_STACK_ERROR; /* Check exit status of child process */ @@ -7382,7 +7382,7 @@ error: H5Pclose(fapl); H5Fclose(fid); } - H5E_END_TRY; + H5E_END_TRY return -1; @@ -7714,7 +7714,7 @@ error: H5Fclose(fid2); H5Fclose(fid3); } - H5E_END_TRY; + H5E_END_TRY return 1; @@ -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)) { printf("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). |