Merge pull request #2471 in HDFFV/hdf5 from alloc_stat_tests to develop

* commit '0eb562bc201a38f9b4a82e954bfc63daa6838d45':
  Refactor to reduce verbosity.
This commit is contained in:
Quincey Koziol 2020-03-28 15:48:55 -05:00
commit e9e3e2f1d6

View File

@ -5700,7 +5700,17 @@ test_misc35(void)
{
hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
hsize_t dims[] = {MISC35_SPACE_DIM1, MISC35_SPACE_DIM2, MISC35_SPACE_DIM3}; /* Dataspace dims */
hsize_t coord[MISC35_NPOINTS][MISC35_SPACE_RANK]; /* Coordinates for point selection */
hsize_t coord[MISC35_NPOINTS][MISC35_SPACE_RANK] = /* Coordinates for point selection */
{{0,10, 5},
{1, 2, 7},
{2, 4, 9},
{0, 6,11},
{1, 8,13},
{2,12, 0},
{0,14, 2},
{1, 0, 4},
{2, 1, 6},
{0, 3, 8}};
size_t reg_size_start; /* Initial amount of regular memory allocated */
size_t arr_size_start; /* Initial amount of array memory allocated */
size_t blk_size_start; /* Initial amount of block memory allocated */
@ -5721,16 +5731,6 @@ test_misc35(void)
CHECK(sid, H5I_INVALID_HID, "H5Screate_simple");
/* Select sequence of ten points */
coord[0][0]=0; coord[0][1]=10; coord[0][2]= 5;
coord[1][0]=1; coord[1][1]= 2; coord[1][2]= 7;
coord[2][0]=2; coord[2][1]= 4; coord[2][2]= 9;
coord[3][0]=0; coord[3][1]= 6; coord[3][2]=11;
coord[4][0]=1; coord[4][1]= 8; coord[4][2]=13;
coord[5][0]=2; coord[5][1]=12; coord[5][2]= 0;
coord[6][0]=0; coord[6][1]=14; coord[6][2]= 2;
coord[7][0]=1; coord[7][1]= 0; coord[7][2]= 4;
coord[8][0]=2; coord[8][1]= 1; coord[8][2]= 6;
coord[9][0]=0; coord[9][1]= 3; coord[9][2]= 8;
ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)MISC35_NPOINTS, (const hsize_t *)coord);
CHECK(ret, FAIL, "H5Sselect_elements");
@ -5745,24 +5745,16 @@ test_misc35(void)
#if !defined H5_USING_MEMCHECKER
/* All the free list values should be >0 */
if(0 == reg_size_start)
ERROR("reg_size_start == 0");
if(0 == arr_size_start)
ERROR("arr_size_start == 0");
if(0 == blk_size_start)
ERROR("blk_size_start == 0");
if(0 == fac_size_start)
ERROR("fac_size_start == 0");
CHECK(reg_size_start, 0, "H5get_free_list_sizes");
CHECK(arr_size_start, 0, "H5get_free_list_sizes");
CHECK(blk_size_start, 0, "H5get_free_list_sizes");
CHECK(fac_size_start, 0, "H5get_free_list_sizes");
#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
/* All the values should be == 0 */
if(0 != reg_size_start)
ERROR("reg_size_start != 0");
if(0 != arr_size_start)
ERROR("arr_size_start != 0");
if(0 != blk_size_start)
ERROR("blk_size_start != 0");
if(0 != fac_size_start)
ERROR("fac_size_start != 0");
VERIFY(reg_size_start, 0, "H5get_free_list_sizes");
VERIFY(arr_size_start, 0, "H5get_free_list_sizes");
VERIFY(blk_size_start, 0, "H5get_free_list_sizes");
VERIFY(fac_size_start, 0, "H5get_free_list_sizes");
#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
/* Garbage collect the free lists */
@ -5789,36 +5781,22 @@ test_misc35(void)
#if defined H5_MEMORY_ALLOC_SANITY_CHECK
/* All the values should be >0 */
if(0 == alloc_stats.total_alloc_bytes)
ERROR("alloc_stats.total_alloc_bytes == 0");
if(0 == alloc_stats.curr_alloc_bytes)
ERROR("alloc_stats.curr_alloc_bytes == 0");
if(0 == alloc_stats.peak_alloc_bytes)
ERROR("alloc_stats.peak_alloc_bytes == 0");
if(0 == alloc_stats.max_block_size)
ERROR("alloc_stats.max_block_size == 0");
if(0 == alloc_stats.total_alloc_blocks_count)
ERROR("alloc_stats.total_alloc_blocks_count == 0");
if(0 == alloc_stats.curr_alloc_blocks_count)
ERROR("alloc_stats.curr_alloc_blocks_count == 0");
if(0 == alloc_stats.peak_alloc_blocks_count)
ERROR("alloc_stats.peak_alloc_blocks_count == 0");
CHECK(alloc_stats.total_alloc_bytes, 0, "H5get_alloc_stats");
CHECK(alloc_stats.curr_alloc_bytes, 0, "H5get_alloc_stats");
CHECK(alloc_stats.peak_alloc_bytes, 0, "H5get_alloc_stats");
CHECK(alloc_stats.max_block_size, 0, "H5get_alloc_stats");
CHECK(alloc_stats.total_alloc_blocks_count, 0, "H5get_alloc_stats");
CHECK(alloc_stats.curr_alloc_blocks_count, 0, "H5get_alloc_stats");
CHECK(alloc_stats.peak_alloc_blocks_count, 0, "H5get_alloc_stats");
#else /* H5_MEMORY_ALLOC_SANITY_CHECK */
/* All the values should be == 0 */
if(0 != alloc_stats.total_alloc_bytes)
ERROR("alloc_stats.total_alloc_bytes != 0");
if(0 != alloc_stats.curr_alloc_bytes)
ERROR("alloc_stats.curr_alloc_bytes != 0");
if(0 != alloc_stats.peak_alloc_bytes)
ERROR("alloc_stats.peak_alloc_bytes != 0");
if(0 != alloc_stats.max_block_size)
ERROR("alloc_stats.max_block_size != 0");
if(0 != alloc_stats.total_alloc_blocks_count)
ERROR("alloc_stats.total_alloc_blocks_count != 0");
if(0 != alloc_stats.curr_alloc_blocks_count)
ERROR("alloc_stats.curr_alloc_blocks_count != 0");
if(0 != alloc_stats.peak_alloc_blocks_count)
ERROR("alloc_stats.peak_alloc_blocks_count != 0");
VERIFY(alloc_stats.total_alloc_bytes, 0, "H5get_alloc_stats");
VERIFY(alloc_stats.curr_alloc_bytes, 0, "H5get_alloc_stats");
VERIFY(alloc_stats.peak_alloc_bytes, 0, "H5get_alloc_stats");
VERIFY(alloc_stats.max_block_size, 0, "H5get_alloc_stats");
VERIFY(alloc_stats.total_alloc_blocks_count, 0, "H5get_alloc_stats");
VERIFY(alloc_stats.curr_alloc_blocks_count, 0, "H5get_alloc_stats");
VERIFY(alloc_stats.peak_alloc_blocks_count, 0, "H5get_alloc_stats");
#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */
} /* end test_misc35() */