Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: improve testsuite driver performance #15479

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 18 additions & 3 deletions cmake/macros/macro_deal_ii_add_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@
# A small helper macro that is used below:
#

if(POLICY CMP0112)
# Target file component generator expressions do not add target dependencies.
cmake_policy(SET CMP0112 NEW)
tamiko marked this conversation as resolved.
Show resolved Hide resolved
endif()

macro(item_matches _var _regex)
set(${_var})
foreach (_item ${ARGN})
Expand Down Expand Up @@ -333,7 +338,8 @@ function(deal_ii_add_test _category _test_name _comparison_file)

set(_target ${_category}.${_test_name}.${_build_lowercase}) # target name
set(_target_short ${_test_name}.${_build_lowercase}) # short target name
set(_run_args "$<TARGET_FILE:${_target}>") # the command to issue
# FIXME: do not add implicit target dependencies
set(_run_args "$<TARGET_FILE_DIR:${_target}>/$<TARGET_FILE_NAME:${_target}>")

#
# If the variable ${category_test_RUNARGS_PREFIX) is nonempty prepend
Expand Down Expand Up @@ -361,7 +367,7 @@ function(deal_ii_add_test _category _test_name _comparison_file)
endif()
set(_target_short ${_target})
set(_run_args
"$<TARGET_FILE:${_target}>"
"$<TARGET_FILE_DIR:${_target}>/$<TARGET_FILE_NAME:${_target}>"
"${_source_file}"
)
endif()
Expand Down Expand Up @@ -510,6 +516,15 @@ function(deal_ii_add_test _category _test_name _comparison_file)
# Add a top level target to run and compare the test:
#

if(_shared_target)
#
# FIXME: test what happens if we unlink dependencies
#
set(_target_dependency)
else()
set(_target_dependency ${_target})
endif()

add_custom_command(OUTPUT ${_test_directory}/output
COMMAND ${BASH} ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/run_test.sh
run "${_test_full}" TEST_N_THREADS=${_n_threads} ${_run_args}
Expand All @@ -519,7 +534,7 @@ function(deal_ii_add_test _category _test_name _comparison_file)
WORKING_DIRECTORY
${_test_directory}
DEPENDS
${_target}
${_target_dependency}
${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/normalize.pl
VERBATIM
)
Expand Down
9 changes: 3 additions & 6 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,11 @@ foreach(_category ${_categories})

file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_category})

set(_redirect ">" "/dev/null")
if(DEAL_II_MSVC)
set(_command ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir})
else()
# Do not pass the generator with -G so that we use make instead of ninja
# for the test projects. This is because calling ninja several times in
# parallel for the same project will break the configuration.
set(_command ${CMAKE_COMMAND} ${_options} ${_category_dir} > /dev/null)
set (_redirect "")
endif()
set(_command ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir} ${_redirect})
tamiko marked this conversation as resolved.
Show resolved Hide resolved

add_custom_target(setup_tests_${_category}
COMMAND ${_command}
Expand Down