diff options
Diffstat (limited to 'test/vfd_swmr.c')
-rw-r--r-- | test/vfd_swmr.c | 421 |
1 files changed, 185 insertions, 236 deletions
diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c index c61a065..e7eb3da 100644 --- a/test/vfd_swmr.c +++ b/test/vfd_swmr.c @@ -122,9 +122,9 @@ static unsigned test_updater_generate_md_checksums(hbool_t file_create); static unsigned test_fapl(void) { - hid_t fapl = -1; /* File access property list */ - H5F_vfd_swmr_config_t *my_config = NULL; /* Configuration for VFD SWMR */ - herr_t ret; /* Return value */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + H5F_vfd_swmr_config_t *my_config = NULL; /* Configuration for VFD SWMR */ + herr_t ret; /* Return value */ TESTING("Configure VFD SWMR with fapl"); @@ -276,8 +276,7 @@ test_fapl(void) if (H5Pclose(fapl) < 0) FAIL_STACK_ERROR; - if (my_config) - HDfree(my_config); + HDfree(my_config); PASSED(); return 0; @@ -288,8 +287,9 @@ error: H5Pclose(fapl); } H5E_END_TRY; - if (my_config) - HDfree(my_config); + + HDfree(my_config); + return 1; } /* test_fapl() */ @@ -316,12 +316,12 @@ error: static unsigned test_file_fapl(void) { - hid_t fid = -1; /* File ID */ - hid_t fid2 = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list ID */ - hid_t fapl1 = -1; /* File access property list ID */ - hid_t fapl2 = -1; /* File access property list ID */ - hid_t file_fapl = -1; /* File access property list ID associated with the file */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */ + hid_t fapl1 = H5I_INVALID_HID; /* File access property list ID */ + hid_t fapl2 = H5I_INVALID_HID; /* File access property list ID */ + hid_t file_fapl = H5I_INVALID_HID; /* File access property list ID associated with the file */ H5F_vfd_swmr_config_t *config1 = NULL; /* Configuration for VFD SWMR */ H5F_vfd_swmr_config_t *config2 = NULL; /* Configuration for VFD SWMR */ H5F_vfd_swmr_config_t *file_config = NULL; /* Configuration for VFD SWMR */ @@ -602,12 +602,9 @@ test_file_fapl(void) FAIL_STACK_ERROR; /* Free buffers */ - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); - if (file_config) - HDfree(file_config); + HDfree(config1); + HDfree(config2); + HDfree(file_config); PASSED(); return 0; @@ -623,12 +620,11 @@ error: H5Fclose(fid2); } H5E_END_TRY; - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); - if (file_config) - HDfree(file_config); + + HDfree(config1); + HDfree(config2); + HDfree(file_config); + return 1; } /* test_file_fapl() */ @@ -830,12 +826,9 @@ test_file_end_tick(void) FAIL_STACK_ERROR; /* Free buffers */ - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); - if (config3) - HDfree(config3); + HDfree(config1); + HDfree(config2); + HDfree(config3); PASSED(); return 0; @@ -853,12 +846,9 @@ error: } H5E_END_TRY; - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); - if (config3) - HDfree(config3); + HDfree(config1); + HDfree(config2); + HDfree(config3); return 1; } /* test_file_end_tick() */ @@ -956,15 +946,12 @@ test_writer_create_open_flush(void) if (H5Pclose(fcpl) < 0) FAIL_STACK_ERROR; - if (my_config) - HDfree(my_config); + HDfree(my_config); PASSED(); return 0; error: - if (my_config) - HDfree(my_config); H5E_BEGIN_TRY { @@ -974,6 +961,8 @@ error: } H5E_END_TRY; + HDfree(my_config); + return 1; } /* test_writer_create_open_flush() */ @@ -1003,15 +992,15 @@ error: static unsigned test_writer_md(void) { - hid_t fid = -1; /* File ID */ - hid_t fapl = -1; /* File access property list */ - hid_t fcpl = -1; /* File creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ const unsigned num_entries = 10; /* index size */ unsigned i = 0; /* Local index variables */ uint8_t * buf = NULL; /* Data page from the page buffer */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t sid = -1; /* Dataspace ID */ - hid_t did = -1; /* Dataset ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ int * rwbuf = NULL; /* Data buffer for writing */ H5O_info2_t oinfo; /* Object metadata information */ char dname[100]; /* Name of dataset */ @@ -1202,28 +1191,15 @@ test_writer_md(void) FAIL_STACK_ERROR; /* Free resources */ - if (my_config) - HDfree(my_config); - if (buf) - HDfree(buf); - if (rwbuf) - HDfree(rwbuf); - if (index) - HDfree(index); + HDfree(my_config); + HDfree(buf); + HDfree(rwbuf); + HDfree(index); PASSED(); return 0; error: - if (my_config) - HDfree(my_config); - if (buf) - HDfree(buf); - if (rwbuf) - HDfree(rwbuf); - if (index) - HDfree(index); - H5E_BEGIN_TRY { H5Dclose(did); @@ -1235,6 +1211,11 @@ error: } H5E_END_TRY; + HDfree(my_config); + HDfree(buf); + HDfree(rwbuf); + HDfree(index); + return 1; } /* test_writer__md() */ @@ -1306,30 +1287,30 @@ test_file_end_tick_concur(void) static unsigned test_reader_md_concur(void) { - unsigned i = 0; /* Local index variables */ - uint8_t * buf = NULL; /* Data page from the page buffer */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t sid = -1; /* Dataspace ID */ - hid_t did = -1; /* Dataset ID */ - int * rwbuf = NULL; /* Data buffer for writing */ - H5O_info2_t oinfo; /* Object metadata information */ - char dname[100]; /* Name of dataset */ - hsize_t dims[2] = {50, 20}; /* Dataset dimension sizes */ - hsize_t max_dims[2] = /* Dataset maximum dimension sizes */ + unsigned i = 0; /* Local index variables */ + uint8_t * buf = NULL; /* Data page from the page buffer */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + int * rwbuf = NULL; /* Data buffer for writing */ + H5O_info2_t oinfo; /* Object metadata information */ + char dname[100]; /* Name of dataset */ + hsize_t dims[2] = {50, 20}; /* Dataset dimension sizes */ + hsize_t max_dims[2] = /* Dataset maximum dimension sizes */ {H5S_UNLIMITED, H5S_UNLIMITED}; hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */ unsigned num_entries = 0; /* Number of entries in the index */ H5FD_vfd_swmr_idx_entry_t *index = NULL; /* Pointer to the index entries */ - hid_t fcpl = -1; /* File creation property list */ - hid_t fid_writer = -1; /* File ID for writer */ - hid_t fapl_writer = -1; /* File access property list for writer */ - H5F_vfd_swmr_config_t *config_writer = NULL; /* VFD SWMR Configuration for writer */ - pid_t tmppid; /* Child process ID returned by waitpid */ - pid_t childpid = 0; /* Child process ID */ - int child_status; /* Status passed to waitpid */ - int child_wait_option = 0; /* Options passed to waitpid */ - int child_exit_val; /* Exit status of the child */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t fid_writer = H5I_INVALID_HID; /* File ID for writer */ + hid_t fapl_writer = H5I_INVALID_HID; /* File access property list for writer */ + H5F_vfd_swmr_config_t *config_writer = NULL; /* VFD SWMR Configuration for writer */ + pid_t tmppid; /* Child process ID returned by waitpid */ + pid_t childpid = 0; /* Child process ID */ + int child_status; /* Status passed to waitpid */ + int child_wait_option = 0; /* Options passed to waitpid */ + int child_exit_val; /* Exit status of the child */ int parent_pfd[2]; /* Pipe for parent process as writer */ int child_pfd[2]; /* Pipe for child process as reader */ @@ -1383,13 +1364,13 @@ test_reader_md_concur(void) * Child process as reader */ if (childpid == 0) { - int child_notify = 0; /* Notification between child and parent */ - hid_t fid_reader = -1; /* File ID for reader */ - hid_t fapl_reader = -1; /* File access property list for reader */ - H5F_t * file_reader; /* File pointer for reader */ - H5F_vfd_swmr_config_t * config_reader = NULL; /* VFD SWMR configuration for reader */ - unsigned child_num_entries = 0; /* Number of entries passed to reader */ - H5FD_vfd_swmr_idx_entry_t *child_index = NULL; /* Index passed to reader */ + int child_notify = 0; /* Notification between child and parent */ + hid_t fid_reader = H5I_INVALID_HID; /* File ID for reader */ + hid_t fapl_reader = H5I_INVALID_HID; /* File access property list for reader */ + H5F_t * file_reader; /* File pointer for reader */ + H5F_vfd_swmr_config_t * config_reader = NULL; /* VFD SWMR configuration for reader */ + unsigned child_num_entries = 0; /* Number of entries passed to reader */ + H5FD_vfd_swmr_idx_entry_t *child_index = NULL; /* Index passed to reader */ /* Close unused write end for writer pipe */ if (HDclose(parent_pfd[1]) < 0) @@ -1589,10 +1570,8 @@ test_reader_md_concur(void) HDexit(EXIT_FAILURE); /* Free resources */ - if (child_index) - HDfree(child_index); - if (config_reader) - HDfree(config_reader); + HDfree(child_index); + HDfree(config_reader); /* Closing */ if (H5Fclose(fid_reader) < 0) @@ -1905,27 +1884,19 @@ test_reader_md_concur(void) FAIL_STACK_ERROR; /* Free resources */ - if (config_writer) - HDfree(config_writer); - if (buf) - HDfree(buf); - if (rwbuf) - HDfree(rwbuf); - if (index) - HDfree(index); + HDfree(config_writer); + HDfree(buf); + HDfree(rwbuf); + HDfree(index); PASSED(); return 0; error: - if (config_writer) - HDfree(config_writer); - if (buf) - HDfree(buf); - if (rwbuf) - HDfree(rwbuf); - if (index) - HDfree(index); + HDfree(config_writer); + HDfree(buf); + HDfree(rwbuf); + HDfree(index); H5E_BEGIN_TRY { @@ -1962,9 +1933,11 @@ test_multiple_file_opens_concur(void) int child_exit_val; /* Exit status of the child */ int parent_pfd[2]; /* Pipe for parent process as writer */ int child_pfd[2]; /* Pipe for child process as reader */ - int notify = 0; /* Notification between parent and child */ - hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID; - hid_t fapl1 = H5I_INVALID_HID, fapl2 = H5I_INVALID_HID; + int notify = 0; /* Notification between parent and child */ + hid_t fid1 = H5I_INVALID_HID; + hid_t fid2 = H5I_INVALID_HID; + hid_t fapl1 = H5I_INVALID_HID; + hid_t fapl2 = H5I_INVALID_HID; H5F_vfd_swmr_config_t *config1 = NULL; /* VFD SWMR configuration */ H5F_vfd_swmr_config_t *config2 = NULL; /* VFD SWMR configuration */ H5F_t * f1, *f2; /* File pointer */ @@ -2008,10 +1981,10 @@ test_multiple_file_opens_concur(void) * Child process */ if (childpid == 0) { - int child_notify = 0; /* Notification between child and parent */ - hid_t fid_writer = -1; /* File ID for writer */ - hid_t fapl_writer = -1; /* File access property list for writer */ - H5F_vfd_swmr_config_t *config_writer = NULL; /* VFD SWMR configuration for reader */ + int child_notify = 0; /* Notification between child and parent */ + hid_t fid_writer = H5I_INVALID_HID; /* File ID for writer */ + hid_t fapl_writer = H5I_INVALID_HID; /* File access property list for writer */ + H5F_vfd_swmr_config_t *config_writer = NULL; /* VFD SWMR configuration for reader */ /* Close unused write end for writer pipe */ if (HDclose(parent_pfd[1]) < 0) @@ -2062,8 +2035,7 @@ test_multiple_file_opens_concur(void) HDexit(EXIT_FAILURE); } - if (config_writer) - HDfree(config_writer); + HDfree(config_writer); /* Close the file */ if (H5Fclose(fid_writer) < 0) @@ -2221,19 +2193,15 @@ test_multiple_file_opens_concur(void) FAIL_STACK_ERROR; /* Free resources */ - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); + HDfree(config1); + HDfree(config2); PASSED(); return 0; error: - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); + HDfree(config1); + HDfree(config2); H5E_BEGIN_TRY { @@ -2267,15 +2235,15 @@ error: static unsigned test_disable_enable_eot_concur(void) { - hid_t fcpl = -1; /* File creation property list */ - hid_t fid_writer = -1; /* File ID for writer */ - hid_t fapl_writer = -1; /* File access property list for writer */ - H5F_vfd_swmr_config_t *config_writer = NULL; /* VFD SWMR Configuration for writer */ - pid_t tmppid; /* Child process ID returned by waitpid */ - pid_t childpid = 0; /* Child process ID */ - int child_status; /* Status passed to waitpid */ - int child_wait_option = 0; /* Options passed to waitpid */ - int child_exit_val; /* Exit status of the child */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t fid_writer = H5I_INVALID_HID; /* File ID for writer */ + hid_t fapl_writer = H5I_INVALID_HID; /* File access property list for writer */ + H5F_vfd_swmr_config_t *config_writer = NULL; /* VFD SWMR Configuration for writer */ + pid_t tmppid; /* Child process ID returned by waitpid */ + pid_t childpid = 0; /* Child process ID */ + int child_status; /* Status passed to waitpid */ + int child_wait_option = 0; /* Options passed to waitpid */ + int child_exit_val; /* Exit status of the child */ int parent_pfd[2]; /* Pipe for parent process as writer */ int child_pfd[2]; /* Pipe for child process as reader */ @@ -2452,8 +2420,8 @@ test_disable_enable_eot_concur(void) HDexit(EXIT_FAILURE); if (H5Pclose(fapl_reader) < 0) HDexit(EXIT_FAILURE); - if (config_reader) - HDfree(config_reader); + + HDfree(config_reader); /* Close the pipes */ if (HDclose(parent_pfd[0]) < 0) @@ -2521,15 +2489,13 @@ test_disable_enable_eot_concur(void) FAIL_STACK_ERROR; /* Free resources */ - if (config_writer) - HDfree(config_writer); + HDfree(config_writer); PASSED(); return 0; error: - if (config_writer) - HDfree(config_writer); + HDfree(config_writer); H5E_BEGIN_TRY { @@ -2559,15 +2525,15 @@ error: static unsigned test_file_end_tick_concur(void) { - hid_t fcpl = -1; /* File creation property list */ - hid_t fid_writer = -1; /* File ID for writer */ - hid_t fapl_writer = -1; /* File access property list for writer */ - H5F_vfd_swmr_config_t *config_writer = NULL; /* VFD SWMR Configuration for writer */ - pid_t tmppid; /* Child process ID returned by waitpid */ - pid_t childpid = 0; /* Child process ID */ - int child_status; /* Status passed to waitpid */ - int child_wait_option = 0; /* Options passed to waitpid */ - int child_exit_val; /* Exit status of the child */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t fid_writer = H5I_INVALID_HID; /* File ID for writer */ + hid_t fapl_writer = H5I_INVALID_HID; /* File access property list for writer */ + H5F_vfd_swmr_config_t *config_writer = NULL; /* VFD SWMR Configuration for writer */ + pid_t tmppid; /* Child process ID returned by waitpid */ + pid_t childpid = 0; /* Child process ID */ + int child_status; /* Status passed to waitpid */ + int child_wait_option = 0; /* Options passed to waitpid */ + int child_exit_val; /* Exit status of the child */ int parent_pfd[2]; /* Pipe for parent process as writer */ int child_pfd[2]; /* Pipe for child process as reader */ @@ -2726,8 +2692,8 @@ test_file_end_tick_concur(void) if (H5Pclose(fapl_reader) < 0) HDexit(EXIT_FAILURE); - if (config_reader) - HDfree(config_reader); + + HDfree(config_reader); /* Close the pipes */ if (HDclose(parent_pfd[0]) < 0) @@ -2795,15 +2761,13 @@ test_file_end_tick_concur(void) FAIL_STACK_ERROR; /* Free resources */ - if (config_writer) - HDfree(config_writer); + HDfree(config_writer); PASSED(); return 0; error: - if (config_writer) - HDfree(config_writer); + HDfree(config_writer); H5E_BEGIN_TRY { @@ -2835,15 +2799,15 @@ error: static unsigned test_multiple_file_opens(void) { - hid_t fid1 = -1; /* File ID */ - hid_t fid2 = -1; /* File ID */ - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list ID */ - hid_t fapl1 = -1; /* File access property list ID */ - hid_t fapl2 = -1; /* File access property list ID */ - H5F_t * f1, *f2, *f; /* File pointer */ - H5F_vfd_swmr_config_t *config1 = NULL; /* Configuration for VFD SWMR */ - H5F_vfd_swmr_config_t *config2 = NULL; /* Configuration for VFD SWMR */ + hid_t fid1 = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */ + hid_t fapl1 = H5I_INVALID_HID; /* File access property list ID */ + hid_t fapl2 = H5I_INVALID_HID; /* File access property list ID */ + H5F_t * f1, *f2, *f; /* File pointer */ + H5F_vfd_swmr_config_t *config1 = NULL; /* Configuration for VFD SWMR */ + H5F_vfd_swmr_config_t *config2 = NULL; /* Configuration for VFD SWMR */ eot_queue_entry_t * curr; TESTING("EOT queue entries when opening files with/without VFD SWMR"); @@ -2967,10 +2931,8 @@ test_multiple_file_opens(void) FAIL_STACK_ERROR; /* Free buffers */ - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); + HDfree(config1); + HDfree(config2); PASSED(); return 0; @@ -2986,10 +2948,9 @@ error: H5Fclose(fid2); } H5E_END_TRY; - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); + + HDfree(config1); + HDfree(config2); return 1; } /* test_multiple_file_opens() */ @@ -3027,13 +2988,13 @@ error: static unsigned test_same_file_opens(void) { - hid_t fid = -1; /* File ID */ - hid_t fid2 = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list ID */ - hid_t fapl1 = -1; /* File access property list ID */ - hid_t fapl2 = -1; /* File access property list ID */ - H5F_vfd_swmr_config_t *config1 = NULL; /* Configuration for VFD SWMR */ - H5F_vfd_swmr_config_t *config2 = NULL; /* Configuration for VFD SWMR */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */ + hid_t fapl1 = H5I_INVALID_HID; /* File access property list ID */ + hid_t fapl2 = H5I_INVALID_HID; /* File access property list ID */ + H5F_vfd_swmr_config_t *config1 = NULL; /* Configuration for VFD SWMR */ + H5F_vfd_swmr_config_t *config2 = NULL; /* Configuration for VFD SWMR */ TESTING("Multiple opens of the same file with VFD SWMR configuration"); @@ -3297,10 +3258,8 @@ test_same_file_opens(void) FAIL_STACK_ERROR; /* Free buffers */ - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); + HDfree(config1); + HDfree(config2); PASSED(); return 0; @@ -3315,10 +3274,10 @@ error: H5Fclose(fid2); } H5E_END_TRY; - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); + + HDfree(config1); + HDfree(config2); + return 1; } /* test_same_file_opens() */ @@ -3654,12 +3613,9 @@ test_enable_disable_eot(void) FAIL_STACK_ERROR; /* Free buffers */ - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); - if (config3) - HDfree(config3); + HDfree(config1); + HDfree(config2); + HDfree(config3); PASSED(); return 0; @@ -3677,12 +3633,10 @@ error: H5Fclose(fid3); } H5E_END_TRY; - if (config1) - HDfree(config1); - if (config2) - HDfree(config2); - if (config3) - HDfree(config3); + + HDfree(config1); + HDfree(config2); + HDfree(config3); return 1; } /* test_enable_disable_eot() */ @@ -3693,8 +3647,7 @@ error: * Purpose: This is the helper routine used to verify whether * "flags" in the updater file is as expected. * - * Return: 0 if test is successful - * 1 if test fails + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi; October 2021 * @@ -3724,10 +3677,10 @@ verify_updater_flags(char *ud_name, uint16_t expected_flags) if (HDfclose(ud_fp) < 0) FAIL_STACK_ERROR; - return 0; + return SUCCEED; error: - return 1; + return FAIL; } /* verify_updater_flags() */ @@ -3747,10 +3700,10 @@ error: static unsigned test_updater_flags(void) { - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list ID */ - hid_t fapl = -1; /* File access property list ID */ - hid_t file_fapl = -1; /* File access property list ID associated with the file */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ + hid_t file_fapl = H5I_INVALID_HID; /* File access property list ID associated with the file */ H5F_vfd_swmr_config_t *config = NULL; /* Configuration for VFD SWMR */ H5F_vfd_swmr_config_t *file_config = NULL; /* Configuration for VFD SWMR */ uint64_t seq_num = 0; /* Sequence number for updater file */ @@ -3849,10 +3802,8 @@ test_updater_flags(void) } /* Free buffers */ - if (config) - HDfree(config); - if (file_config) - HDfree(file_config); + HDfree(config); + HDfree(file_config); PASSED(); return 0; @@ -3866,10 +3817,9 @@ error: H5Fclose(fid); } H5E_END_TRY; - if (config) - HDfree(config); - if (file_config) - HDfree(file_config); + + HDfree(config); + HDfree(file_config); return 1; } /* test_updater_flags() */ @@ -3890,10 +3840,10 @@ error: static unsigned test_updater_flags_same_file_opens(void) { - hid_t fid = -1; /* File ID */ - hid_t fid2 = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list ID */ - hid_t fapl1 = -1; /* File access property list ID */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fid2 = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */ + hid_t fapl1 = H5I_INVALID_HID; /* File access property list ID */ H5F_vfd_swmr_config_t *config1 = NULL; /* Configuration for VFD SWMR */ uint64_t seq_num = 0; /* Sequence number for updater file */ uint64_t i = 0; /* Local index variable */ @@ -3999,8 +3949,7 @@ test_updater_flags_same_file_opens(void) FAIL_STACK_ERROR; /* Free buffers */ - if (config1) - HDfree(config1); + HDfree(config1); PASSED(); return 0; @@ -4014,8 +3963,9 @@ error: H5Fclose(fid2); } H5E_END_TRY; - if (config1) - HDfree(config1); + + HDfree(config1); + return 1; } /* test_updater_flags_same_file_opens() */ @@ -4174,7 +4124,7 @@ verify_ud_chk(char *md_file_path, char *ud_file_path) return 0; error: - return (-1); + return -1; } /* verify_ud_chk() */ @@ -4260,14 +4210,13 @@ md_ck_cb(char *md_file_path, uint64_t updater_seq_num) if (chk_fp && HDfclose(chk_fp) != 0) FAIL_STACK_ERROR; - if (buf) - HDfree(buf); + HDfree(buf); return 0; error: - if (buf) - HDfree(buf); + HDfree(buf); + if (md_fp) HDfclose(md_fp); if (chk_fp) @@ -4299,11 +4248,11 @@ error: static unsigned test_updater_generate_md_checksums(hbool_t file_create) { - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list ID */ - hid_t fapl = -1; /* File access property list ID */ - H5F_vfd_swmr_config_t config; /* Configuration for VFD SWMR */ - H5F_generate_md_ck_cb_t cb_info; /* Callback */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ + H5F_vfd_swmr_config_t config; /* Configuration for VFD SWMR */ + H5F_generate_md_ck_cb_t cb_info; /* Callback */ if (file_create) { TESTING("VFD SWMR updater generate checksums for metadata file with H5Fcreate"); @@ -4398,7 +4347,7 @@ error: int main(void) { - hid_t fapl = -1; /* File access property list for */ + hid_t fapl = H5I_INVALID_HID; /* File access property list for */ /* data files */ unsigned nerrors = 0; /* Cumulative error count */ char * lock_env_var = NULL; /* File locking env var pointer */ |