## ---------------------------------------------------------------------
#
-# 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
## ---------------------------------------------------------------------
##
-## 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.
##
SET(${_variable} ${ARGN})
ENDIF()
ENDMACRO()
-
#
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
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()
#
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()
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:
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()
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()
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()
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()
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:
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
## ---------------------------------------------------------------------
##
-## 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.
##
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
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()
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()
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()
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()
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()
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()
-## ---------------------------------------------------------------------
-##
-## 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)
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()
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()
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()