diff options
Diffstat (limited to 'test/freespace.c')
-rw-r--r-- | test/freespace.c | 108 |
1 files changed, 59 insertions, 49 deletions
diff --git a/test/freespace.c b/test/freespace.c index 29a1dc2..82395d0 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -90,6 +90,16 @@ static herr_t TEST_sect_merging(H5FS_section_info_t *, H5FS_section_info_t *, vo static herr_t TEST_sect_can_shrink(const H5FS_section_info_t *, void *); static herr_t TEST_sect_shrinking(H5FS_section_info_t **, void *); +static unsigned test_fs_create(hid_t fapl); +static unsigned test_fs_sect_add(hid_t fapl); +static unsigned test_fs_sect_merge(hid_t fapl); +static unsigned test_fs_sect_shrink(hid_t fapl); +static unsigned test_fs_sect_find(hid_t fapl); +static unsigned test_fs_sect_change_class(hid_t fapl); +static unsigned test_fs_sect_extend(hid_t fapl); +static unsigned test_fs_sect_iterate(hid_t fapl); + + H5FS_section_class_t TEST_FSPACE_SECT_CLS[1] = {{ TEST_FSPACE_SECT_TYPE, /* Section type */ 0, /* Extra serialized size */ @@ -171,7 +181,7 @@ const H5FS_section_class_t *test_classes[] = { static void init_cparam(H5FS_create_t *); static void init_sect_node(TEST_free_section_t *, haddr_t, hsize_t, unsigned, H5FS_section_state_t); -static int check_stats(const H5FS_t *, const frspace_state_t *); +static int check_stats(const H5F_t *, const H5FS_t *, frspace_state_t *); #define NUM_SECTIONS 1000 @@ -391,12 +401,12 @@ init_sect_node(TEST_free_section_t *sect_node, haddr_t addr, hsize_t size, unsig * Verify statistics for the free-space manager */ static int -check_stats(const H5FS_t *frsp, const frspace_state_t *state) +check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state) { H5FS_stat_t frspace_stats; /* Statistics about the heap */ /* Get statistics for heap and verify they are correct */ - if(H5FS_stat_info(frsp, &frspace_stats) < 0) + if(H5FS_stat_info(f, frsp, &frspace_stats) < 0) FAIL_STACK_ERROR if(frspace_stats.tot_space != state->tot_space) { @@ -487,7 +497,7 @@ test_fs_create(hid_t fapl) TEST_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR HDmemset(&test_cparam, 0, sizeof(H5FS_create_t)); @@ -636,7 +646,7 @@ test_fs_sect_add(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR fr_meta_size = H5FS_HEADER_SIZE(f) + H5FS_SINFO_PREFIX_SIZE(f); @@ -699,7 +709,7 @@ test_fs_sect_add(hid_t fapl) state.tot_sect_count += 1; state.ghost_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR fr_meta_size = H5FS_HEADER_SIZE(f); @@ -771,7 +781,7 @@ test_fs_sect_add(hid_t fapl) /* nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ @@ -842,7 +852,7 @@ test_fs_sect_add(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node) < 0) @@ -938,7 +948,7 @@ test_fs_sect_find(hid_t fapl) HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, @@ -947,7 +957,7 @@ test_fs_sect_find(hid_t fapl) if (node_found) TEST_ERROR - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ @@ -986,7 +996,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR @@ -1006,7 +1016,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1025,7 +1035,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1044,7 +1054,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, @@ -1103,7 +1113,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1122,7 +1132,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, @@ -1176,7 +1186,7 @@ test_fs_sect_find(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, @@ -1309,7 +1319,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1327,7 +1337,7 @@ test_fs_sect_merge(hid_t fapl) /* section B & C are merged */ state.tot_space += TEST_SECT_SIZE30; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1345,7 +1355,7 @@ test_fs_sect_merge(hid_t fapl) /* section A is merged with the merged section of B & C */ state.tot_space += TEST_SECT_SIZE10; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1363,7 +1373,7 @@ test_fs_sect_merge(hid_t fapl) /* section D is merged with the merged section of A & B & C */ state.tot_space += TEST_SECT_SIZE80; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR @@ -1437,7 +1447,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1457,7 +1467,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* should not be able to find the merged section of A & B */ @@ -1531,7 +1541,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1551,7 +1561,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1569,7 +1579,7 @@ test_fs_sect_merge(hid_t fapl) /* sections B & C are merged because H5FS_CLS_MERGE_SYM is set & section class type is the same */ state.tot_space += TEST_SECT_SIZE50; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1592,7 +1602,7 @@ test_fs_sect_merge(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* should not be able to find a merged section of A, B, C & D */ @@ -1764,7 +1774,7 @@ test_fs_sect_shrink(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* section A should still be there in free-space */ @@ -1796,7 +1806,7 @@ test_fs_sect_shrink(hid_t fapl) /* should have nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* section A should not be there in free-space */ @@ -1864,7 +1874,7 @@ test_fs_sect_shrink(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1880,7 +1890,7 @@ test_fs_sect_shrink(hid_t fapl) FAIL_STACK_ERROR /* free-space should be the same since section B is shrunk */ - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* section B should not be there in free-space */ @@ -1890,7 +1900,7 @@ test_fs_sect_shrink(hid_t fapl) if (node_found) TEST_ERROR - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR @@ -1963,7 +1973,7 @@ test_fs_sect_shrink(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -1980,7 +1990,7 @@ test_fs_sect_shrink(hid_t fapl) /* section A & B are merged and then strunk, so there is nothing in free-space */ HDmemset(&state, 0, sizeof(frspace_state_t)); - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* section B should not be there in free-space */ @@ -2098,7 +2108,7 @@ test_fs_sect_change_class(hid_t fapl) state.tot_sect_count += 1; state.ghost_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -2117,7 +2127,7 @@ test_fs_sect_change_class(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if (H5FS_sect_change_class(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, @@ -2126,7 +2136,7 @@ test_fs_sect_change_class(hid_t fapl) state.serial_sect_count += 1; state.ghost_sect_count -=1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, @@ -2374,7 +2384,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -2393,7 +2403,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Extend a block by requested-size */ @@ -2404,7 +2414,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_space -= sect_node2->sect_info.size; state.tot_sect_count -= 1; state.serial_sect_count -= 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ @@ -2448,7 +2458,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -2467,7 +2477,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Extend the block by requested-size */ @@ -2475,7 +2485,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Not able to extend the block: free space info remains the same */ - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ @@ -2519,7 +2529,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -2538,7 +2548,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Extend the block by requested-size */ @@ -2547,7 +2557,7 @@ test_fs_sect_extend(hid_t fapl) /* Succeed in extending the block: total free space is decreased but other info remains the same */ state.tot_space -= 30; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ @@ -2591,7 +2601,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* @@ -2610,7 +2620,7 @@ test_fs_sect_extend(hid_t fapl) state.tot_sect_count += 1; state.serial_sect_count += 1; - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Extend the block by requested-size */ @@ -2618,7 +2628,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Not able to extend the block: free space manager info remains the same */ - if(check_stats(frsp, &state)) + if(check_stats(f, frsp, &state)) TEST_ERROR /* Close the free space manager */ |