diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 46 | ||||
-rw-r--r-- | test/CMakeVFDTests.cmake | 14 | ||||
-rw-r--r-- | test/cache_common.h | 149 |
3 files changed, 89 insertions, 120 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2c9b5fb..3433d64 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -208,8 +208,8 @@ set (H5_TESTS ohdr stab gheap - cache # multiple source - cache_api # multiple source + cache + cache_api pool hyperslab istore @@ -276,8 +276,6 @@ endmacro () set (H5_TESTS_MULTIPLE testhdf5 - cache - cache_api ttsafe ) # Only build single source tests here @@ -313,46 +311,6 @@ if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TEST_testhdf5_FORMAT testhdf5) endif () -#-- Adding test for cache -add_executable (cache ${HDF5_TEST_SOURCE_DIR}/cache.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) -target_compile_options(cache PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories(cache PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (cache STATIC) - target_link_libraries (cache PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) -else () - TARGET_C_PROPERTIES (cache SHARED) - target_link_libraries (cache PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) -endif () -set_target_properties (cache PROPERTIES FOLDER test) - -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_TEST_cache_FORMAT cache) -endif () - -#-- Adding test for cache_api -add_executable (cache_api ${HDF5_TEST_SOURCE_DIR}/cache_api.c ${HDF5_TEST_SOURCE_DIR}/cache_common.c) -target_compile_options(cache_api PRIVATE "${HDF5_CMAKE_C_FLAGS}") -target_include_directories(cache_api PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") -if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (cache_api STATIC) - target_link_libraries (cache_api PRIVATE ${HDF5_TEST_LIB_TARGET}) -else () - TARGET_C_PROPERTIES (cache_api SHARED) - target_link_libraries (cache_api PRIVATE ${HDF5_TEST_LIBSH_TARGET}) -endif () -set_target_properties (cache_api PROPERTIES FOLDER test) - -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_TEST_cache_api_FORMAT cache_api) -endif () - #-- Adding test for ttsafe add_executable (ttsafe ${ttsafe_SOURCES}) target_compile_options(ttsafe PRIVATE "${HDF5_CMAKE_C_FLAGS}") diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index e4abc9a..f35d7b8 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -17,21 +17,9 @@ ############################################################################## # included from CMakeTests.cmake -set (VFD_LIST - sec2 - stdio - core - core_paged - split - multi - family -) -if (H5_HAVE_DIRECT) - set (VFD_LIST ${VFD_LIST} direct) -endif () +H5_SET_VFD_LIST() foreach (vfdtest ${VFD_LIST}) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files") endforeach () diff --git a/test/cache_common.h b/test/cache_common.h index 7021394..0f8cf42 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -420,113 +420,136 @@ struct expected_entry_status { /* global variable externs: */ -extern hbool_t write_permitted; -extern hbool_t pass; /* set to false on error */ -extern const char *failure_mssg; +H5TEST_DLLVAR hbool_t write_permitted; +H5TEST_DLLVAR hbool_t pass; /* set to false on error */ +H5TEST_DLLVAR const char *failure_mssg; -extern test_entry_t *entries[NUMBER_OF_ENTRY_TYPES]; -extern const int32_t max_indices[NUMBER_OF_ENTRY_TYPES]; -extern const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES]; -extern const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES]; -extern const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES]; -extern const char * entry_type_names[NUMBER_OF_ENTRY_TYPES]; +H5TEST_DLLVAR test_entry_t *entries[NUMBER_OF_ENTRY_TYPES]; +H5TEST_DLLVAR const int32_t max_indices[NUMBER_OF_ENTRY_TYPES]; +H5TEST_DLLVAR const size_t entry_sizes[NUMBER_OF_ENTRY_TYPES]; +H5TEST_DLLVAR const haddr_t base_addrs[NUMBER_OF_ENTRY_TYPES]; +H5TEST_DLLVAR const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES]; +H5TEST_DLLVAR const char * entry_type_names[NUMBER_OF_ENTRY_TYPES]; /* call back function declarations: */ /* callback table extern */ -extern const H5C_class_t types[NUMBER_OF_ENTRY_TYPES]; +H5TEST_DLLVAR const H5C_class_t types[NUMBER_OF_ENTRY_TYPES]; + +#ifdef __cplusplus +extern "C" { +#endif /* function declarations: */ -void add_flush_op(int target_type, int target_idx, int op_code, int type, int idx, hbool_t flag, size_t size); +H5TEST_DLL void add_flush_op(int target_type, int target_idx, int op_code, int type, int idx, hbool_t flag, + size_t size); -void addr_to_type_and_index(haddr_t addr, int32_t *type_ptr, int32_t *index_ptr); +H5TEST_DLL void addr_to_type_and_index(haddr_t addr, int32_t *type_ptr, int32_t *index_ptr); #if 0 /* keep this for a while -- it may be useful */ -haddr_t type_and_index_to_addr(int32_t type, +H5TEST_DLL haddr_t type_and_index_to_addr(int32_t type, int32_t idx); #endif -void dirty_entry(H5F_t *file_ptr, int32_t type, int32_t idx, hbool_t dirty_pin); +H5TEST_DLL void dirty_entry(H5F_t *file_ptr, int32_t type, int32_t idx, hbool_t dirty_pin); -void expunge_entry(H5F_t *file_ptr, int32_t type, int32_t idx); +H5TEST_DLL void expunge_entry(H5F_t *file_ptr, int32_t type, int32_t idx); -void insert_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags); +H5TEST_DLL void insert_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags); -void mark_entry_dirty(int32_t type, int32_t idx); +H5TEST_DLL void mark_entry_dirty(int32_t type, int32_t idx); -void move_entry(H5C_t *cache_ptr, int32_t type, int32_t idx, hbool_t main_addr); +H5TEST_DLL void move_entry(H5C_t *cache_ptr, int32_t type, int32_t idx, hbool_t main_addr); -void protect_entry(H5F_t *file_ptr, int32_t type, int32_t idx); +H5TEST_DLL void protect_entry(H5F_t *file_ptr, int32_t type, int32_t idx); -void protect_entry_ro(H5F_t *file_ptr, int32_t type, int32_t idx); +H5TEST_DLL void protect_entry_ro(H5F_t *file_ptr, int32_t type, int32_t idx); -hbool_t entry_in_cache(H5C_t *cache_ptr, int32_t type, int32_t idx); +H5TEST_DLL hbool_t entry_in_cache(H5C_t *cache_ptr, int32_t type, int32_t idx); -void create_pinned_entry_dependency(H5F_t *file_ptr, int pinning_type, int pinning_idx, int pinned_type, - int pinned_idx); +H5TEST_DLL void create_pinned_entry_dependency(H5F_t *file_ptr, int pinning_type, int pinning_idx, + int pinned_type, int pinned_idx); -void reset_entries(void); +H5TEST_DLL void reset_entries(void); -void resize_entry(H5F_t *file_ptr, int32_t type, int32_t idx, size_t new_size, hbool_t in_cache); +H5TEST_DLL void resize_entry(H5F_t *file_ptr, int32_t type, int32_t idx, size_t new_size, hbool_t in_cache); -void row_major_scan_forward(H5F_t *file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, - hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts, - hbool_t do_moves, hbool_t move_to_main_addr, hbool_t do_destroys, - hbool_t do_mult_ro_protects, int dirty_destroys, int dirty_unprotects); +H5TEST_DLL void row_major_scan_forward(H5F_t *file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, + hbool_t display_stats, hbool_t display_detailed_stats, + hbool_t do_inserts, hbool_t do_moves, hbool_t move_to_main_addr, + hbool_t do_destroys, hbool_t do_mult_ro_protects, int dirty_destroys, + int dirty_unprotects); -void hl_row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, - hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts); +H5TEST_DLL void hl_row_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, + hbool_t reset_stats, hbool_t display_stats, + hbool_t display_detailed_stats, hbool_t do_inserts); -void row_major_scan_backward(H5F_t *file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, - hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts, - hbool_t do_moves, hbool_t move_to_main_addr, hbool_t do_destroys, - hbool_t do_mult_ro_protects, int dirty_destroys, int dirty_unprotects); +H5TEST_DLL void row_major_scan_backward(H5F_t *file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, + hbool_t display_stats, hbool_t display_detailed_stats, + hbool_t do_inserts, hbool_t do_moves, hbool_t move_to_main_addr, + hbool_t do_destroys, hbool_t do_mult_ro_protects, int dirty_destroys, + int dirty_unprotects); -void hl_row_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, - hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts); +H5TEST_DLL void hl_row_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, + hbool_t reset_stats, hbool_t display_stats, + hbool_t display_detailed_stats, hbool_t do_inserts); -void col_major_scan_forward(H5F_t *file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, - hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts, - int dirty_unprotects); +H5TEST_DLL void col_major_scan_forward(H5F_t *file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, + hbool_t display_stats, hbool_t display_detailed_stats, + hbool_t do_inserts, int dirty_unprotects); -void hl_col_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, - hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts, - int dirty_unprotects); +H5TEST_DLL void hl_col_major_scan_forward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, + hbool_t reset_stats, hbool_t display_stats, + hbool_t display_detailed_stats, hbool_t do_inserts, + int dirty_unprotects); -void col_major_scan_backward(H5F_t *file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, - hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts, - int dirty_unprotects); +H5TEST_DLL void col_major_scan_backward(H5F_t *file_ptr, int32_t lag, hbool_t verbose, hbool_t reset_stats, + hbool_t display_stats, hbool_t display_detailed_stats, + hbool_t do_inserts, int dirty_unprotects); -void hl_col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, hbool_t reset_stats, - hbool_t display_stats, hbool_t display_detailed_stats, hbool_t do_inserts, - int dirty_unprotects); +H5TEST_DLL void hl_col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, hbool_t verbose, + hbool_t reset_stats, hbool_t display_stats, + hbool_t display_detailed_stats, hbool_t do_inserts, + int dirty_unprotects); -void flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_t dump_detailed_stats); +H5TEST_DLL void flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats, + hbool_t dump_detailed_stats); -void unpin_entry(int32_t type, int32_t idx); +H5TEST_DLL void unpin_entry(int32_t type, int32_t idx); -void unprotect_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags); +H5TEST_DLL void unprotect_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags); -void verify_clean(void); +H5TEST_DLL void verify_clean(void); -void verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, struct expected_entry_status expected[]); +H5TEST_DLL void verify_entry_status(H5C_t *cache_ptr, int tag, int num_entries, + struct expected_entry_status expected[]); -void verify_unprotected(void); +H5TEST_DLL void verify_unprotected(void); /*** H5AC level utility functions ***/ -hbool_t resize_configs_are_equal(const H5C_auto_size_ctl_t *a, const H5C_auto_size_ctl_t *b, - hbool_t compare_init); +H5TEST_DLL hbool_t resize_configs_are_equal(const H5C_auto_size_ctl_t *a, const H5C_auto_size_ctl_t *b, + hbool_t compare_init); + +H5TEST_DLL void check_and_validate_cache_hit_rate(hid_t file_id, double *hit_rate_ptr, hbool_t dump_data, + int64_t min_accesses, double min_hit_rate); -void check_and_validate_cache_hit_rate(hid_t file_id, double *hit_rate_ptr, hbool_t dump_data, - int64_t min_accesses, double min_hit_rate); +H5TEST_DLL void check_and_validate_cache_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, + size_t *cur_size_ptr, int32_t *cur_num_entries_ptr, + hbool_t dump_data); -void check_and_validate_cache_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, - size_t *cur_size_ptr, int32_t *cur_num_entries_ptr, hbool_t dump_data); +H5TEST_DLL void validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t compare_init, + int test_num); -void validate_mdc_config(hid_t file_id, H5AC_cache_config_t *ext_config_ptr, hbool_t compare_init, - int test_num); +/** Debugging functions -- normally commented out ***/ +#if 0 +H5TEST_DLL void dump_LRU(H5F_t * file_ptr); +#endif + +#ifdef __cplusplus +} +#endif #endif /* CACHE_COMMON_H */ |