diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/mf.c | 92 |
1 files changed, 61 insertions, 31 deletions
@@ -159,7 +159,7 @@ static unsigned test_mf_eoa(const char *env_h5_drvr, hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -258,9 +258,12 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size) + if(new_file_size != file_size) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() } /* end if */ else { @@ -272,6 +275,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -298,7 +302,7 @@ static unsigned test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -384,8 +388,10 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) /* nothing should be changed in meta_aggr */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); - if (new_ma_addr != ma_addr) TEST_ERROR - if (new_ma_size != ma_size) TEST_ERROR + if(new_ma_addr != ma_addr) + TEST_ERROR + if(new_ma_size != ma_size) + TEST_ERROR if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -395,7 +401,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size) + if(new_file_size != file_size) TEST_ERROR PASSED() @@ -443,7 +449,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != (file_size+TEST_BLOCK_SIZE30)) + if(new_file_size != (file_size + TEST_BLOCK_SIZE30)) TEST_ERROR PASSED() @@ -487,7 +493,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != (file_size+TEST_BLOCK_SIZE30)) + if(new_file_size != (file_size + TEST_BLOCK_SIZE30)) TEST_ERROR PASSED() @@ -519,8 +525,10 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) /* nothing should be changed in meta_aggr */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); - if (new_ma_addr != ma_addr) TEST_ERROR - if (new_ma_size != ma_size) TEST_ERROR + if(new_ma_addr != ma_addr) + TEST_ERROR + if(new_ma_size != ma_size) + TEST_ERROR if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -530,9 +538,12 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != (file_size+10)) + if(new_file_size != (file_size + 10)) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() } /* end if */ else { @@ -544,6 +555,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -566,7 +578,7 @@ static unsigned test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* File size */ @@ -602,8 +614,10 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Turn off using meta/small data aggregator */ - H5Pset_meta_block_size(fapl_new, (hsize_t)0); - H5Pset_small_data_block_size(fapl_new, (hsize_t)0); + if(H5Pset_meta_block_size(fapl_new, (hsize_t)0) < 0) + FAIL_STACK_ERROR + if(H5Pset_small_data_block_size(fapl_new, (hsize_t)0) < 0) + FAIL_STACK_ERROR /* Re-open the file with meta/small data setting */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) @@ -633,7 +647,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != (file_size+TEST_BLOCK_SIZE30)) + if(new_file_size != (file_size + TEST_BLOCK_SIZE30)) TEST_ERROR /* Re-open the file */ @@ -663,7 +677,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != (file_size+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50)) + if(new_file_size != (file_size + TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50)) TEST_ERROR PASSED() @@ -696,12 +710,12 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) type = H5FD_MEM_SUPER; addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); - if (addr < (haddr_t)file_size) + if(addr < (haddr_t)file_size) TEST_ERROR /* nothing should be changed in meta_aggr */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); - if (new_ma_addr != ma_addr) + if(new_ma_addr != ma_addr) TEST_ERROR extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)(TEST_BLOCK_SIZE50)); @@ -723,9 +737,12 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size+TEST_BLOCK_SIZE30) + if(new_file_size != file_size + TEST_BLOCK_SIZE30) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() } /* end if */ else { @@ -737,6 +754,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -928,7 +946,7 @@ static unsigned test_mf_fs_start(hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -991,15 +1009,19 @@ test_mf_fs_start(hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size) + if(new_file_size != file_size) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() return(0); error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -1035,7 +1057,7 @@ static unsigned test_mf_fs_alloc_free(hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -1324,15 +1346,19 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size) + if(new_file_size != file_size) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() return(0); error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -1380,7 +1406,7 @@ static unsigned test_mf_fs_extend(hid_t fapl) { hid_t file = -1; /* File ID */ - hid_t fapl_new; /* copy of fapl */ + hid_t fapl_new = -1; /* copy of fapl */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ @@ -1870,15 +1896,19 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Verify the file is the correct size */ - if (new_file_size != file_size) + if(new_file_size != file_size) TEST_ERROR + if(H5Pclose(fapl_new) < 0) + FAIL_STACK_ERROR + PASSED() return(0); error: H5E_BEGIN_TRY { + H5Pclose(fapl_new); H5Fclose(file); } H5E_END_TRY; return(1); @@ -5845,7 +5875,6 @@ error: return(1); } /* test_mf_align_alloc6() */ - int main(void) { @@ -5901,10 +5930,9 @@ main(void) nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl); /* Tests for alignment */ - for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) { + for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) { switch(curr_test) { - case TEST_NORMAL: /* set alignment = 1024 */ if(H5Pset_alignment(new_fapl, (hsize_t)0, (hsize_t)TEST_ALIGN1024) < 0) TEST_ERROR @@ -5915,6 +5943,7 @@ main(void) TEST_ERROR break; + case TEST_NTESTS: default: TEST_ERROR; break; @@ -5930,7 +5959,7 @@ main(void) nerrors += test_mf_align_alloc6(env_h5_drvr, fapl, new_fapl); } /* end if */ - if (H5Pclose(new_fapl) < 0) + if(H5Pclose(new_fapl) < 0) FAIL_STACK_ERROR h5_cleanup(FILENAME, fapl); @@ -5938,12 +5967,13 @@ main(void) goto error; puts("All free-space manager tests for file memory passed."); - return (0); + return(0); error: puts("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl); + H5Pclose(new_fapl); } H5E_END_TRY; - return (1); + return(1); } /* main() */ |