diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-08-21 19:45:36 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2012-08-21 19:45:36 (GMT) |
commit | 18d574106c5eaeb7addd6fa6b28d5197cedce992 (patch) | |
tree | 71b66031947de38674867f1826f60a8c872eb1d8 /test | |
parent | 60d3b3091764c2ec9bede45aeacb6b2da1fa22d8 (diff) | |
parent | e53af0ed745a7bec1795681c473ba54025814fd5 (diff) | |
download | hdf5-18d574106c5eaeb7addd6fa6b28d5197cedce992.zip hdf5-18d574106c5eaeb7addd6fa6b28d5197cedce992.tar.gz hdf5-18d574106c5eaeb7addd6fa6b28d5197cedce992.tar.bz2 |
[svn-r22704] merge from trunk up to 22703.
Diffstat (limited to 'test')
-rw-r--r-- | test/accum.c | 18 | ||||
-rw-r--r-- | test/cache.c | 4 | ||||
-rw-r--r-- | test/cache_common.c | 2 | ||||
-rw-r--r-- | test/cache_tagging.c | 26 | ||||
-rw-r--r-- | test/dsets.c | 14 | ||||
-rw-r--r-- | test/dt_arith.c | 6 | ||||
-rw-r--r-- | test/dtypes.c | 35 | ||||
-rw-r--r-- | test/file_image.c | 26 | ||||
-rw-r--r-- | test/freespace.c | 2 | ||||
-rw-r--r-- | test/h5test.c | 4 | ||||
-rw-r--r-- | test/mf.c | 401 | ||||
-rw-r--r-- | test/ntypes.c | 1 | ||||
-rw-r--r-- | test/objcopy.c | 2 | ||||
-rw-r--r-- | test/tfile.c | 12 | ||||
-rw-r--r-- | test/tsohm.c | 8 | ||||
-rw-r--r-- | test/tunicode.c | 2 |
16 files changed, 380 insertions, 183 deletions
diff --git a/test/accum.c b/test/accum.c index 11d44d4..7f65151 100644 --- a/test/accum.c +++ b/test/accum.c @@ -1793,15 +1793,17 @@ accum_printf(void) printf("=====================================================\n"); } else { printf("=====================================================\n"); - printf(" accumulator allocated size == %lu\n", (unsigned long)accum->alloc_size); - printf(" accumulated data size == %lu\n", (unsigned long)accum->size); - printf(" accumulator dirty? == %d\n", accum->dirty); + printf(" accumulator allocated size == %zu\n", accum->alloc_size); + printf(" accumulated data size == %zu\n", accum->size); + HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty); printf("=====================================================\n"); - printf(" start of accumulated data, loc = %llu\n", accum->loc); - if (accum->dirty) printf(" start of dirty region, loc = %llu\n", accum->loc + accum->dirty_off); - if (accum->dirty) printf(" end of dirty region, loc = %llu\n", accum->loc + accum->dirty_off + accum->dirty_len); - printf(" end of accumulated data, loc = %llu\n", accum->loc + accum->size); - printf(" end of accumulator allocation, loc = %llu\n", accum->loc + accum->alloc_size); + HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc); + if(accum->dirty) { + HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off)); + HDfprintf(stdout, " end of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off + accum->dirty_len)); + } /* end if */ + HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size)); + HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", (haddr_t)(accum->loc + accum->alloc_size)); printf("=====================================================\n"); } printf("\n\n"); diff --git a/test/cache.c b/test/cache.c index 0e6cb42..ba51a38 100644 --- a/test/cache.c +++ b/test/cache.c @@ -33532,6 +33532,7 @@ check_notify_cb(void) reset_entries(); file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024)); + if ( !file_ptr ) CACHE_ERROR("setup_cache returned NULL") cache_ptr = file_ptr->shared->cache; base_addr = entries[entry_type]; @@ -33675,8 +33676,7 @@ check_notify_cb(void) } /* end for */ done: - if(file_ptr) - takedown_cache(file_ptr, FALSE, FALSE); + takedown_cache(file_ptr, FALSE, FALSE); if ( pass ) PASSED() diff --git a/test/cache_common.c b/test/cache_common.c index e6dd020..7b26714 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -2031,7 +2031,7 @@ verify_entry_status(H5C_t * cache_ptr, int num_entries, struct expected_entry_status expected[]) { - static char msg[128]; + static char msg[256]; int i; i = 0; diff --git a/test/cache_tagging.c b/test/cache_tagging.c index a133daa..e4eddf2 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -740,7 +740,7 @@ check_group_creation_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file outout */ - haddr_t root_tag; /* Root Group Tag */ + haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */ haddr_t g_tag; /* Group Tag */ haddr_t sbe_tag; /* Sblock Extension Tag */ @@ -1249,7 +1249,7 @@ check_group_open_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file output */ - haddr_t root_tag; + haddr_t root_tag = HADDR_UNDEF; haddr_t sbe_tag; haddr_t g_tag; @@ -1633,6 +1633,8 @@ error: * March 3, 2010 * * Modifications: + * Vailin Choi; July 2012 + * Add verify_tag() calls because H5FD_FLMAP_DICHOTOMY is now the default free-list mapping. * *------------------------------------------------------------------------- */ @@ -1756,7 +1758,12 @@ check_attribute_rename_tags(hid_t fcpl, int type) /* verify shared header message stored as a list */ if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; - /* verify free space header */ + /* + * 3 calls to verify_tag() for verifying free space: + * one freespace header tag for H5FD_MEM_DRAW manager, + * one freespace header tag for H5FD_MEM_SUPER manager + */ + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; /* verify btree header and leaf node belonging to group */ @@ -1799,6 +1806,8 @@ error: * March 3, 2010 * * Modifications: + * Vailin Choi; July 2012 + * Add verify_tag() call because H5FD_FLMAP_DICHOTOMY is now the default free-list mapping. * *------------------------------------------------------------------------- */ @@ -1901,7 +1910,12 @@ check_attribute_delete_tags(hid_t fcpl, int type) /* verify shared header message master table */ if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; - /* verify free space */ + /* + * 2 calls to verify_tag() for verifying free space: + * one freespace header tag for H5FD_MEM_DRAW manager, + * one freespace header tag for H5FD_MEM_SUPER manager + */ + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; } /* end if */ @@ -3056,7 +3070,7 @@ check_object_info_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file output */ - haddr_t root_tag; + haddr_t root_tag = HADDR_UNDEF; haddr_t sbe_tag; haddr_t g_tag; H5O_info_t oinfo; /* Object info struct */ @@ -3170,7 +3184,7 @@ check_object_copy_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file output */ - haddr_t root_tag; + haddr_t root_tag = HADDR_UNDEF; haddr_t sbe_tag; haddr_t g_tag; haddr_t copy_tag; diff --git a/test/dsets.c b/test/dsets.c index ee341c9..3b081da 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -999,8 +999,8 @@ test_conv_buffer(hid_t fid) herr_t status = -1; int j, k, l; - CmpField *cf; - CmpFieldR *cfrR; + CmpField *cf = NULL; + CmpFieldR *cfrR = NULL; hid_t dataset = -1; /* dataset ID */ hid_t space = -1; /* data space ID */ @@ -1014,7 +1014,7 @@ test_conv_buffer(hid_t fid) TESTING("data type conversion buffer size"); - cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField)); + if ((cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField))) == 0) goto error; /* Populate the data members */ for(j = 0; j < DIM1; j++) @@ -1063,7 +1063,7 @@ test_conv_buffer(hid_t fid) if(H5Tinsert(ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error; /* Read should succeed since library will set conversion buffer big enough */ - cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR)); + if ((cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR))) == 0) goto error; if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfrR) < 0) goto error; /* Read should fail since conversion buffer isn't big enough */ @@ -1100,10 +1100,8 @@ test_conv_buffer(hid_t fid) if(H5Tclose(arr_type5) < 0) goto error; if(H5Dclose(dataset) < 0) goto error; - if(cf) - HDfree(cf); - if(cfrR) - HDfree(cfrR); + HDfree(cf); + HDfree(cfrR); puts(" PASSED"); return(0); diff --git a/test/dt_arith.c b/test/dt_arith.c index 0001755..096b83e 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -1105,9 +1105,9 @@ test_derived_flt(void) } fails_this_test = 0; - if(buf) free(buf); - if(saved_buf) free(saved_buf); - if(aligned) free(aligned); + free(buf); + free(saved_buf); + free(aligned); buf = NULL; saved_buf = NULL; aligned = NULL; diff --git a/test/dtypes.c b/test/dtypes.c index 3db9bf8..117a21a 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1127,10 +1127,8 @@ test_compound_5(void) } /* Free memory buffers */ - if(buf) - HDfree(buf); - if(bkg) - HDfree(bkg); + HDfree(buf); + HDfree(bkg); return retval; } @@ -4698,11 +4696,12 @@ test_bitfield_funcs(void) { hid_t type=-1, ntype=-1, super=-1; int size; - char* tag; + char* tag=0; H5T_pad_t inpad; H5T_cset_t cset; H5T_str_t strpad; herr_t ret; + int retval=-1; TESTING("some type functions for bitfield"); @@ -4786,16 +4785,18 @@ test_bitfield_funcs(void) goto error; } /* end if */ - H5Tclose(type); - H5Tclose(ntype); - PASSED(); - reset_hdf5(); - return 0; + retval = 0; error: + + if (retval == -1) retval = 1; + + HDfree(tag); + H5Tclose(ntype); H5Tclose(type); + if (retval == 0) PASSED(); reset_hdf5(); - return 1; + return retval; } @@ -7049,11 +7050,13 @@ error: */ int test_utf_ascii_conv(void) { - hid_t fid; - hid_t did; - hid_t utf8_vtid, ascii_vtid; - hid_t utf8_tid, ascii_tid; - hid_t sid; + hid_t fid = -1; + hid_t did = -1; + hid_t utf8_vtid = -1; + hid_t ascii_vtid = -1; + hid_t utf8_tid = -1; + hid_t ascii_tid = -1; + hid_t sid = -1; const char *utf8_w = "foo!"; char *ascii_r = NULL; const char *ascii_w = "bar!"; diff --git a/test/file_image.c b/test/file_image.c index 73c901e..9d7a48c 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -86,15 +86,16 @@ typedef struct { static int test_properties(void) { - hid_t fapl_1; - hid_t fapl_2; - char *buffer; + hid_t fapl_1 = -1; + hid_t fapl_2 = -1; + char *buffer = 0; int count = 10; - void *temp; - char *temp2; + void *temp = 0; + char *temp2 = 0; int i; size_t size; size_t temp_size; + int retval = 1; TESTING("File image property list functions"); @@ -145,18 +146,21 @@ test_properties(void) VERIFY(temp2 != temp, "Retrieved buffer is the same as previously retrieved buffer"); VERIFY(0 == HDmemcmp(temp2, buffer, size),"Buffers contain different data"); + retval = 0; + +error: + /* Close everything */ - if(H5Pclose(fapl_1) < 0) FAIL_STACK_ERROR - if(H5Pclose(fapl_2) < 0) FAIL_STACK_ERROR + if(H5Pclose(fapl_1) < 0) retval = 1; + if(H5Pclose(fapl_2) < 0) retval = 1; HDfree(buffer); HDfree(temp); HDfree(temp2); - PASSED(); - return 0; + if(retval == 0) + PASSED(); -error: - return 1; + return retval; } /* end test_properties() */ /****************************************************************************** diff --git a/test/freespace.c b/test/freespace.c index 3beec76..d9949b5 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -1522,8 +1522,10 @@ test_fs_sect_merge(hid_t fapl) /* Free the section node(s) */ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0) TEST_ERROR + sect_node1 = NULL; if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0) TEST_ERROR + sect_node2 = NULL; /* Close the free space manager */ if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) diff --git a/test/h5test.c b/test/h5test.c index 7faba81..ea30fad 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -735,6 +735,8 @@ h5_set_info_object(void) valp = envp = next = HDstrdup(envp); + if (!valp) return 0; + /* create an INFO object if not created yet */ if (h5_io_info_g == MPI_INFO_NULL) MPI_Info_create(&h5_io_info_g); @@ -761,6 +763,8 @@ h5_set_info_object(void) while (*namep && (*namep == ' ' || *namep == '\t')) namep++; + if (!*namep) continue; /* was all white space, so move to next k/v pair */ + /* eat up any ending white spaces */ endp = &namep[strlen(namep) - 1]; @@ -127,12 +127,19 @@ static unsigned test_mf_fs_drivers(hid_t fapl); /* * Verify statistics for the free-space manager + * + * Modifications: + * Vailin Choi; July 2012 + * To ensure "f" and "frsp" are valid pointers */ static int check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state) { H5FS_stat_t frspace_stats; /* Statistics about the heap */ + HDassert(f); + HDassert(frsp); + /* Get statistics for free-space and verify they are correct */ if(H5FS_stat_info(f, frsp, &frspace_stats) < 0) FAIL_STACK_ERROR @@ -1071,6 +1078,10 @@ error: * The block is allocated from file allocation * Deallocate the block which will be returned to free-space manager * (the space is shrunk and freed since it is at end of file) + * + * Modifications: + * Vailin Choi; July 2012 + * Initialize the new field "allow_eoa_shrink_only" for user data. */ static unsigned test_mf_fs_alloc_free(hid_t fapl) @@ -1136,6 +1147,7 @@ test_mf_fs_alloc_free(hid_t fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -1222,6 +1234,7 @@ test_mf_fs_alloc_free(hid_t fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -1306,6 +1319,7 @@ test_mf_fs_alloc_free(hid_t fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -1421,6 +1435,10 @@ error: * Try to extend the allocated block by 50 from the free-space_manager: * Fail: section A does not adjoin section B (70+20 != address of section B) even though * the requested-size (50) equal to size of section B (50) + * + * Modifications: + * Vailin Choi; July 2012 + * Initialize the new field "allow_eoa_shrink_only" for user data. */ static unsigned test_mf_fs_extend(hid_t fapl) @@ -1487,6 +1505,7 @@ test_mf_fs_extend(hid_t fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -1604,6 +1623,7 @@ test_mf_fs_extend(hid_t fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -1716,6 +1736,7 @@ test_mf_fs_extend(hid_t fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -1828,6 +1849,7 @@ test_mf_fs_extend(hid_t fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* Add section A of size=20 to free-space */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -1957,6 +1979,10 @@ error: * which will absorb meta_aggr to the section: * section size + remaining size of aggregator is > aggr->alloc_size, * section is allowed to absorb an aggregator (allow_sect_absorb is true) + * + * Modifications: + * Vailin Choi; July 2012 + * Initialize the new field "allow_eoa_shrink_only" for user data. */ static unsigned test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) @@ -2020,6 +2046,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* When adding, meta_aggr is absorbed onto the beginning of the section */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -2092,6 +2119,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* When adding, meta_aggr is absorbed onto the end of the section */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -3133,7 +3161,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) /* sdata_aggr info is reset to 0 */ H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); - if (sdata_addr != 0) TEST_ERROR + if (sdata_addr != HADDR_UNDEF) TEST_ERROR if (sdata_size != 0) TEST_ERROR /* Verify that meta_aggr's unused space of 1968 is freed to free-space */ @@ -3481,15 +3509,18 @@ error: * * Test 2: H5MF_alloc() block A from meta_aggr * H5MF_alloc() block B from sdata_aggr - * H5MF_try_shrink() block B should merge it onto the end of meta_aggr - * because H5F_FS_MERGE_METADATA|H5F_FS_MERGE_RAWDATA is on for - * sec2 driver's FLMAP_SINGLE + * H5MF_try_shrink() block B should merge it back to the end of sdata_aggr + * because sec2 driver is FLMAP_DICHOTOMY by default * * Test 3: H5MF_alloc() block A from meta_aggr * H5MF_alloc() block B from meta_aggr * H5MF_alloc() block C from meta_aggr * H5MF_try_shrink() block B should fail since it does not adjoin the * beginning nor the end of meta_aggr + * + * Modifications: + * Vailin Choi; July 2012 + * Changes due to the switch to H5FD_FLMAP_DICHOTOMY */ static unsigned test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) @@ -3501,7 +3532,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) H5FD_mem_t type, stype; haddr_t addr1, addr2, addr3, saddr1; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; - haddr_t sdata_addr=HADDR_UNDEF, new_sdata_addr=HADDR_UNDEF; + haddr_t new_sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0; hsize_t sdata_size=0, new_sdata_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -3593,20 +3624,20 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) stype = H5FD_MEM_DRAW; saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); + H5MF_aggr_query(f, &(f->shared->sdata_aggr), NULL, &sdata_size); /* should succeed */ if(H5MF_try_shrink(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0) TEST_ERROR H5MF_aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size); - if (new_sdata_addr != sdata_addr) TEST_ERROR - if (new_sdata_size != sdata_size) TEST_ERROR + if (new_sdata_addr != saddr1) TEST_ERROR + if (new_sdata_size != sdata_size + TEST_BLOCK_SIZE50) TEST_ERROR /* meta_aggr info should be updated because the block is absorbed into the meta_aggr */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (new_ma_addr != ma_addr) TEST_ERROR - if (new_ma_size != (ma_size+TEST_BLOCK_SIZE50)) TEST_ERROR + if (new_ma_size != (ma_size)) TEST_ERROR H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); @@ -4004,6 +4035,10 @@ error: * Allocate a block of size=40 * The free-space manager is unable to fulfill the request * The block is allocated from file allocation and should be aligned + * + * Modifications: + * Vailin Choi; July 2012 + * Initialize the new field "allow_eoa_shrink_only" for user data. */ static unsigned test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) @@ -4063,6 +4098,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -4132,6 +4168,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -4221,6 +4258,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; + udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) @@ -4602,8 +4640,7 @@ error: * request-size < aggr->alloc_size * fragment size > (aggr->alloc_size - request-size) * Result: - * A block of aggr->alloc_size + (fragment size - (aggr->alloc_size - request-size)) - * is extended from file allocation for the aggregator + * A block of (fragment size + request-size) is extended from file allocation for the aggregator * The second block of 50 is allocated from the aggregator and should be aligned * Fragment from alignment of aggregator allocation is freed to free-space:[4126, 4066] * There is space of 2018 left in meta_aggr @@ -4628,12 +4665,14 @@ error: * Result: * A block of meta_aggr->alloc_size is allocated from file allocation for the aggregator * Fragment from alignment of file allocation is freed to free-space:[14336, 2048] - * Since this fragment adjoins sdata_aggr and fulfills "absorb" condition, - * the space left in sdata_aggr is absorbed into the fragment and freed to free-space: [12318, 2018] - * other_aggr is reset to 0 + * other_aggr is [12318, 2018] * The third block of 80 is allocated from the aggregator and should be aligned * There is space of 1968 left in meta_aggr * EOA is at 18432 + * + * Modifications: + * Vailin Choi; July 2012 + * Changes due to the switch to H5FD_FLMAP_DICHOTOMY */ static unsigned test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) @@ -4644,7 +4683,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) h5_stat_size_t file_size; /* File size */ H5FD_mem_t type, stype; haddr_t addr1, addr2, addr3, saddr1; - frspace_state_t state; + frspace_state_t state[H5FD_MEM_NTYPES]; haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, sdata_size=0, mis_align=0; hsize_t alignment=0, tmp=0; @@ -4697,11 +4736,11 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if (addr1 % alignment) TEST_ERROR /* fragment for alignment of block 30 is freed to free-space */ - HDmemset(&state, 0, sizeof(frspace_state_t)); + HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES); if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -4721,9 +4760,9 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 50 is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -4754,9 +4793,9 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 30 for sdata_aggr is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[stype].tot_space += mis_align; + state[stype].tot_sect_count += 1; + state[stype].serial_sect_count += 1; } /* Verify that the allocated block is aligned */ @@ -4773,12 +4812,13 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * For alignment = 1024, alloc_size = 2048: * fragment for unused space in meta_aggr is freed to free-space * For alignment = 4096, alloc_size = 2048: - * fragment from alignment of file allocation absorbs sdata_aggr's remaining space + * fragment from alignment of ma_addr is freed + * block 30 is allocated from ma_addr */ mis_align = 0; if ((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment))) mis_align = alignment - tmp; - else if ((alignment == TEST_ALIGN4096) && (tmp = (sdata_addr % alignment))) + else if ((alignment == TEST_ALIGN4096) && (tmp = ((sdata_addr + sdata_size) % alignment))) mis_align = alignment - tmp; /* Allocate a block of 80 from meta_aggr */ @@ -4789,9 +4829,9 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 80 is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -4800,8 +4840,15 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Verify total size of free space after all the allocations */ - if(check_stats(f, f->shared->fs_man[type], &state)) - TEST_ERROR + if(f->shared->fs_man[type]) { + if(check_stats(f, f->shared->fs_man[type], &(state[type]))) + TEST_ERROR + } + + if(f->shared->fs_man[stype]) { + if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) + TEST_ERROR + } H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); @@ -4961,6 +5008,11 @@ error: * The meta_aggr is updated to point to the new space * The block of 1034 is allocated from the new block and should be aligned * There is space of 1014 left in meta_aggr + * + * Modifications: + * Vailin Choi; July 2012 + * Changes due to the switch to H5FD_FLMAP_DICHOTOMY + * */ static unsigned test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) @@ -4972,7 +5024,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) H5FD_mem_t type, stype; haddr_t addr1, addr2, addr3; haddr_t saddr1, saddr2, saddr3; - frspace_state_t state; + frspace_state_t state[H5FD_MEM_NTYPES]; haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, sdata_size=0, mis_align=0; hsize_t alignment=0, tmp=0; @@ -5026,11 +5078,11 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if (addr1 % alignment) TEST_ERROR /* fragment for alignment of block 30 is freed to free-space */ - HDmemset(&state, 0, sizeof(frspace_state_t)); + HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES); if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -5050,9 +5102,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 50 is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -5085,9 +5137,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 30 for sdata_aggr is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[stype].tot_space += mis_align; + state[stype].tot_sect_count += 1; + state[stype].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); @@ -5106,9 +5158,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 50 for sdata_aggr is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[stype].tot_space += mis_align; + state[stype].tot_sect_count += 1; + state[stype].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); @@ -5127,9 +5179,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 80 for sdata_aggr is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[stype].tot_space += mis_align; + state[stype].tot_sect_count += 1; + state[stype].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); @@ -5149,9 +5201,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 1034 for meta_aggr is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } /* calculate unused space in meta_aggr that is freed to free-space after block 1034 */ @@ -5161,9 +5213,9 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for unused space in meta_aggr after block 1034 is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -5172,8 +5224,15 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Verify total size of free space after all allocations */ - if(check_stats(f, f->shared->fs_man[type], &state)) - TEST_ERROR + if(f->shared->fs_man[type]) { + if(check_stats(f, f->shared->fs_man[type], &(state[type]))) + TEST_ERROR + } + + if(f->shared->fs_man[stype]) { + if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) + TEST_ERROR + } if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -5377,8 +5436,10 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if (addr3 % alignment) TEST_ERROR /* Verify total size of free space after all allocations */ - if(check_stats(f, f->shared->fs_man[type], &state)) - TEST_ERROR + if(f->shared->fs_man[type]) { + if(check_stats(f, f->shared->fs_man[type], &state)) + TEST_ERROR + } if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -5464,6 +5525,10 @@ error: * sdata_aggr is reset to 0 * EOA is 14346 * meta_aggr and sdata_aggr are all 0 + * + * Modifications: + * Vailin Choi; July 2012 + * Changes due to the switch to H5FD_FLMAP_DICHOTOMY */ static unsigned test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) @@ -5474,7 +5539,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) h5_stat_size_t file_size; H5FD_mem_t type, stype; haddr_t addr1, addr2, saddr1; - frspace_state_t state; + frspace_state_t state[H5FD_MEM_NTYPES]; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; haddr_t sdata_addr=HADDR_UNDEF, new_sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0, sdata_size=0, new_sdata_size=0; @@ -5533,18 +5598,16 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if ((addr1 + TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR /* fragment for alignment of block 30 is freed to free-space */ - HDmemset(&state, 0, sizeof(frspace_state_t)); + HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES); if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } /* calculate fragment for alignment of block 30 from sdata_aggr */ mis_align = 0; - if ((alignment == TEST_ALIGN1024) && (tmp = (ma_addr + ma_size) % alignment)) - mis_align = alignment - tmp; - else if ((alignment == TEST_ALIGN4096) && (tmp = (ma_addr % alignment))) + if ((tmp = (ma_addr + ma_size) % alignment)) mis_align = alignment - tmp; /* Allocate a block of 30 from sdata_aggr */ @@ -5556,9 +5619,9 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment of alignment for block 30 in sdata_aggr is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[stype].tot_space += mis_align; + state[stype].tot_sect_count += 1; + state[stype].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); @@ -5566,9 +5629,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* calculate fragment for alignment of block 2058 from meta_aggr */ mis_align = 0; - if ((alignment == TEST_ALIGN1024) && (tmp = (sdata_addr + sdata_size) % alignment)) - mis_align = alignment - tmp; - else if ((alignment == TEST_ALIGN4096) && (tmp = (sdata_addr % alignment))) + if ((tmp = (sdata_addr + sdata_size) % alignment)) mis_align = alignment - tmp; /* Allocate a block of 2058 from meta_aggr */ @@ -5579,27 +5640,30 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 2058 is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } /* Verify total size of free space after all allocations */ - if(check_stats(f, f->shared->fs_man[type], &state)) - TEST_ERROR + if(f->shared->fs_man[type]) { + if(check_stats(f, f->shared->fs_man[type], &(state[type]))) + TEST_ERROR + } + + if(f->shared->fs_man[stype]) { + if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) + TEST_ERROR + } /* nothing is changed in meta_aggr */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); - if (alignment == TEST_ALIGN1024 && (new_ma_addr != ma_addr || new_ma_size != ma_size)) - TEST_ERROR - else if (alignment == TEST_ALIGN4096 && (new_ma_addr != 0 || new_ma_size != 0)) + if (new_ma_addr != ma_addr || new_ma_size != ma_size) TEST_ERROR /* nothing is changed in sdata_aggr */ H5MF_aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size); - if (alignment == TEST_ALIGN1024 && (new_sdata_addr != sdata_addr || new_sdata_size != sdata_size)) - TEST_ERROR - else if (alignment == TEST_ALIGN4096 && ((new_sdata_addr != 0 || new_sdata_size != 0))) + if (new_sdata_addr != sdata_addr || new_sdata_size != sdata_size) TEST_ERROR if(H5Fclose(file) < 0) @@ -5691,21 +5755,16 @@ error: * Result: * A block of sdata_aggr->alloc_size is allocated from file allocation * Fragment from alignment of file allocation is freed to free-space: [6144, 2048] - * This fragment adjoins meta_aggr and fulfills "absorb" condition, - * the remaining space left in meta_aggr is absorbed into the fragment and - * freed to free-space:[4126, 2018] - * meta_aggr is reset to 0 * The first block of 30 is allocated from the aggregator and should be aligned * There is space of 2018 left in sdata_aggr - * EOA is 5120 + * EOA is 10240 * * Allocate second block (50) from sdata_aggr: - * (request-size+fragment size) is <= sdata_aggr->size + * (request-size+fragment size) is > sdata_aggr->size * request-size < sdata_aggr->alloc_size * fragment size > (sdata_aggr->alloc_size - request-size) * Result: - * A block of sdata_aggr->alloc_size + (fragment size - (sdata_aggr->alloc_size - request-size)) - * is extended from file allocation for the aggregator + * A block of (fragment size + request-size) is extended from file allocation for the aggregator * The second block of 50 is allocated from sdata_aggr and should be aligned * Fragment from alignment of aggregator allocation is freed to free-space:[8222, 4066] * There is space of 2018 left in sdata_aggr @@ -5716,8 +5775,7 @@ error: * request-size < sdata_aggr->alloc_size * fragment size > (sdata_aggr->alloc_size - request-size) * Result: - * A block of sdata_aggr->alloc_size+(fragment size-(sdata_aggr->alloc_size-request-size)) - * is extended from file allocation for sdata_aggr + * A block of (fragment size + request-size) is extended from file allocation for sdata_aggr * The third block of 80 is allocated from sdata_aggr and should be aligned * Fragment from alignment of aggregator allocation is freed to free-space:[12338, 4046] * There is space of 2018 left in sdata_aggr @@ -5734,6 +5792,10 @@ error: * Fragment from alignment of file allocation is freed to free-space:[16464, 4016] * EOA is at 22538 * meta_aggr is unchanged + * + * Modifications: + * Vailin Choi; July 2012 + * Changes due to the switch to H5FD_FLMAP_DICHOTOMY */ static unsigned test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) @@ -5745,7 +5807,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) H5FD_mem_t type, stype; haddr_t addr1, addr2; haddr_t saddr1, saddr2, saddr3; - frspace_state_t state; + frspace_state_t state[H5FD_MEM_NTYPES]; haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; hsize_t ma_size=0, new_ma_size=0, sdata_size=0; hsize_t alignment=0, mis_align=0, tmp=0; @@ -5798,11 +5860,11 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if (addr1 % alignment) TEST_ERROR /* fragment for alignment of block 30 in meta_aggr is freed to free-space */ - HDmemset(&state, 0, sizeof(frspace_state_t)); + HDmemset(&state, 0, sizeof(frspace_state_t) * H5FD_MEM_NTYPES); if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -5811,9 +5873,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* calculate fragment for alignment of block 30 in sdata_aggr */ mis_align = 0; - if ((alignment == TEST_ALIGN1024) && (tmp = (ma_addr + ma_size) % alignment)) - mis_align = alignment - tmp; - else if ((alignment == TEST_ALIGN4096) && (tmp = (ma_addr % alignment))) + if ((tmp = (ma_addr + ma_size) % alignment)) mis_align = alignment - tmp; /* Allocate a block of 30 from sdata_aggr */ @@ -5825,9 +5885,9 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 30 in sdata_aggr is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[stype].tot_space += mis_align; + state[stype].tot_sect_count += 1; + state[stype].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); @@ -5846,9 +5906,9 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 50 in sdata_aggr is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[stype].tot_space += mis_align; + state[stype].tot_sect_count += 1; + state[stype].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); @@ -5867,9 +5927,9 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 80 in sdata_aggr is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[stype].tot_space += mis_align; + state[stype].tot_sect_count += 1; + state[stype].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); @@ -5889,24 +5949,30 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* fragment for alignment of block 2058 is freed to free-space */ if (mis_align) { - state.tot_space += mis_align; - state.tot_sect_count += 1; - state.serial_sect_count += 1; + state[type].tot_space += mis_align; + state[type].tot_sect_count += 1; + state[type].serial_sect_count += 1; } H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); - if (alignment == TEST_ALIGN1024 && (new_ma_addr != ma_addr || new_ma_size != ma_size)) - TEST_ERROR - else if (alignment == TEST_ALIGN4096 && (new_ma_addr != 0 || new_ma_size != 0)) + if (new_ma_addr != ma_addr && new_ma_size != ma_size) TEST_ERROR - if (sdata_addr != 0 || sdata_size != 0) + if (sdata_addr != HADDR_UNDEF || sdata_size != 0) TEST_ERROR - if(check_stats(f, f->shared->fs_man[type], &state)) - TEST_ERROR + if(f->shared->fs_man[type]) { + if(check_stats(f, f->shared->fs_man[type], &(state[type]))) + TEST_ERROR + } + + + if(f->shared->fs_man[stype]) { + if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) + TEST_ERROR + } if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -7282,6 +7348,100 @@ error: return(1); } /* test_filespace_drivers() */ +/* + * To verify that file space is allocated from the corresponding free-space manager + * because H5FD_FLMAP_DICHOTOMY is used as the default free-list mapping. + * + * (1) Allocate the first block (size 30) of type H5FD_MEM_SUPER + * (2) Allocate the second block (size 50) of type H5FD_MEM_SUPER + * + * (3) Allocate the first block (size 30) of type H5FD_MEM_DRAW + * + * (4) Free the first block (size 30) of type H5FD_MEM_SUPER + * + * (5) Allocate the second block (size 30) of type H5FD_MEM_DRAW + * (6) Verify that this second block is not the freed block from (3) + * + * (7) Allocate the second block (size 30) of type H5FD_MEM_DRAW + * (8) Free the first block (size 30) of type H5FD_MEM_DRAW + * + * (9) Allocate the third block (size 30) of type H5FD_MEM_SUPER + * (10) Verify that this third block is not freed block from (8) + */ +static unsigned +test_dichotomy(const char *env_h5_drvr, hid_t fapl) +{ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5FD_mem_t type, stype; + haddr_t addr1, addr2, addr3, saddr1, saddr2; + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + + TESTING("Allocation from raw or metadata free-space manager"); + + /* Skip test when using VFDs that don't use the metadata aggregator */ + contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); + if(contig_addr_vfd) { + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + + /* Create the file to work on */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + + /* Allocate the first block of type H5FD_MEM_SUPER */ + type = H5FD_MEM_SUPER; + addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + + /* Allocate the second block of type H5FD_MEM_SUPER */ + addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + + /* Allocate the first block of type H5FD_MEM_DRAW */ + stype = H5FD_MEM_DRAW; + saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + + /* Free the first block of type H5FD_MEM_SUPER */ + H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); + + /* Allocate the second block of type H5FD_MEM_DRAW */ + saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + + /* Verify that saddr1 is not addr1 */ + if(saddr2 == addr1) TEST_ERROR + + /* Free the first block of type H5FD_MEM_DRAW */ + H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30); + + /* Allocate the third block of type H5FD_MEM_SUPER */ + addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + + /* Verify that addr3 is not saddr1 */ + if(addr3 == saddr1) TEST_ERROR + + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED() + } /* end if */ + else { + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); + } /* end else */ + + return(0); + +error: + H5E_BEGIN_TRY { + H5Fclose(file); + } H5E_END_TRY; + return(1); +} /* test_dichotomy() */ + int main(void) { @@ -7324,6 +7484,7 @@ main(void) nerrors += test_mf_fs_alloc_free(fapl); nerrors += test_mf_fs_extend(fapl); nerrors += test_mf_fs_absorb(env_h5_drvr, fapl); + nerrors += test_dichotomy(env_h5_drvr, new_fapl); /* interaction with meta/sdata aggregator */ nerrors += test_mf_aggr_alloc1(env_h5_drvr, fapl); diff --git a/test/ntypes.c b/test/ntypes.c index 165d21b..0af3a3f 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -1776,6 +1776,7 @@ test_vl_dtype(hid_t file) } /* end for */ HDfree(tmp); + tmp = NULL; } /* end for */ } /* end for */ diff --git a/test/objcopy.c b/test/objcopy.c index 6b56b66..d7da8f3 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -10343,7 +10343,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t did = -1; /* Dataset ID */ hid_t exp_did = -1; /* Dataset ID */ hid_t tid_short = -1; /* Datatype ID */ - hid_t exp_tid; /* Expected datatype ID */ + hid_t exp_tid = -1; /* Expected datatype ID */ hid_t ocpypl_id = -1; /* Object copy plist ID */ unsigned int i; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ diff --git a/test/tfile.c b/test/tfile.c index 1cfcdbd..74d7442 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1337,6 +1337,11 @@ test_file_perm2(void) ** This test checks the free space available in a file in various ** situations. ** +** Modifications: +** Vailin Choi; July 2012 +** Remove datasets in reverse order so that all file spaces are shrunk. +** (A change due to H5FD_FLMAP_DICHOTOMY.) +** *****************************************************************/ static void test_file_freespace(void) @@ -1348,6 +1353,7 @@ test_file_freespace(void) hid_t dspace; /* Dataspace ID */ hid_t dset; /* Dataset ID */ hid_t dcpl; /* Dataset creation property list */ + int k; /* Local index variable */ unsigned u; /* Local index variable */ char name[32]; /* Dataset name */ herr_t ret; @@ -1407,11 +1413,11 @@ test_file_freespace(void) /* Check that there is the right amount of free space in the file */ free_space = H5Fget_freespace(file); CHECK(free_space, FAIL, "H5Fget_freespace"); - VERIFY(free_space, 2008, "H5Fget_freespace"); + VERIFY(free_space, 2360, "H5Fget_freespace"); /* Delete datasets in file */ - for(u = 0; u < 10; u++) { - sprintf(name, "Dataset %u", u); + for(k = 9; k >= 0; k--) { + sprintf(name, "Dataset %u", (unsigned)k); ret = H5Ldelete(file, name, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } /* end for */ diff --git a/test/tsohm.c b/test/tsohm.c index 62154b1..fddb552 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -2463,11 +2463,11 @@ static void test_sohm_size2(int close_reopen) * this happens because it's hard to predict exactly how much space this * will take. */ - if((mult_index_med.attrs2 - mult_index_med.attrs1) != - (list_index_med.attrs2 - list_index_med.attrs1)) + if((mult_index_med.attrs2 - mult_index_med.attrs1) > + (list_index_med.attrs2 - list_index_med.attrs1) * OVERHEAD_ALLOWED) VERIFY(0, 1, "h5_get_file_size"); - if((mult_index_btree.attrs2 - mult_index_btree.attrs1) != - (btree_index.attrs2 - btree_index.attrs1)) + if((mult_index_btree.attrs2 - mult_index_btree.attrs1) > + (btree_index.attrs2 - btree_index.attrs1) * OVERHEAD_ALLOWED) VERIFY(0, 1, "h5_get_file_size"); /* The final file size for both of the multiple index files should be diff --git a/test/tunicode.c b/test/tunicode.c index 3b949e9..0386352 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -161,6 +161,7 @@ void test_strpad(hid_t UNUSED fid, const char *string) /* Create a src_type that holds the UTF-8 string and its final NULL */ big_len = length + 1; /* +1 byte for final NULL */ + HDassert((2*big_len)<=sizeof(cmpbuf)); src_type = mkstr(big_len, H5T_STR_NULLTERM); CHECK(src_type, FAIL, "mkstr"); /* Create a dst_type that holds half of the UTF-8 string and a final @@ -224,6 +225,7 @@ void test_strpad(hid_t UNUSED fid, const char *string) /* Create a src_type that holds the UTF-8 string */ big_len = length; + HDassert((2*big_len)<=sizeof(cmpbuf)); src_type = mkstr(big_len, H5T_STR_NULLPAD); CHECK(src_type, FAIL, "mkstr"); /* Create a dst_type that holds half of the UTF-8 string */ |