diff options
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 () |