## ---------------------------------------------------------------------
#
-# Setup the testsuite. The top level targets defined here merely act as a
-# multiplexer for the ./tets/ project where all the actual work is
-# done...
+# This is a bloody hack to avoid a severe performance penalty when using
+# 12k top level targets with GNU Make that really does not like that...
+#
+# The only choice we have is to set up every test subdirectory as an
+# independent project. Unfortunately this adds quite a significant amount
+# of complexity :-(
+#
+
+#
+# Setup the testsuite.
#
SET_IF_EMPTY(MAKEOPTS $ENV{MAKEOPTS})
#
# Setup tests:
-ADD_CUSTOM_TARGET(setup_tests
- COMMAND ${CMAKE_COMMAND}
- --build ${CMAKE_BINARY_DIR}/tests --target setup_tests
- -- ${MAKEOPTS}
- )
+ADD_CUSTOM_TARGET(setup_tests)
# Regenerate tests (run "make rebuild_cache" in subprojects):
ADD_CUSTOM_TARGET(regen_tests
-- ${MAKEOPTS}
)
+MESSAGE(STATUS "Setup testsuite")
+
#
-# Setup the testsuite and pass all relevant "TEST_" and "_DIR" variables
+# Setup the testsuite project: It is merely a wrapper around the individual
+# regen_tests_*, clean_tests_* and prune_tests_* targets.
# down to it:
#
-MESSAGE(STATUS "Setup testsuite")
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR}
+ -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}
+ -DTEST_DIR=${TEST_DIR}
+ ${CMAKE_SOURCE_DIR}/tests
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests
+ OUTPUT_QUIET
+ )
SET(_options)
LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR})
LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR})
FOREACH(_var
- DIFF_DIR NUMDIFF_DIR TEST_DIR TEST_DIFF TEST_OVERRIDE_LOCATION
- TEST_PICKUP_REGEX TEST_TIME_LIMIT
+ DIFF_DIR
+ NUMDIFF_DIR
+ TEST_DIFF
+ TEST_OVERRIDE_LOCATION
+ TEST_PICKUP_REGEX
+ TEST_TIME_LIMIT
)
# always undefine:
LIST(APPEND _options "-U${_var}")
ENDIF()
ENDFOREACH()
-EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options}
- ${CMAKE_SOURCE_DIR}/tests
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests
- OUTPUT_QUIET
- )
+#
+# Glob together a list of all subfolders to set up:
+#
+
+FILE(GLOB _categories RELATIVE ${TEST_DIR} ${TEST_DIR}/*)
+SET(_categories all-headers build_tests mesh_converter ${_categories})
+LIST(REMOVE_DUPLICATES _categories)
+
+#
+# Define a subproject for every enabled category:
+#
+
+FOREACH(_category ${_categories})
+ IF(EXISTS ${CMAKE_SOURCE_DIR}/${_category}/CMakeLists.txt)
+ SET(_category_dir ${CMAKE_SOURCE_DIR}/tests/${_category})
+ ELSEIF(EXISTS ${TEST_DIR}/${_category}/CMakeLists.txt)
+ SET(_category_dir ${TEST_DIR}/${_category})
+ ELSE()
+ SET(_category_dir)
+ ENDIF()
+
+ IF(NOT "${_category_dir}" STREQUAL "")
+ ADD_CUSTOM_TARGET(setup_tests_${_category}
+ COMMAND ${CMAKE_COMMAND} -E make_directory
+ ${CMAKE_BINARY_DIR}/tests/${_category}
+ COMMAND cd ${CMAKE_BINARY_DIR}/tests/${_category} &&
+ ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir}
+ > /dev/null
+ DEPENDS ${_category_dir}
+ COMMENT "Processing tests/${_category}"
+ )
+ ADD_DEPENDENCIES(setup_tests setup_tests_${_category})
+
+ FILE(APPEND ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake
+ "SUBDIRS(${_category})\n"
+ )
+ ENDIF()
+ENDFOREACH()
MESSAGE(STATUS "Setup testsuite - Done")
MESSAGE(STATUS "Regenerating testsuite subprojects")
OUTPUT_QUIET
)
MESSAGE(STATUS "Regenerating testsuite subprojects - Done")
+
MESSAGE(STATUS "")
##
## ---------------------------------------------------------------------
-IF(NOT DEFINED DEAL_II_SOURCE_DIR OR NOT DEFINED DEAL_II_BINARY_DIR)
+IF(NOT DEFINED DEAL_II_BINARY_DIR)
MESSAGE(FATAL_ERROR "\n
The testsuite cannot be set up as an independent project.
Please configure \"deal.II\" directly instead.\n\n"
PROJECT(testsuite NONE)
#
-# This is a bloody hack to avoid a severe performance penalty when using
-# 12k top level targets with GNU Make that really does not like that...
-#
-# The only choice we have is to set up every test subdirectory as an
-# independent project. Unfortunately this adds quite a significant amount
-# of complexity :-(
-
-#
-# Custom targets to set and clean up the testsuite:
+# This is a small project that provides some custom targets that need a
+# working, independent subproject because they are called back during
+# configure phase.
#
# Setup tests:
-ADD_CUSTOM_TARGET(setup_tests)
+ADD_CUSTOM_TARGET(setup_tests
+ COMMAND ${CMAKE_COMMAND}
+ --build ${DEAL_II_BINARY_DIR} --target setup_tests
+ )
# Regenerate tests (run "make rebuild_cache" in subprojects):
ADD_CUSTOM_TARGET(regen_tests)
# Remove all tests:
ADD_CUSTOM_TARGET(prune_tests)
-#
-# Be as quiet as possible:
-#
-
-IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
- SET(_shoo)
-ELSE()
- SET(_shoo >/dev/null)
-ENDIF()
-
-#
-# Pass down all relevant configuration:
-#
-
-SET(_options)
-FOREACH(_var
- DEAL_II_SOURCE_DIR DEAL_II_BINARY_DIR DIFF_DIR NUMDIFF_DIR
- TEST_DIFF TEST_OVERRIDE_LOCATION TEST_PICKUP_REGEX TEST_TIME_LIMIT
- )
- # always undefine:
- LIST(APPEND _options "-U${_var}")
- IF(DEFINED ${_var})
- LIST(APPEND _options "-D${_var}=${${_var}}")
- ENDIF()
-ENDFOREACH()
-
#
# Glob together a list of all subfolders to set up:
#
#
FOREACH(_category ${_categories})
- IF(EXISTS ${CMAKE_SOURCE_DIR}/${_category}/CMakeLists.txt)
- SET(_category_dir ${CMAKE_SOURCE_DIR}/${_category})
- ELSEIF(EXISTS ${TEST_DIR}/${_category}/CMakeLists.txt)
- SET(_category_dir ${TEST_DIR}/${_category})
- ELSE()
- SET(_category_dir)
- ENDIF()
-
- IF(NOT "${_category_dir}" STREQUAL "")
-
- ADD_CUSTOM_TARGET(setup_tests_${_category}
- COMMAND ${CMAKE_COMMAND} -E make_directory
- ${CMAKE_BINARY_DIR}/${_category}
- COMMAND cd ${CMAKE_BINARY_DIR}/${_category} &&
- ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir}
- ${_shoo}
- DEPENDS ${_category_dir}
- COMMENT "Processing tests/${_category}"
- )
- ADD_DEPENDENCIES(setup_tests setup_tests_${_category})
+ IF( EXISTS ${CMAKE_SOURCE_DIR}/${_category}/CMakeLists.txt OR
+ EXISTS ${TEST_DIR}/${_category}/CMakeLists.txt )
ADD_CUSTOM_TARGET(regen_tests_${_category}
COMMAND [ ! -d ${_category} ] || ${CMAKE_COMMAND}
--build ${CMAKE_BINARY_DIR}/${_category} --target regenerate
- ${_shoo}
)
ADD_DEPENDENCIES(regen_tests regen_tests_${_category})
ADD_CUSTOM_TARGET(clean_tests_${_category}
COMMAND [ ! -d ${_category} ] || ${CMAKE_COMMAND}
--build ${CMAKE_BINARY_DIR}/${_category} --target clean
- ${_shoo}
)
ADD_DEPENDENCIES(clean_tests clean_tests_${_category})
)
ADD_DEPENDENCIES(prune_tests prune_tests_${_category})
- FILE(APPEND ${CMAKE_BINARY_DIR}/CTestTestfile.cmake
- "SUBDIRS(${_category})\n"
- )
-
ENDIF()
ENDFOREACH()
-