From: maier Date: Wed, 20 Nov 2013 17:31:56 +0000 (+0000) Subject: Bufix: Well, it is a good idea to not destroy formerly working functionality X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=586e08d9a3749301970ca2a76c586aa0c1e47771;p=dealii-svn.git Bufix: Well, it is a good idea to not destroy formerly working functionality git-svn-id: https://svn.dealii.org/trunk@31731 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/setup_testsuite.cmake b/deal.II/cmake/setup_testsuite.cmake index 00e7b2dfb7..23b0de2f46 100644 --- a/deal.II/cmake/setup_testsuite.cmake +++ b/deal.II/cmake/setup_testsuite.cmake @@ -15,9 +15,16 @@ ## --------------------------------------------------------------------- # -# 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}) @@ -47,11 +54,7 @@ FILE(WRITE ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake "") # # 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 @@ -74,19 +77,33 @@ ADD_CUSTOM_TARGET(prune_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}") @@ -95,12 +112,44 @@ FOREACH(_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") @@ -111,4 +160,5 @@ EXECUTE_PROCESS( OUTPUT_QUIET ) MESSAGE(STATUS "Regenerating testsuite subprojects - Done") + MESSAGE(STATUS "") diff --git a/deal.II/tests/CMakeLists.txt b/deal.II/tests/CMakeLists.txt index 8b6a803678..14d41b5410 100644 --- a/deal.II/tests/CMakeLists.txt +++ b/deal.II/tests/CMakeLists.txt @@ -14,7 +14,7 @@ ## ## --------------------------------------------------------------------- -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" @@ -25,19 +25,16 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) 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) @@ -48,32 +45,6 @@ ADD_CUSTOM_TARGET(clean_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: # @@ -87,38 +58,18 @@ LIST(REMOVE_DUPLICATES _categories) # 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}) @@ -128,10 +79,5 @@ FOREACH(_category ${_categories}) ) ADD_DEPENDENCIES(prune_tests prune_tests_${_category}) - FILE(APPEND ${CMAKE_BINARY_DIR}/CTestTestfile.cmake - "SUBDIRS(${_category})\n" - ) - ENDIF() ENDFOREACH() -