From 01ebd33fa5eaf0392e9a12622deb0c98f51c0800 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 26 Mar 2015 15:36:35 +0100 Subject: [PATCH] CMake: Refactor testsuite setup into DEAL_II_PICKUP_TESTS This commit refactors all the testsuite setup that was originally done in setup_testsuitesubproject.cmake into the DEAL_II_PICKUP_TESTS macro defined in ./cmake/macros/macro_deal_ii_pickup_tests.cmake --- cmake/macros/macro_deal_ii_pickup_tests.cmake | 107 ++++++++++++++- cmake/macros/macro_set_if_empty.cmake | 3 +- tests/CMakeLists.txt | 6 +- tests/a-framework/CMakeLists.txt | 1 - tests/algorithms/CMakeLists.txt | 1 - tests/all-headers/CMakeLists.txt | 6 +- tests/aniso/CMakeLists.txt | 1 - tests/arpack/CMakeLists.txt | 1 - tests/base/CMakeLists.txt | 1 - tests/bits/CMakeLists.txt | 1 - tests/build_tests/CMakeLists.txt | 6 +- tests/codim_one/CMakeLists.txt | 1 - tests/deal.II/CMakeLists.txt | 1 - tests/distributed_grids/CMakeLists.txt | 1 - tests/fe/CMakeLists.txt | 1 - tests/gla/CMakeLists.txt | 1 - tests/grid/CMakeLists.txt | 1 - tests/hp/CMakeLists.txt | 1 - tests/integrators/CMakeLists.txt | 1 - tests/lac/CMakeLists.txt | 1 - tests/lapack/CMakeLists.txt | 1 - tests/manifold/CMakeLists.txt | 1 - tests/matrix_free/CMakeLists.txt | 1 - tests/mesh_converter/CMakeLists.txt | 8 +- tests/metis/CMakeLists.txt | 1 - tests/mpi/CMakeLists.txt | 1 - tests/multigrid/CMakeLists.txt | 1 - tests/opencascade/CMakeLists.txt | 1 - tests/petsc/CMakeLists.txt | 1 - tests/serialization/CMakeLists.txt | 1 - tests/setup_testsubproject.cmake | 127 +----------------- tests/slepc/CMakeLists.txt | 1 - tests/trilinos/CMakeLists.txt | 1 - tests/umfpack/CMakeLists.txt | 1 - 34 files changed, 130 insertions(+), 160 deletions(-) diff --git a/cmake/macros/macro_deal_ii_pickup_tests.cmake b/cmake/macros/macro_deal_ii_pickup_tests.cmake index 3d4b1c109d..397661f90e 100644 --- a/cmake/macros/macro_deal_ii_pickup_tests.cmake +++ b/cmake/macros/macro_deal_ii_pickup_tests.cmake @@ -14,18 +14,123 @@ ## --------------------------------------------------------------------- # -# A macro to pick up all tests in a test subdirectory +# A macro to set up testing and pick up all tests in a test subdirectory. # # If TEST_PICKUP_REGEX is set, only tests matching the regex will be # processed. # +# Furthermore, the macro sets up (if necessary) deal.II, perl, a diff tool +# and the following variables, that can be overwritten by environment or +# command line: +# +# TEST_DIFF +# TEST_TIME_LIMIT +# TEST_PICKUP_REGEX +# # Usage: # DEAL_II_PICKUP_TESTS() # + +# +# Used in DEAL_II_PICKUP_TESTS +# +MACRO(SET_IF_EMPTY _variable) + IF("${${_variable}}" STREQUAL "") + SET(${_variable} ${ARGN}) + ENDIF() +ENDMACRO() + +# +# Used in DEAL_II_ADD_TEST +# +MACRO(ITEM_MATCHES _var _regex) + SET(${_var}) + FOREACH (_item ${ARGN}) + IF("${_item}" MATCHES ${_regex}) + SET(${_var} TRUE) + BREAK() + ENDIF() + ENDFOREACH() +ENDMACRO() + + MACRO(DEAL_II_PICKUP_TESTS) + + IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDED) + MESSAGE(FATAL_ERROR + "\nDEAL_II_PICKUP_TESTS can only be called in external (test sub-) " + "projects after the inclusion of deal.IIConfig.cmake. It is not " + "intended for internal use.\n\n" + ) + ENDIF() + + IF(NOT DEAL_II_TARGET_CONFIG_INCLUDED) + INCLUDE(${DEAL_II_TARGET_CONFIG}) + SET(DEAL_II_TARGET_CONFIG_INCLUDED TRUE) + ENDIF() + + # + # We need perl: + # + + FIND_PACKAGE(Perl REQUIRED) + + # + # We need a diff tool, preferably numdiff: + # + + FIND_PROGRAM(DIFF_EXECUTABLE + NAMES diff + HINTS ${DIFF_DIR} + PATH_SUFFIXES bin + ) + + FIND_PROGRAM(NUMDIFF_EXECUTABLE + NAMES numdiff + HINTS ${NUMDIFF_DIR} + PATH_SUFFIXES bin + ) + + MARK_AS_ADVANCED(DIFF_EXECUTABLE NUMDIFF_EXECUTABLE) + + SET_IF_EMPTY(TEST_DIFF "$ENV{TEST_DIFF}") + IF("${TEST_DIFF}" STREQUAL "") + # + # No TEST_DIFF is set, specify one: + # + + IF(NOT NUMDIFF_EXECUTABLE MATCHES "-NOTFOUND") + SET(TEST_DIFF ${NUMDIFF_EXECUTABLE} -a 1e-6 -r 1e-8 -s ' \\t\\n:<>=,;') + IF(DIFF_EXECUTABLE MATCHES "-NOTFOUND") + SET(DIFF_EXECUTABLE ${NUMDIFF_EXECUTABLE}) + ENDIF() + ELSEIF(NOT DIFF_EXECUTABLE MATCHES "-NOTFOUND") + SET(TEST_DIFF ${DIFF_EXECUTABLE}) + ELSE() + MESSAGE(FATAL_ERROR + "Could not find diff or numdiff. One of those are required for running the testsuite.\n" + "Please specify TEST_DIFF by hand." + ) + ENDIF() + ENDIF() + + SET_IF_EMPTY(TEST_TIME_LIMIT "$ENV{TEST_TIME_LIMIT}") + SET_IF_EMPTY(TEST_TIME_LIMIT 600) + + # + # Enable testing... + # + + ENABLE_TESTING() + + # + # ... and finally pick up tests: + # + SET_IF_EMPTY(TEST_PICKUP_REGEX "$ENV{TEST_PICKUP_REGEX}") + GET_FILENAME_COMPONENT(_category ${CMAKE_CURRENT_SOURCE_DIR} NAME) SET(DEAL_II_SOURCE_DIR) # avoid a bogus warning diff --git a/cmake/macros/macro_set_if_empty.cmake b/cmake/macros/macro_set_if_empty.cmake index b1ce77ffa8..05e0aeb291 100644 --- a/cmake/macros/macro_set_if_empty.cmake +++ b/cmake/macros/macro_set_if_empty.cmake @@ -1,6 +1,6 @@ ## --------------------------------------------------------------------- ## -## Copyright (C) 2012 - 2014 by the deal.II authors +## Copyright (C) 2012 - 2015 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -21,4 +21,3 @@ MACRO(SET_IF_EMPTY _variable) SET(${_variable} ${ARGN}) ENDIF() ENDMACRO() - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6879a5caf3..d611c3db6f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -46,8 +46,10 @@ FILE(WRITE ${CMAKE_BINARY_DIR}/tests/CTestTestfile.cmake "") # SET(_options "") -LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR}) -LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}) +LIST(APPEND _options + -DDEAL_II_DIR=${CMAKE_BINARY_DIR} + -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR} + ) FOREACH(_var DIFF_DIR NUMDIFF_DIR TEST_DIFF TEST_PICKUP_REGEX TEST_TIME_LIMIT MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS MPIEXEC_POSTFLAGS diff --git a/tests/a-framework/CMakeLists.txt b/tests/a-framework/CMakeLists.txt index 73bbb73385..e8698c4f17 100644 --- a/tests/a-framework/CMakeLists.txt +++ b/tests/a-framework/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() # diff --git a/tests/algorithms/CMakeLists.txt b/tests/algorithms/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/algorithms/CMakeLists.txt +++ b/tests/algorithms/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/all-headers/CMakeLists.txt b/tests/all-headers/CMakeLists.txt index 0597365743..08533b7180 100644 --- a/tests/all-headers/CMakeLists.txt +++ b/tests/all-headers/CMakeLists.txt @@ -16,7 +16,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) + +# +# Set up test environment (does not pick up anything): +# +DEAL_II_PICKUP_TESTS() # # Header tests are special: diff --git a/tests/aniso/CMakeLists.txt b/tests/aniso/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/aniso/CMakeLists.txt +++ b/tests/aniso/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/arpack/CMakeLists.txt b/tests/arpack/CMakeLists.txt index fb428b8238..7b57c1e4e8 100644 --- a/tests/arpack/CMakeLists.txt +++ b/tests/arpack/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF(DEAL_II_WITH_ARPACK) DEAL_II_PICKUP_TESTS() ENDIF() diff --git a/tests/base/CMakeLists.txt b/tests/base/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/base/CMakeLists.txt +++ b/tests/base/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/bits/CMakeLists.txt b/tests/bits/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/bits/CMakeLists.txt +++ b/tests/bits/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/build_tests/CMakeLists.txt b/tests/build_tests/CMakeLists.txt index 04cce5bc90..8279e6741a 100644 --- a/tests/build_tests/CMakeLists.txt +++ b/tests/build_tests/CMakeLists.txt @@ -16,7 +16,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) + +# +# Set up test environment (does not pick up anything): +# +DEAL_II_PICKUP_TESTS() # # build_tests tests are special: diff --git a/tests/codim_one/CMakeLists.txt b/tests/codim_one/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/codim_one/CMakeLists.txt +++ b/tests/codim_one/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/deal.II/CMakeLists.txt b/tests/deal.II/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/deal.II/CMakeLists.txt +++ b/tests/deal.II/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/distributed_grids/CMakeLists.txt b/tests/distributed_grids/CMakeLists.txt index 6f92c291bf..4c1a02d789 100644 --- a/tests/distributed_grids/CMakeLists.txt +++ b/tests/distributed_grids/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF(DEAL_II_WITH_P4EST) DEAL_II_PICKUP_TESTS() ENDIF() diff --git a/tests/fe/CMakeLists.txt b/tests/fe/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/fe/CMakeLists.txt +++ b/tests/fe/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/gla/CMakeLists.txt b/tests/gla/CMakeLists.txt index af5f8ec27a..3f784ff97f 100644 --- a/tests/gla/CMakeLists.txt +++ b/tests/gla/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF(DEAL_II_WITH_MPI AND DEAL_II_WITH_P4EST AND DEAL_II_WITH_PETSC AND DEAL_II_WITH_TRILINOS) DEAL_II_PICKUP_TESTS() ENDIF() diff --git a/tests/grid/CMakeLists.txt b/tests/grid/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/grid/CMakeLists.txt +++ b/tests/grid/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/hp/CMakeLists.txt b/tests/hp/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/hp/CMakeLists.txt +++ b/tests/hp/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/integrators/CMakeLists.txt b/tests/integrators/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/integrators/CMakeLists.txt +++ b/tests/integrators/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/lac/CMakeLists.txt b/tests/lac/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/lac/CMakeLists.txt +++ b/tests/lac/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/lapack/CMakeLists.txt b/tests/lapack/CMakeLists.txt index 2e6d0bece9..a57b08ece7 100644 --- a/tests/lapack/CMakeLists.txt +++ b/tests/lapack/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF(DEAL_II_WITH_LAPACK) DEAL_II_PICKUP_TESTS() ENDIF() diff --git a/tests/manifold/CMakeLists.txt b/tests/manifold/CMakeLists.txt index cc2a5e106c..616b94a3b4 100644 --- a/tests/manifold/CMakeLists.txt +++ b/tests/manifold/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/matrix_free/CMakeLists.txt b/tests/matrix_free/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/matrix_free/CMakeLists.txt +++ b/tests/matrix_free/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/mesh_converter/CMakeLists.txt b/tests/mesh_converter/CMakeLists.txt index 174b149b2b..4bac44690c 100644 --- a/tests/mesh_converter/CMakeLists.txt +++ b/tests/mesh_converter/CMakeLists.txt @@ -1,6 +1,6 @@ ## --------------------------------------------------------------------- ## -## Copyright (C) 2013 - 2014 by the deal.II authors +## Copyright (C) 2013 - 2015 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -16,7 +16,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) + +# +# Set up test environment (does not pick up anything): +# +DEAL_II_PICKUP_TESTS() # # Tests for the mesh_converter executable diff --git a/tests/metis/CMakeLists.txt b/tests/metis/CMakeLists.txt index 45b58a662c..37c3ae108d 100644 --- a/tests/metis/CMakeLists.txt +++ b/tests/metis/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF(DEAL_II_WITH_METIS) DEAL_II_PICKUP_TESTS() ENDIF() diff --git a/tests/mpi/CMakeLists.txt b/tests/mpi/CMakeLists.txt index 7726db808c..bd0697dbb7 100644 --- a/tests/mpi/CMakeLists.txt +++ b/tests/mpi/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF(DEAL_II_WITH_MPI AND DEAL_II_WITH_P4EST) DEAL_II_PICKUP_TESTS() ENDIF() diff --git a/tests/multigrid/CMakeLists.txt b/tests/multigrid/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/multigrid/CMakeLists.txt +++ b/tests/multigrid/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/opencascade/CMakeLists.txt b/tests/opencascade/CMakeLists.txt index f759a1d939..e586a5e365 100644 --- a/tests/opencascade/CMakeLists.txt +++ b/tests/opencascade/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF(DEAL_II_WITH_OPENCASCADE) DEAL_II_PICKUP_TESTS() ENDIF() diff --git a/tests/petsc/CMakeLists.txt b/tests/petsc/CMakeLists.txt index f68f8d28a1..e04dc4b2d6 100644 --- a/tests/petsc/CMakeLists.txt +++ b/tests/petsc/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF(DEAL_II_WITH_PETSC) DEAL_II_PICKUP_TESTS() ENDIF() diff --git a/tests/serialization/CMakeLists.txt b/tests/serialization/CMakeLists.txt index 0b20ef4e0b..bd1bc1e332 100644 --- a/tests/serialization/CMakeLists.txt +++ b/tests/serialization/CMakeLists.txt @@ -1,5 +1,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/setup_testsubproject.cmake b/tests/setup_testsubproject.cmake index 4488e3d4af..ca24918939 100644 --- a/tests/setup_testsubproject.cmake +++ b/tests/setup_testsubproject.cmake @@ -1,136 +1,15 @@ -## --------------------------------------------------------------------- -## -## Copyright (C) 2013 by the deal.II authors -## -## This file is part of the deal.II library. -## -## The deal.II library is free software; you can use it, redistribute -## it, and/or modify it under the terms of the GNU Lesser General -## Public License as published by the Free Software Foundation; either -## version 2.1 of the License, or (at your option) any later version. -## The full text of the license can be found in the file LICENSE at -## the top level of the deal.II distribution. -## -## --------------------------------------------------------------------- - -# -# Setup necessary configuration in the testsuite subprojects. -# This file is directly included by the test subprojects and not by the -# main project. -# -# It is assumed that the following variables are set: -# -# DEAL_II_BINARY_DIR -# DEAL_II_SOURCE_DIR -# - pointing to a source and binary directory of a deal.II build -# -# This file sets up the following options, that can be overwritten by -# environment or command line: -# -# TEST_DIFF -# TEST_PICKUP_REGEX -# TEST_TIME_LIMIT -# +FIND_PACKAGE(deal.II 8.0 REQUIRED HINTS ${DEAL_II_DIR}) +SET(CMAKE_CXX_COMPILER ${DEAL_II_CXX_COMPILER} CACHE STRING "CXX Compiler.") # # Silence warnings: # -FOREACH(_var - MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_POSTFLAGS MPIEXEC_PREFLAGS - ) +FOREACH(_var MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_POSTFLAGS MPIEXEC_PREFLAGS) SET(${_var} ${${_var}}) ENDFOREACH() -# -# Load all macros: -# -FILE(GLOB _macro_files ${DEAL_II_SOURCE_DIR}/cmake/macros/*.cmake) -FOREACH(_file ${_macro_files}) - INCLUDE(${_file}) -ENDFOREACH() - -# -# Pick up values from environment: -# -FOREACH(_var - DEAL_II_BINARY_DIR - DEAL_II_SOURCE_DIR - TEST_DIFF - TEST_TIME_LIMIT - TEST_PICKUP_REGEX - ) - IF(DEFINED ENV{${_var}}) - SET(${_var} $ENV{${_var}}) - ENDIF() - IF(NOT "${${_var}}" STREQUAL "") - SET(${_var} "${${_var}}" CACHE STRING "" FORCE) - ENDIF() -ENDFOREACH() - -# -# We need deal.II and Perl as external packages: -# - -FIND_PACKAGE(deal.II 8.0 REQUIRED - HINTS ${DEAL_II_BINARY_DIR} ${DEAL_II_DIR} - ) -SET(CMAKE_CXX_COMPILER ${DEAL_II_CXX_COMPILER} CACHE STRING "CXX Compiler.") - -FIND_PACKAGE(Perl REQUIRED) - -# -# We need a diff tool, preferably numdiff: -# - -FIND_PROGRAM(DIFF_EXECUTABLE - NAMES diff - HINTS ${DIFF_DIR} - PATH_SUFFIXES bin - ) - -FIND_PROGRAM(NUMDIFF_EXECUTABLE - NAMES numdiff - HINTS ${NUMDIFF_DIR} - PATH_SUFFIXES bin - ) - -MARK_AS_ADVANCED(DIFF_EXECUTABLE NUMDIFF_EXECUTABLE) - -IF("${TEST_DIFF}" STREQUAL "") - # - # No TEST_DIFF is set, specify one: - # - - IF(NOT NUMDIFF_EXECUTABLE MATCHES "-NOTFOUND") - SET(TEST_DIFF ${NUMDIFF_EXECUTABLE} -a 1e-6 -r 1e-8 -s ' \\t\\n:<>=,;') - IF(DIFF_EXECUTABLE MATCHES "-NOTFOUND") - SET(DIFF_EXECUTABLE ${NUMDIFF_EXECUTABLE}) - ENDIF() - ELSEIF(NOT DIFF_EXECUTABLE MATCHES "-NOTFOUND") - SET(TEST_DIFF ${DIFF_EXECUTABLE}) - ELSE() - MESSAGE(FATAL_ERROR - "Could not find diff or numdiff. One of those are required for running the testsuite.\n" - "Please specify TEST_DIFF by hand." - ) - ENDIF() -ENDIF() - -# -# Set a default time limit of 600 seconds: -# - -SET_IF_EMPTY(TEST_TIME_LIMIT 600) - -# -# And finally, enable testing: -# - -ENABLE_TESTING() - # # A custom target that does absolutely nothing. It is used in the main # project to trigger a "make rebuild_cache" if necessary. # - ADD_CUSTOM_TARGET(regenerate) diff --git a/tests/slepc/CMakeLists.txt b/tests/slepc/CMakeLists.txt index 96df21c6f7..209690137c 100644 --- a/tests/slepc/CMakeLists.txt +++ b/tests/slepc/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF((DEAL_II_WITH_PETSC) AND (DEAL_II_WITH_SLEPC)) DEAL_II_PICKUP_TESTS() ENDIF() diff --git a/tests/trilinos/CMakeLists.txt b/tests/trilinos/CMakeLists.txt index c7819bf6f2..4a33afc686 100644 --- a/tests/trilinos/CMakeLists.txt +++ b/tests/trilinos/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF(DEAL_II_WITH_TRILINOS) DEAL_II_PICKUP_TESTS() ENDIF() diff --git a/tests/umfpack/CMakeLists.txt b/tests/umfpack/CMakeLists.txt index 1d50186b0d..538a3c32c1 100644 --- a/tests/umfpack/CMakeLists.txt +++ b/tests/umfpack/CMakeLists.txt @@ -1,7 +1,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9) INCLUDE(${DEAL_II_SOURCE_DIR}/tests/setup_testsubproject.cmake) PROJECT(testsuite CXX) -INCLUDE(${DEAL_II_TARGET_CONFIG}) IF(DEAL_II_WITH_UMFPACK) DEAL_II_PICKUP_TESTS() ENDIF() -- 2.39.5