diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2020-03-24 13:22:25 (GMT) |
---|---|---|
committer | Larry Knox <lrknox@hdfgroup.org> | 2020-03-24 13:22:25 (GMT) |
commit | 8890fa3eb51fc47e79a9ac3dd0247ef2cc472f72 (patch) | |
tree | 602058ad6717f67d5a70ec690043175292c87350 /test | |
parent | d9f93659a28ecae44e298c8ef80fe63f70810d0d (diff) | |
parent | d3ef866a2963ce93d0b95184534a70849b6fa11d (diff) | |
download | hdf5-8890fa3eb51fc47e79a9ac3dd0247ef2cc472f72.zip hdf5-8890fa3eb51fc47e79a9ac3dd0247ef2cc472f72.tar.gz hdf5-8890fa3eb51fc47e79a9ac3dd0247ef2cc472f72.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit 'd3ef866a2963ce93d0b95184534a70849b6fa11d':
Revise API for H5get_alloc_stats() to take a struct instead of separate values.
Move the GNU warnings configuration under config/gnu-warnings/ and trim the filename prefixes. Update config/gnu-flags to suit.
Fixed the RELEASE.txt note for HDFFV-11057
Fix shutdown errors when using the HDF5_VOL_CONNECTOR environment variable to set a dynamically loaded plugin as the default VOL connector. Fixes HDFFV-11057
Fix threadsafe for new test
Fix issues when deserializing point/all/none selection with version beyond the library's supported version: (1) Verify the decoded version before proceeding further with deserialization (2) Close the dataspace if errors occurred after opening the dataspace
Very minor comment change in H5VLconnector.h.
Add routines to query the library's free list sizes and allocation stats.
By default, demote warnings promoted to errors back to warnings.
Incorporate the H5_ECFLAGS into the library CFLAGS. Now a bunch of errors will occur. Next commit will demote the warnings promoted to errors back to warnings again.
Break out warnings into more files that autoconf and CMake can share. This change temporarily disables the warnings that were promoted to errors, but I will add those warnings back as warnings, not errors, in the next commit.
Avoid a crash, don't check if we're flushing when the file is closing: there's no need to check if the metadata cache is flushing if we already know the file is closing, because the condition we rely on is "closing OR flushing." Further, the cache may have already gone away, so sometimes calling into the cache to see if it's flushing will crash the program.
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 21 | ||||
-rw-r--r-- | test/tmisc.c | 131 |
2 files changed, 151 insertions, 1 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2594477..7929e2c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -287,7 +287,7 @@ set (H5_TESTS cache_logging cork swmr - thread_id + thread_id # special link vol ) @@ -310,6 +310,7 @@ set (H5_TESTS_MULTIPLE testhdf5 cache_image ttsafe + thread_id # special link ) # Only build single source tests here foreach (h5_test ${H5_TESTS}) @@ -389,6 +390,24 @@ else () endif () set_target_properties (ttsafe PROPERTIES FOLDER test) +######### Special handling for extra link lib of threads ############# +#-- Adding test for thread_id +add_executable (thread_id ${HDF5_TEST_SOURCE_DIR}/thread_id.c) +target_include_directories (thread_id PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (thread_id STATIC) + target_link_libraries (thread_id PRIVATE ${HDF5_TEST_LIB_TARGET}) + if (NOT WIN32) + target_link_libraries (thread_id + PRIVATE $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads> + ) + endif () +else () + TARGET_C_PROPERTIES (thread_id SHARED) + target_link_libraries (thread_id PRIVATE ${HDF5_TEST_LIBSH_TARGET} $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads>) +endif () +set_target_properties (thread_id PROPERTIES FOLDER test) + ############################################################################## ### A D D I T I O N A L T E S T S ### ############################################################################## diff --git a/test/tmisc.c b/test/tmisc.c index 0ea9c4c..bd9ae53 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -329,6 +329,14 @@ typedef struct /* and bad offset values are written to that file for testing */ #define MISC33_FILE "bad_offset.h5" +/* Definitions for misc. test #35 */ +#define MISC35_SPACE_RANK 3 +#define MISC35_SPACE_DIM1 3 +#define MISC35_SPACE_DIM2 15 +#define MISC35_SPACE_DIM3 13 +#define MISC35_NPOINTS 10 + + /**************************************************************** ** ** test_misc1(): test unlinking a dataset from a group and immediately @@ -5684,6 +5692,128 @@ test_misc34(void) /**************************************************************** ** +** test_misc35(): Check operation of free-list routines +** +****************************************************************/ +static void +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 */ + 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 */ + size_t fac_size_start; /* Initial amount of factory memory allocated */ + size_t reg_size_final; /* Final amount of regular memory allocated */ + size_t arr_size_final; /* Final amount of array memory allocated */ + size_t blk_size_final; /* Final amount of block memory allocated */ + size_t fac_size_final; /* Final amount of factory memory allocated */ + H5_alloc_stats_t alloc_stats; /* Memory stats */ + herr_t ret; /* Return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Free-list API calls")); + + /* Create dataspace */ + /* (Allocates array free-list nodes) */ + sid = H5Screate_simple(MISC35_SPACE_RANK, dims, NULL); + 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"); + + /* Close dataspace */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + + + /* Retrieve initial free list values */ + ret = H5get_free_list_sizes(®_size_start, &arr_size_start, &blk_size_start, &fac_size_start); + CHECK(ret, FAIL, "H5get_free_list_sizes"); + + /* 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"); + + /* Garbage collect the free lists */ + ret = H5garbage_collect(); + CHECK(ret, FAIL, "H5garbage_collect"); + + /* Retrieve free list values again */ + ret = H5get_free_list_sizes(®_size_final, &arr_size_final, &blk_size_final, &fac_size_final); + CHECK(ret, FAIL, "H5get_free_list_sizes"); + + /* All the free list values should be <= previous values */ + if(reg_size_final > reg_size_start) + ERROR("reg_size_final > reg_size_start"); + if(arr_size_final > arr_size_start) + ERROR("arr_size_final > arr_size_start"); + if(blk_size_final > blk_size_start) + ERROR("blk_size_final > blk_size_start"); + if(fac_size_final > fac_size_start) + ERROR("fac_size_final > fac_size_start"); + + /* Retrieve memory allocation statistics */ + ret = H5get_alloc_stats(&alloc_stats); + CHECK(ret, FAIL, "H5get_alloc_stats"); + +#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"); +#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"); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + +} /* end test_misc35() */ + + +/**************************************************************** +** ** test_misc(): Main misc. test routine. ** ****************************************************************/ @@ -5731,6 +5861,7 @@ test_misc(void) test_misc32(); /* Test filter memory allocation functions */ test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */ test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */ + test_misc35(); /* Test behavior of free-list & allocation statistics API calls */ } /* test_misc() */ |