From 093255be18e818c7a7fdba8435043fc44bd120c0 Mon Sep 17 00:00:00 2001 From: maier Date: Tue, 17 Sep 2013 09:49:51 +0000 Subject: [PATCH] Finish testsuite sub project git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30758 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/CMakeLists.txt | 55 ++++++++++++++++++++----------- tests/all-headers/CMakeLists.txt | 17 +++++++++- tests/build_tests/CMakeLists.txt | 12 ++++++- tests/cmake/setup_testsuite.cmake | 9 +---- 4 files changed, 63 insertions(+), 30 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b98d8db633..2ed082c8be 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -23,15 +23,46 @@ # of complexity :-( # +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) MESSAGE(STATUS "Proceed to test definitions now.") +PROJECT(deal.II-testsuite) ENABLE_TESTING() +SET(_options) +IF("${CMAKE_PROJECT_NAME}" STREQUAL "deal.II") + # + # Setup for the case that this folder is included as a subfolder in a + # deal.II project: + # + + # Write a minimalistic CTestTestfile.cmake file to CMAKE_BINARY_DIR: + FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake + "SUBDIRS(tests)" + ) + + LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR}) + LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}) + +ELSE() + + # + # Set up a top level test suite project: + # + + SET(TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +ENDIF() + # -# Write a minimalistic CTestTestfile.cmake file to CMAKE_BINARY_DIR: +# Pass all relevant "TEST_" variables down to the subprojects: # -FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake - "SUBDIRS(tests)" - ) +GET_CMAKE_PROPERTY(_variables VARIABLES) +FOREACH(_var ${_variables}) + IF(_var MATCHES + "^(TEST_DIR|TEST_DIFF|TEST_TIME_LIMIT|TEST_PICKUP_REGEX|NUMDIFF_DIR)$" + ) + LIST(APPEND _options -D${_var}="${${_var}}") + ENDIF() +ENDFOREACH() # # Two custom targets to setup and cleanup the testsuite: @@ -72,20 +103,6 @@ IF(DEAL_II_WITH_UMFPACK) LIST(APPEND _categories umfpack) ENDIF() -# -# Pass all relevant "TEST_" variables down to the subprojects: -# - -GET_CMAKE_PROPERTY(_variables VARIABLES) -SET(_options) -FOREACH(_var ${_variables}) - IF(_var MATCHES - "^(TEST_DIR|TEST_DIFF|TEST_TIME_LIMIT|TEST_PICKUP_REGEX|NUMDIFF_DIR)$" - ) - LIST(APPEND _options -D${_var}="${${_var}}") - ENDIF() -ENDFOREACH() - # # The hook into CTest so that the tests from the suprojects get picked up # by the main project: @@ -106,8 +123,6 @@ FOREACH(_category ${_categories}) ${CMAKE_CURRENT_BINARY_DIR}/${_category} COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/${_category} && ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} - -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} - -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR} ${_options} ${CMAKE_CURRENT_SOURCE_DIR}/${_category} > /dev/null # Shoo! diff --git a/tests/all-headers/CMakeLists.txt b/tests/all-headers/CMakeLists.txt index ce2e06f898..d3c7db8d88 100644 --- a/tests/all-headers/CMakeLists.txt +++ b/tests/all-headers/CMakeLists.txt @@ -28,7 +28,22 @@ INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) SET(_category all-headers) SET(_count "0") -FILE(GLOB_RECURSE _header ${DEAL_II_SOURCE_DIR}/include/*.h) + +IF(NOT"${DEAL_II_SOURCE_DIR}" STREQUAL "") + # The testsuite was configured as part of a deal.II project, so pick up + # the headers from the corresponding source directory: + FILE(GLOB_RECURSE _header ${DEAL_II_SOURCE_DIR}/include/deal.II/*.h) +ELSE() + # The testsuite was configured as an independent project, so pick up + # headers from an external deal.II build directory, or installation: + IF(DEAL_II_BUILD_DIR) + LIST(GET DEAL_II_INCLUDE_DIRS 2 _header_dir) + ELSE() + LIST(GET DEAL_II_INCLUDE_DIRS 0 _header_dir) + ENDIF() + FILE(GLOB_RECURSE _header ${_header_dir}/deal.II/*.h) + MESSAGE(FATAL_ERROR ${_header_dir}) +ENDIF() FOREACH(_full_file ${_header}) GET_FILENAME_COMPONENT(_file ${_full_file} NAME) diff --git a/tests/build_tests/CMakeLists.txt b/tests/build_tests/CMakeLists.txt index 8be854afe6..4be0705842 100644 --- a/tests/build_tests/CMakeLists.txt +++ b/tests/build_tests/CMakeLists.txt @@ -46,8 +46,18 @@ SET(_release_steps step-47 step-48 step-49 ) +IF(NOT"${DEAL_II_SOURCE_DIR}" STREQUAL "") + # The testsuite was configured as part of a deal.II project, so pick up + # the steps rom the corresponding source directory: + FILE(GLOB _steps ${DEAL_II_SOURCE_DIR}/examples/step-*) +ELSE() + # The testsuite was configured as an independent project, so pick up + # headers from an external deal.II build directory, or installation: + FILE(GLOB _steps ${DEAL_II_PATH}/${DEAL_II_EXAMPLES_RELDIR}/step-*) + # TODO: What do in case of a build dir? +ENDIF() + SET(_count "0") -FILE(GLOB _steps ${DEAL_II_SOURCE_DIR}/examples/step-*) FOREACH(_step_full ${_steps}) GET_FILENAME_COMPONENT(_step ${_step_full} NAME) diff --git a/tests/cmake/setup_testsuite.cmake b/tests/cmake/setup_testsuite.cmake index 88a7a2e5dc..afb68b6fee 100644 --- a/tests/cmake/setup_testsuite.cmake +++ b/tests/cmake/setup_testsuite.cmake @@ -52,18 +52,11 @@ SET_IF_EMPTY(TEST_DIFF $ENV{TEST_DIFF}) SET_IF_EMPTY(TEST_TIME_LIMIT $ENV{TEST_TIME_LIMIT}) SET_IF_EMPTY(TEST_PICKUP_REGEX $ENV{TEST_PICKUP_REGEX}) -IF("${DEAL_II_BINARY_DIR}" STREQUAL "") - MESSAGE(FATAL_ERROR "DEAL_II_BINARY_DIR must be set for this test subproject to configure correctly") -ENDIF() -IF("${DEAL_II_SOURCE_DIR}" STREQUAL "") - MESSAGE(FATAL_ERROR "DEAL_II_SOURCE_DIR must be set for this test subproject to configure correctly") -ENDIF() - # # We need deal.II and Perl as external packages: # -FIND_PACKAGE(deal.II 8.1 REQUIRED +FIND_PACKAGE(deal.II 8.0 REQUIRED HINTS ${DEAL_II_BINARY_DIR} ${DEAL_II_DIR} ) INCLUDE(${DEAL_II_TARGET_CONFIG}) -- 2.39.5