diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2023-05-26 20:29:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-26 20:29:02 (GMT) |
commit | 79bb60c3f6f67411e5d70b84743fc9f6b6143cbc (patch) | |
tree | dce0c97c567cb20eeb65de917e21347376979f18 /test/API/CMakeLists.txt | |
parent | 77e64e0df46bb7498be014b1005efd49c4ad7518 (diff) | |
download | hdf5-79bb60c3f6f67411e5d70b84743fc9f6b6143cbc.zip hdf5-79bb60c3f6f67411e5d70b84743fc9f6b6143cbc.tar.gz hdf5-79bb60c3f6f67411e5d70b84743fc9f6b6143cbc.tar.bz2 |
API test updates (#3018)
* Remove macros from api tests (#2929)
* Remove macros and undefined callbacks (#2959)
* Remove remaining macros from H5_api_tests_disabled.h (#2968)
* Put some vol capability checks in testpar tests and remove remaining warnings (#2995)
* API tests datatype generation cleanup
* Clean up API tests' random datatype generation and fix bug with enum
datatype generation
* Init parallel API tests with MPI_THREAD_MULTIPLE
* HDF5 API tests - Check VOL connector registration
* Determine whether a VOL connector failed to load before running API
tests
* Cleanup some usages of H5VL_CAP_FLAG_CREATION_ORDER in API tests
* Remove some now-unused macros from H5_api_tests_disabled.h
* Enable HDF5 API tests by default
* Implement CMake option to install HDF5 API tests
* Check for invalid AAPL from H5Acreate
* Enable building of VOL connectors alongside HDF5 in CMake
* Prepend CMake VOL URL option indices with 0s so they come in order
* Don't turn on API tests by default yet
* Document VOL connector FetchContent functionality
* Add release note for API test updates
* Only install testing library if API tests are installed
* Fix grammar
Diffstat (limited to 'test/API/CMakeLists.txt')
-rw-r--r-- | test/API/CMakeLists.txt | 193 |
1 files changed, 187 insertions, 6 deletions
diff --git a/test/API/CMakeLists.txt b/test/API/CMakeLists.txt index 606aa9c..e90a4c8 100644 --- a/test/API/CMakeLists.txt +++ b/test/API/CMakeLists.txt @@ -161,6 +161,21 @@ if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TEST_h5_api_test_FORMAT h5_api_test) endif () +if (HDF5_TEST_API_INSTALL) + install ( + TARGETS + h5_api_test + EXPORT + ${HDF5_EXPORTED_TARGETS} + DESTINATION + ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT + tests + ) +endif () + #----------------------------------------------------------------------------- # Build the ported HDF5 test executables #----------------------------------------------------------------------------- @@ -232,12 +247,32 @@ foreach (api_test_extra ${HDF5_API_TESTS_EXTRA}) if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TEST_h5_api_test_${api_test_extra}_FORMAT h5_api_test_${api_test_extra}) endif () + + if (HDF5_TEST_API_INSTALL) + install ( + TARGETS + h5_api_test_${api_test_extra} + EXPORT + ${HDF5_EXPORTED_TARGETS} + DESTINATION + ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT + tests + ) + endif () endforeach () #----------------------------------------------------------------------------- # Add tests if HDF5 serial testing is enabled #----------------------------------------------------------------------------- if (HDF5_TEST_SERIAL) + # Setup working directories for any external VOL connectors to be tested + foreach (external_vol_tgt ${HDF5_EXTERNAL_VOL_TARGETS}) + file (MAKE_DIRECTORY "${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}") + endforeach () + if (HDF5_TEST_API_ENABLE_DRIVER) if ("${HDF5_TEST_API_SERVER}" STREQUAL "") message (FATAL_ERROR "Please set HDF5_TEST_API_SERVER to point to a server executable for the test driver program.") @@ -258,7 +293,7 @@ if (HDF5_TEST_SERIAL) ) endif () - set(last_api_test "") + set (last_api_test "") foreach (api_test ${HDF5_API_TESTS}) add_test ( NAME "h5_api_test_${api_test}" @@ -269,9 +304,9 @@ if (HDF5_TEST_SERIAL) ${HDF5_TEST_API_DRIVER_EXTRA_FLAGS} ) - set_tests_properties("h5_api_test_${api_test}" PROPERTIES DEPENDS "${last_api_test}") + set_tests_properties ("h5_api_test_${api_test}" PROPERTIES DEPENDS "${last_api_test}") - set(last_api_test "h5_api_test_${api_test}") + set (last_api_test "h5_api_test_${api_test}") endforeach () foreach (hdf5_test ${HDF5_API_TESTS_EXTRA}) @@ -296,17 +331,104 @@ if (HDF5_TEST_SERIAL) ${HDF5_TEST_API_DRIVER_EXTRA_FLAGS} ) endforeach () + + # Add tests for each external VOL connector that was built + foreach (external_vol_tgt ${HDF5_EXTERNAL_VOL_TARGETS}) + # Determine environment variables that need to be set for testing + set (vol_test_env "") + set (vol_plugin_paths "${CMAKE_BINARY_DIR}/${HDF5_INSTALL_BIN_DIR}") + + get_target_property (vol_test_string "${external_vol_tgt}" HDF5_VOL_NAME) + list (APPEND vol_test_env "HDF5_VOL_CONNECTOR=${vol_test_string}") + + get_target_property (vol_lib_targets "${external_vol_tgt}" HDF5_VOL_TARGETS) + foreach (lib_target ${vol_lib_targets}) + get_target_property (lib_target_output_dir "${lib_target}" LIBRARY_OUTPUT_DIRECTORY) + if (NOT "${lib_target_output_dir}" STREQUAL "lib_target_output_dir-NOTFOUND" + AND NOT "${lib_target_output_dir}" STREQUAL "" + AND NOT "${lib_target_output_dir}" STREQUAL "${CMAKE_BINARY_DIR}/${HDF5_INSTALL_BIN_DIR}") + set (vol_plugin_paths "${vol_plugin_paths}${CMAKE_SEP}${lib_target_output_dir}") + endif () + endforeach () + + list (APPEND vol_test_env "HDF5_PLUGIN_PATH=${vol_plugin_paths}") + + # Add main API tests + set (last_api_test "") + foreach (api_test ${HDF5_API_TESTS}) + add_test ( + NAME "${external_vol_tgt}-h5_api_test_${api_test}" + COMMAND $<TARGET_FILE:h5_api_test_driver> + --server ${HDF5_TEST_API_SERVER} + --client $<TARGET_FILE:h5_api_test> "${api_test}" + --serial + ${HDF5_TEST_API_DRIVER_EXTRA_FLAGS} + ) + set_tests_properties ( + "${external_vol_tgt}-h5_api_test_${api_test}" + PROPERTIES + ENVIRONMENT + "${vol_test_env}" + WORKING_DIRECTORY + "${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}" + DEPENDS + "${last_api_test}" + ) + + set (last_api_test "${external_vol_tgt}-h5_api_test_${api_test}") + endforeach () + + # Add any extra HDF5 tests + foreach (hdf5_test ${HDF5_API_TESTS_EXTRA}) + add_test ( + NAME "${external_vol_tgt}-h5_api_test_${hdf5_test}" + COMMAND $<TARGET_FILE:h5_api_test_driver> + --server ${HDF5_TEST_API_SERVER} + --client $<TARGET_FILE:h5_api_test_${hdf5_test}> + --serial + ${HDF5_TEST_API_DRIVER_EXTRA_FLAGS} + ) + set_tests_properties ( + "${external_vol_tgt}-h5_api_test_${hdf5_test}" + PROPERTIES + ENVIRONMENT + "${vol_test_env}" + WORKING_DIRECTORY + "${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}" + ) + endforeach () + + # Hook external tests to same test suite + foreach (ext_api_test ${HDF5_API_EXT_SERIAL_TESTS}) + add_test ( + NAME "${external_vol_tgt}-h5_api_ext_test_${ext_api_test}" + COMMAND $<TARGET_FILE:h5_api_test_driver> + --server ${HDF5_TEST_API_SERVER} + --client $<TARGET_FILE:${ext_api_test}> + --serial + ${HDF5_TEST_API_DRIVER_EXTRA_FLAGS} + ) + set_tests_properties ( + "${external_vol_tgt}-h5_api_ext_test_${ext_api_test}" + PROPERTIES + ENVIRONMENT + "${vol_test_env}" + WORKING_DIRECTORY + "${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}" + ) + endforeach () + endforeach () else () - set(last_api_test "") + set (last_api_test "") foreach (api_test ${HDF5_API_TESTS}) add_test ( NAME "h5_api_test_${api_test}" COMMAND $<TARGET_FILE:h5_api_test> "${api_test}" ) - set_tests_properties("h5_api_test_${api_test}" PROPERTIES DEPENDS "${last_api_test}") + set_tests_properties ("h5_api_test_${api_test}" PROPERTIES DEPENDS "${last_api_test}") - set(last_api_test "h5_api_test_${api_test}") + set (last_api_test "h5_api_test_${api_test}") endforeach () foreach (hdf5_test ${HDF5_API_TESTS_EXTRA}) @@ -315,5 +437,64 @@ if (HDF5_TEST_SERIAL) COMMAND $<TARGET_FILE:h5_api_test_${hdf5_test}> ) endforeach () + + # Add tests for each external VOL connector that was built + foreach (external_vol_tgt ${HDF5_EXTERNAL_VOL_TARGETS}) + # Determine environment variables that need to be set for testing + set (vol_test_env "") + set (vol_plugin_paths "${CMAKE_BINARY_DIR}/${HDF5_INSTALL_BIN_DIR}") + + get_target_property (vol_test_string "${external_vol_tgt}" HDF5_VOL_NAME) + list (APPEND vol_test_env "HDF5_VOL_CONNECTOR=${vol_test_string}") + + get_target_property (vol_lib_targets "${external_vol_tgt}" HDF5_VOL_TARGETS) + foreach (lib_target ${vol_lib_targets}) + get_target_property (lib_target_output_dir "${lib_target}" LIBRARY_OUTPUT_DIRECTORY) + if (NOT "${lib_target_output_dir}" STREQUAL "lib_target_output_dir-NOTFOUND" + AND NOT "${lib_target_output_dir}" STREQUAL "" + AND NOT "${lib_target_output_dir}" STREQUAL "${CMAKE_BINARY_DIR}/${HDF5_INSTALL_BIN_DIR}") + set (vol_plugin_paths "${vol_plugin_paths}${CMAKE_SEP}${lib_target_output_dir}") + endif () + endforeach () + + list (APPEND vol_test_env "HDF5_PLUGIN_PATH=${vol_plugin_paths}") + + # Add main API tests + set (last_api_test "") + foreach (api_test ${HDF5_API_TESTS}) + add_test ( + NAME "${external_vol_tgt}-h5_api_test_${api_test}" + COMMAND $<TARGET_FILE:h5_api_test> "${api_test}" + ) + set_tests_properties ( + "${external_vol_tgt}-h5_api_test_${api_test}" + PROPERTIES + ENVIRONMENT + "${vol_test_env}" + WORKING_DIRECTORY + "${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}" + DEPENDS + "${last_api_test}" + ) + + set (last_api_test "${external_vol_tgt}-h5_api_test_${api_test}") + endforeach () + + # Add any extra HDF5 tests + foreach (hdf5_test ${HDF5_API_TESTS_EXTRA}) + add_test ( + NAME "${external_vol_tgt}-h5_api_test_${hdf5_test}" + COMMAND $<TARGET_FILE:h5_api_test_${hdf5_test}> + ) + set_tests_properties ( + "${external_vol_tgt}-h5_api_test_${hdf5_test}" + PROPERTIES + ENVIRONMENT + "${vol_test_env}" + WORKING_DIRECTORY + "${HDF5_TEST_BINARY_DIR}/${external_vol_tgt}" + ) + endforeach () + endforeach () endif () endif () |