From 5ae44b199e5fcf56858ddb1dc75f7ae094cc9a4c Mon Sep 17 00:00:00 2001 From: maier Date: Thu, 10 Oct 2013 13:22:02 +0000 Subject: [PATCH] Refactor test layout: Move all relevant parts of the new testsuite to the source directory so that it can still be run if ./tests is unavailable git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31194 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/CMakeLists.txt | 6 +- .../cmake/macros/macro_add_test.cmake | 11 +- .../cmake/macros/macro_pickup_tests.cmake | 0 {tests => deal.II}/cmake/scripts/normalize.pl | 0 deal.II/cmake/scripts/run_test.cmake | 60 +-- deal.II/cmake/scripts/run_testsuite.cmake | 460 ++++++++++++++++++ .../cmake/setup_testsuite.cmake | 16 +- deal.II/tests/CMakeLists.txt | 158 +++--- .../tests}/all-headers/CMakeLists.txt | 8 +- .../tests}/all-headers/test_header.cc | 0 .../tests}/build_tests/CMakeLists.txt | 8 +- deal.II/tests/quick_tests/CMakeLists.txt | 56 +++ deal.II/tests/{ => quick_tests}/affinity.cc | 0 tests/CMakeLists.txt | 152 +----- tests/TODO | 4 +- tests/a-framework/CMakeLists.txt | 2 +- tests/aniso/CMakeLists.txt | 2 +- tests/base/CMakeLists.txt | 2 +- tests/bits/CMakeLists.txt | 2 +- tests/cmake/macros/macro_item_matches.cmake | 35 -- tests/cmake/macros/macro_set_if_empty.cmake | 25 - tests/cmake/scripts/run_test.cmake | 76 --- tests/codim_one/CMakeLists.txt | 2 +- tests/deal.II/CMakeLists.txt | 2 +- tests/distributed_grids/CMakeLists.txt | 6 +- tests/fail/CMakeLists.txt | 2 +- tests/fe/CMakeLists.txt | 2 +- tests/gla/CMakeLists.txt | 6 +- tests/grid/CMakeLists.txt | 2 +- tests/hp/CMakeLists.txt | 2 +- tests/integrators/CMakeLists.txt | 2 +- tests/lac/CMakeLists.txt | 2 +- tests/lapack/CMakeLists.txt | 6 +- tests/matrix_free/CMakeLists.txt | 2 +- tests/metis/CMakeLists.txt | 6 +- tests/mpi/CMakeLists.txt | 6 +- tests/multigrid/CMakeLists.txt | 2 +- tests/petsc/CMakeLists.txt | 6 +- tests/run_buildtests.cmake | 2 + tests/run_testsuite.cmake | 433 +---------------- tests/serialization/CMakeLists.txt | 2 +- tests/slepc/CMakeLists.txt | 6 +- tests/trilinos/CMakeLists.txt | 6 +- tests/umfpack/CMakeLists.txt | 6 +- 44 files changed, 718 insertions(+), 876 deletions(-) rename {tests => deal.II}/cmake/macros/macro_add_test.cmake (95%) rename {tests => deal.II}/cmake/macros/macro_pickup_tests.cmake (100%) rename {tests => deal.II}/cmake/scripts/normalize.pl (100%) create mode 100644 deal.II/cmake/scripts/run_testsuite.cmake rename {tests => deal.II}/cmake/setup_testsuite.cmake (89%) rename {tests => deal.II/tests}/all-headers/CMakeLists.txt (93%) rename {tests => deal.II/tests}/all-headers/test_header.cc (100%) rename {tests => deal.II/tests}/build_tests/CMakeLists.txt (97%) create mode 100644 deal.II/tests/quick_tests/CMakeLists.txt rename deal.II/tests/{ => quick_tests}/affinity.cc (100%) delete mode 100644 tests/cmake/macros/macro_item_matches.cmake delete mode 100644 tests/cmake/macros/macro_set_if_empty.cmake delete mode 100644 tests/cmake/scripts/run_test.cmake create mode 100644 tests/run_buildtests.cmake diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 81ee9592e8..c5e09474bc 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -145,11 +145,7 @@ ADD_SUBDIRECTORY(cmake/config) # has to be included after source ADD_SUBDIRECTORY(contrib) # has to be included after source ADD_SUBDIRECTORY(examples) -ADD_SUBDIRECTORY(tests ${CMAKE_BINARY_DIR}/tests/quick_tests) - -IF(DEAL_II_HAVE_TESTS_DIRECTORY) - ADD_SUBDIRECTORY(${TEST_DIR} ${CMAKE_BINARY_DIR}/tests) -ENDIF() +ADD_SUBDIRECTORY(tests) # # And finally, print the configuration: diff --git a/tests/cmake/macros/macro_add_test.cmake b/deal.II/cmake/macros/macro_add_test.cmake similarity index 95% rename from tests/cmake/macros/macro_add_test.cmake rename to deal.II/cmake/macros/macro_add_test.cmake index c32d1a702f..a6988695aa 100644 --- a/tests/cmake/macros/macro_add_test.cmake +++ b/deal.II/cmake/macros/macro_add_test.cmake @@ -26,11 +26,6 @@ # - specifying the maximal wall clock time in seconds a test is allowed # to run # -# TEST_DIR -# - pointing to the ./tests folder where normalize.pl and run_test.cmake are -# located under cmake/scripts -# -# # Usage: # DEAL_II_ADD_TEST(category test_name comparison_file n_cpu [configurations]) # @@ -138,13 +133,13 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file _n_cpu) && cat ${_test_directory}/failing_output && exit 1) COMMAND - ${PERL_EXECUTABLE} -pi ${TEST_DIR}/cmake/scripts/normalize.pl + ${PERL_EXECUTABLE} -pi ${DEAL_II_SOURCE_DIR}/cmake/scripts/normalize.pl ${_test_directory}/output WORKING_DIRECTORY ${_test_directory} DEPENDS ${_target} - ${TEST_DIR}/cmake/scripts/normalize.pl + ${DEAL_II_SOURCE_DIR}/cmake/scripts/normalize.pl ) ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/diff COMMAND touch ${_test_directory}/diff @@ -184,7 +179,7 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file _n_cpu) -DTRGT=${_diff_target} -DTEST=${_test_full} -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} - -P ${TEST_DIR}/cmake/scripts/run_test.cmake + -P ${DEAL_II_SOURCE_DIR}/cmake/scripts/run_test.cmake WORKING_DIRECTORY ${_test_directory} ) SET_TESTS_PROPERTIES(${_test_full} PROPERTIES diff --git a/tests/cmake/macros/macro_pickup_tests.cmake b/deal.II/cmake/macros/macro_pickup_tests.cmake similarity index 100% rename from tests/cmake/macros/macro_pickup_tests.cmake rename to deal.II/cmake/macros/macro_pickup_tests.cmake diff --git a/tests/cmake/scripts/normalize.pl b/deal.II/cmake/scripts/normalize.pl similarity index 100% rename from tests/cmake/scripts/normalize.pl rename to deal.II/cmake/scripts/normalize.pl diff --git a/deal.II/cmake/scripts/run_test.cmake b/deal.II/cmake/scripts/run_test.cmake index 1955519fdf..4a27a36ee6 100644 --- a/deal.II/cmake/scripts/run_test.cmake +++ b/deal.II/cmake/scripts/run_test.cmake @@ -1,9 +1,27 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## 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. +## +## --------------------------------------------------------------------- + +# +# This is a small worker to run a single test in the testsuite # -# TODO: The following variables have to be set: +# The following variables have to be set: # -# TARGET -# TEST -# DEAL_II_BINARY_DIR +# TRGT - the name of the target that should be invoked +# TEST - the test name (used for status messages) +# DEAL_II_BINARY_DIR - the build directory that contains the target # EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} @@ -16,27 +34,8 @@ IF("${_result_code}" STREQUAL "0") MESSAGE("Test ${TEST}: PASSED") MESSAGE("=============================== OUTPUT BEGIN ===============================") - # # Do not output everything, just that we are successful: - # - IF(TRGT MATCHES "\\.diff$") # ordinary test: - MESSAGE("${TEST}: BUILD successful.") - MESSAGE("${TEST}: RUN successful.") - MESSAGE("${TEST}: DIFF successful.") - MESSAGE("${TEST}: PASSED.") - ELSEIF(TRGT MATCHES "\\.run$") # build_test for steps: - MESSAGE("${TEST}: CONFIGURE successful.") - MESSAGE("${TEST}: BUILD successful.") - MESSAGE("${TEST}: RUN successful.") - MESSAGE("${TEST}: PASSED.") - ELSEIF(TRGT MATCHES "\\.build$") # build_test for steps: - MESSAGE("${TEST}: CONFIGURE successful.") - MESSAGE("${TEST}: BUILD successful.") - MESSAGE("${TEST}: PASSED.") - ELSE() # all-headers test: - MESSAGE("${TEST}: BUILD successful.") - MESSAGE("${TEST}: PASSED.") - ENDIF() + MESSAGE("${TEST}: PASSED.") MESSAGE("=============================== OUTPUT END ===============================") ELSE() @@ -45,11 +44,12 @@ ELSE() # Determine whether the CONFIGURE, BUILD or RUN stages were run successfully: # - # configure is special because it only exists in build tests: - STRING(REGEX MATCH "${TEST}: CONFIGURE failed\\." _configure_regex ${_output}) + # CONFIGURE is special because it only exists in build tests: + STRING(REGEX MATCH "${TEST}: CONFIGURE successful\\." _configure_regex ${_output}) + STRING(REGEX MATCH "${TEST}: CONFIGURE failed\\." _configure_regex_fail ${_output}) STRING(REGEX MATCH "${TEST}: BUILD successful\\." _build_regex ${_output}) STRING(REGEX MATCH "${TEST}: RUN successful\\." _run_regex ${_output}) - IF(NOT "${_configure_regex}" STREQUAL "") + IF(NOT "${_configure_regex_fail}" STREQUAL "") SET(_stage CONFIGURE) ELSEIF("${_build_regex}" STREQUAL "") SET(_stage BUILD) @@ -59,11 +59,11 @@ ELSE() SET(_stage DIFF) ENDIF() - MESSAGE("Test ${TEST}: ${_stage}") MESSAGE("=============================== OUTPUT BEGIN ===============================") - IF("${_build_regex}" STREQUAL "") - # Some special output in case the BUILD stage failed: + IF( "${_build_regex}" STREQUAL "" AND + "${_configure_regex}" STREQUAL "" ) + # Some special output in case the BUILD stage failed in a regression test: MESSAGE("${TEST}: BUILD failed. Output:") ENDIF() MESSAGE(${_output}) diff --git a/deal.II/cmake/scripts/run_testsuite.cmake b/deal.II/cmake/scripts/run_testsuite.cmake new file mode 100644 index 0000000000..2a2b11549f --- /dev/null +++ b/deal.II/cmake/scripts/run_testsuite.cmake @@ -0,0 +1,460 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## 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. +## +## --------------------------------------------------------------------- + + +######################################################################## +# # +# Test setup: # +# # +######################################################################## + +# +# This is the ctest script for running and submitting build and regression +# tests. +# +# Invoke it in a _build directory_ (or designated build directory) via: +# +# ctest -S <...>/run_testsuite.cmake +# +# The following configuration variables can be overwritten with +# +# ctest -D= [...] +# +# +# CTEST_SOURCE_DIRECTORY +# - The source directory of deal.II (usually ending in "[...]/deal.II" +# (equivalent to https://svn.dealii.org/trunk/deal.II) +# Note: This is _not_ the test directory ending in "[...]/tests" +# - If unspecified, "../deal.II" relative to the location of this +# script is used. If this is not a source directory, an error is +# thrown. +# +# CTEST_BINARY_DIRECTORY +# - The designated build directory (already configured, empty, or non +# existent - see the information about TRACKs what will happen) +# - If unspecified the current directory is used. If the current +# directory is equal to CTEST_SOURCE_DIRECTORY or the "tests" +# directory, an error is thrown. +# +# CTEST_CMAKE_GENERATOR +# - The CMake Generator to use (e.g. "Unix Makefiles", or "Ninja", see +# $ man cmake) +# - If unspecified the generator of a configured build directory will +# be used, otherwise "Unix Makefiles". +# +# TRACK +# - The track the test should be submitted to. Defaults to +# "Experimental". Possible values are: +# +# "Experimental" - all tests that are not specifically "build" or +# "regression" tests should go into this track +# +# "Build Tests" - Build tests that configure and build in a +# clean directory and run the build tests +# "build_tests/*" +# +# "Regression Tests" - Reserved for the Regression tester +# +# CONFIG_FILE +# - A configuration file (see ../deal.II/docs/development/Config.sample) +# that will be used during the configuration stage (invokes +# # cmake -C ${CONFIG_FILE}). This only has an effect if +# CTEST_BINARY_DIRECTORY is empty. +# +# Furthermore, the following variables controlling the testsuite can be set +# and will be automatically handed down to cmake: +# +# TEST_DIFF +# TEST_TIME_LIMIT +# TEST_PICKUP_REGEX +# NUMDIFF_DIR +# +# For details, consult the ./README file. +# + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +MESSAGE("-- This is CTest ${CMAKE_VERSION}") + +# +# TRACK: Default to Experimental: +# + +IF("${TRACK}" STREQUAL "") + SET(TRACK "Experimental") +ENDIF() + +IF( NOT "${TRACK}" STREQUAL "Experimental" + AND NOT "${TRACK}" STREQUAL "Build Tests" + AND NOT "${TRACK}" STREQUAL "Regression Tests" ) + MESSAGE(FATAL_ERROR " +Unknown TRACK \"${TRACK}\" - see the manual for valid values. +" + ) +ENDIF() + +MESSAGE("-- TRACK: ${TRACK}") + +# +# CTEST_SOURCE_DIRECTORY: +# + +IF("${CTEST_SOURCE_DIRECTORY}" STREQUAL "") + # + # If CTEST_SOURCE_DIRECTORY is not set we just assume that this script + # was called residing under (a) ../tests relative to the source directory + # or (b) cmake/scipts in the source directory + # + GET_FILENAME_COMPONENT(_path "${CMAKE_CURRENT_LIST_DIR}" PATH) + SET(CTEST_SOURCE_DIRECTORY ${_path}/deal.II) + + IF(NOT EXISTS ${CTEST_SOURCE_DIRECTORY}/CMakeLists.txt) + GET_FILENAME_COMPONENT(_path "${_path}" PATH) + SET(CTEST_SOURCE_DIRECTORY ${_path}) + ENDIF() + + IF(NOT EXISTS ${CTEST_SOURCE_DIRECTORY}/CMakeLists.txt) + MESSAGE(FATAL_ERROR " +Could not find a suitable source directory. There is no source directory +\"../deal.II\" or \"../../\" relative to the location of this script. +Please, set CTEST_SOURCE_DIRECTORY manually to the appropriate source +directory. +" + ) + ENDIF() +ENDIF() + +MESSAGE("-- CTEST_SOURCE_DIRECTORY: ${CTEST_SOURCE_DIRECTORY}") + +# +# Read in custom config files: +# + +CTEST_READ_CUSTOM_FILES(${CTEST_SOURCE_DIRECTORY}) + +# +# CTEST_BINARY_DIRECTORY: +# + +IF("${CTEST_BINARY_DIRECTORY}" STREQUAL "") + # + # If CTEST_BINARY_DIRECTORY is not set we just use the current directory + # except if it is equal to CTEST_SOURCE_DIRECTORY in which case we fail. + # + SET(CTEST_BINARY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + IF( "${CTEST_BINARY_DIRECTORY}" STREQUAL "${CTEST_SOURCE_DIR}" + OR "${CTEST_BINARY_DIRECTORY}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}" ) + MESSAGE(FATAL_ERROR " +ctest was invoked in the source directory (or test source directory) and CTEST_BINARY_DIRECTORY is not set. +Please either call ctest from within a designated build directory, or set CTEST_BINARY_DIRECTORY accordingly. +" + ) + ENDIF() +ENDIF() + +# +# Read in custom config files: +# + +CTEST_READ_CUSTOM_FILES(${CTEST_BINARY_DIRECTORY}) + +# Make sure that for a build test the directory is empty: +FILE(GLOB _test ${CTEST_BINARY_DIRECTORY}/*) +IF( "${TRACK}" STREQUAL "Build Tests" + AND NOT "${_test}" STREQUAL "" ) + MESSAGE(FATAL_ERROR " +TRACK was set to \"Build Tests\" which require an empty build directory. +But files were found in \"${CTEST_BINARY_DIRECTORY}\" +" + ) +ENDIF() + +MESSAGE("-- CTEST_BINARY_DIRECTORY: ${CTEST_BINARY_DIRECTORY}") + +# +# CTEST_CMAKE_GENERATOR: +# + +# Query Generator from build directory (if possible): +IF(EXISTS ${CTEST_BINARY_DIRECTORY}/CMakeCache.txt) + FILE(STRINGS ${CTEST_BINARY_DIRECTORY}/CMakeCache.txt _generator + REGEX "^CMAKE_GENERATOR:" + ) + STRING(REGEX REPLACE "^.*=" "" _generator ${_generator}) +ENDIF() + +IF("${CTEST_CMAKE_GENERATOR}" STREQUAL "") + IF(NOT "${_generator}" STREQUAL "") + SET(CTEST_CMAKE_GENERATOR ${_generator}) + ELSE() + # default to "Unix Makefiles" + SET(CTEST_CMAKE_GENERATOR "Unix Makefiles") + ENDIF() +ELSE() + # ensure that CTEST_CMAKE_GENERATOR (that was apparantly set) is + # compatible with the build directory: + IF( NOT "${CTEST_CMAKE_GENERATOR}" STREQUAL "${_generator}" + AND NOT "${_generator}" STREQUAL "" ) + MESSAGE(FATAL_ERROR " +The build directory is already set up with Generator \"${_generator}\", but +CTEST_CMAKE_GENERATOR was set to a different Generator \"${CTEST_CMAKE_GENERATOR}\". +" + ) + ENDIF() +ENDIF() + +# +# CTEST_SITE: +# + +FIND_PROGRAM(HOSTNAME_COMMAND NAMES hostname) +EXEC_PROGRAM(${HOSTNAME_COMMAND} OUTPUT_VARIABLE _hostname) +SET(CTEST_SITE "${_hostname}") + +MESSAGE("-- CTEST_SITE: ${CTEST_SITE}") + +IF( "${TRACK}" STREQUAL "Regression Tests" + AND NOT CTEST_SITE MATCHES "c0541" ) + MESSAGE(FATAL_ERROR " +I'm sorry ${CTEST_SITE}, I'm afraid I can't do that. +The TRACK \"Regression Tests\" is not for you. +" + ) +ENDIF() + +# +# Assemble configuration options, we need it now: +# + +IF(NOT "${CONFIG_FILE}" STREQUAL "") + SET(_options "-C${CONFIG_FILE}") +ENDIF() + +IF("${TRACK}" STREQUAL "Build Tests") + SET(TEST_PICKUP_REGEX "^build_tests") +ENDIF() + +# Pass all relevant "TEST_" variables down to configure: +GET_CMAKE_PROPERTY(_variables VARIABLES) +FOREACH(_var ${_variables}) + IF(_var MATCHES + "^(TEST_DIFF|TEST_TIME_LIMIT|TEST_PICKUP_REGEX|NUMDIFF_DIR)$" + ) + LIST(APPEND _options "-D${_var}=${${_var}}") + ENDIF() +ENDFOREACH() + +# +# CTEST_BUILD_NAME: +# + +# Append compiler information to CTEST_BUILD_NAME: +IF(NOT EXISTS ${CTEST_BINARY_DIRECTORY}/detailed.log) + # Apparently, ${CTEST_BINARY_DIRECTORY} is not a configured build + # directory. In this case we need a trick: set up a dummy project and + # query it for the compiler information. + FILE(WRITE ${CTEST_BINARY_DIRECTORY}/query_for_compiler/CMakeLists.txt " +FILE(WRITE ${CTEST_BINARY_DIRECTORY}/detailed.log + \"# CMAKE_CXX_COMPILER: \${CMAKE_CXX_COMPILER_ID} \${CMAKE_CXX_COMPILER_VERSION} on platform \${CMAKE_SYSTEM_NAME} \${CMAKE_SYSTEM_PROCESSOR}\" + )" + ) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} ${_options} "-G${CTEST_CMAKE_GENERATOR}" . + OUTPUT_QUIET ERROR_QUIET + WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}/query_for_compiler + ) + FILE(REMOVE_RECURSE ${CTEST_BINARY_DIRECTORY}/query_for_compiler) +ENDIF() + +IF(EXISTS ${CTEST_BINARY_DIRECTORY}/detailed.log) + FILE(STRINGS ${CTEST_BINARY_DIRECTORY}/detailed.log _compiler_id + REGEX "CMAKE_CXX_COMPILER:" + ) + STRING(REGEX REPLACE + "^.*CMAKE_CXX_COMPILER: \(.*\) on platform.*$" "\\1" + _compiler_id ${_compiler_id} + ) + STRING(REGEX REPLACE "^\(.*\) .*$" "\\1" _compiler_name ${_compiler_id}) + STRING(REGEX REPLACE "^.* " "" _compiler_version ${_compiler_id}) + STRING(REGEX REPLACE " " "-" _compiler_id ${_compiler_id}) + IF( NOT "${_compiler_id}" STREQUAL "" OR + _compiler_id MATCHES "CMAKE_CXX_COMPILER" ) + SET(CTEST_BUILD_NAME "${_compiler_id}") + ENDIF() +ENDIF() + +# +# Append subversion branch to CTEST_BUILD_NAME: +# +FIND_PACKAGE(Subversion QUIET) +EXECUTE_PROCESS( + COMMAND ${Subversion_SVN_EXECUTABLE} info ${CTEST_SOURCE_DIRECTORY} + OUTPUT_QUIET ERROR_QUIET + RESULT_VARIABLE _result + ) +IF(${_result} EQUAL 0) + Subversion_WC_INFO(${CTEST_SOURCE_DIRECTORY} _svn) + STRING(REGEX REPLACE "^${_svn_WC_ROOT}/" "" _branch ${_svn_WC_URL}) + STRING(REGEX REPLACE "^branches/" "" _branch ${_branch}) + STRING(REGEX REPLACE "/deal.II$" "" _branch ${_branch}) + SET(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${_branch}") +ENDIF() + +# +# Append config file name to CTEST_BUILD_NAME: +# + +IF(NOT "${CONFIG_FILE}" STREQUAL "") + GET_FILENAME_COMPONENT(_conf ${CONFIG_FILE} NAME_WE) + STRING(REGEX REPLACE "#.*$" "" _conf ${_conf}) + SET(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${_conf}") +ENDIF() + +MESSAGE("-- CTEST_BUILD_NAME: ${CTEST_BUILD_NAME}") + +# +# We require valid svn information for build tests: +# + +IF( "${TRACK}" STREQUAL "Build Tests" + AND NOT DEFINED _svn_WC_REVISION ) + MESSAGE(FATAL_ERROR " +TRACK was set to \"Build Tests\" which requires the source directory to be +under Subversion version control. +" + ) +ENDIF() + +# +# Write revision log: +# + +IF(DEFINED _svn_WC_REVISION) + FILE(WRITE ${CTEST_BINARY_DIRECTORY}/revision.log +"### +# +# SVN information: +# SVN_WC_URL: ${_svn_WC_URL} +# SVN_WC_REVISION: ${_svn_WC_REVISION} +# SVN_WC_LAST_CHANGED_DATE: ${_svn_WC_LAST_CHANGED_DATE} +# +###" + ) +ELSE() + FILE(WRITE ${CTEST_BINARY_DIRECTORY}/revision.log +"### +# +# No SVN information available. +# +###" + ) +ENDIF() + +# +# Declare files that should be submitted as notes: +# + +SET(CTEST_NOTES_FILES + ${CTEST_BINARY_DIRECTORY}/revision.log + ${CTEST_BINARY_DIRECTORY}/summary.log + ${CTEST_BINARY_DIRECTORY}/detailed.log + ${CTEST_BINARY_DIRECTORY}/include/deal.II/base/config.h + ) + + +######################################################################## +# # +# Run the testsuite: # +# # +######################################################################## + +IF(NOT "${_branch}" STREQUAL "") + SET_PROPERTY(GLOBAL PROPERTY SubProject ${_branch}) +ENDIF() + +CTEST_START(Experimental TRACK ${TRACK}) + +CTEST_CONFIGURE(OPTIONS "${_options}" RETURN_VALUE _res) + +IF("${_res}" STREQUAL "0") + # Only run the build stage if configure was successful: + + CTEST_BUILD(TARGET NUMBER_ERRORS _res) + + IF("${_res}" STREQUAL "0") + # Only run tests if the build was successful: + + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} + --build ${CTEST_BINARY_DIRECTORY} --target setup_test + OUTPUT_QUIET RESULT_VARIABLE _res + ) + IF(NOT "${_res}" STREQUAL "0") + MESSAGE(FATAL_ERROR " +\"setup_test\" target exited with an error. Bailing out. +" + ) + ENDIF() + + CTEST_TEST() + ENDIF() +ENDIF() + +# +# Inject compiler information and svn revision into xml files: +# + +FILE(STRINGS ${CTEST_BINARY_DIRECTORY}/Testing/TAG _tag LIMIT_COUNT 1) +SET(_path "${CTEST_BINARY_DIRECTORY}/Testing/${_tag}") +IF(NOT EXISTS ${_path}) + MESSAGE(FATAL_ERROR " +Unable to determine test submission files from TAG. Bailing out. +" + ) +ENDIF() +FILE(GLOB _xml_files ${_path}/*.xml) +EXECUTE_PROCESS(COMMAND sed -i -e + s/CompilerName=\"\"/CompilerName=\"${_compiler_name}\"\\n\\tCompilerVersion=\"${_compiler_version}\"/g + ${_xml_files} + OUTPUT_QUIET RESULT_VARIABLE _res + ) +IF(NOT "${_res}" STREQUAL "0") + MESSAGE(FATAL_ERROR " +\"sed\" failed. Bailing out. +" + ) +ENDIF() + +IF(NOT "${_svn_WC_REVISION}" STREQUAL "") + FILE(WRITE ${_path}/Update.xml +" + + ${CTEST_SITE} + ${CTEST_BUILD_NAME} + ${_tag}-${TRACK} + SVN + ${_svn_WC_REVISION} + ${_branch} +" + ) +ENDIF() + +# +# And finally submit: +# + +CTEST_SUBMIT() + +# .oO( This script is freaky 461 lines long... ) diff --git a/tests/cmake/setup_testsuite.cmake b/deal.II/cmake/setup_testsuite.cmake similarity index 89% rename from tests/cmake/setup_testsuite.cmake rename to deal.II/cmake/setup_testsuite.cmake index 7a5b87fc0c..e9a250e0e4 100644 --- a/tests/cmake/setup_testsuite.cmake +++ b/deal.II/cmake/setup_testsuite.cmake @@ -15,9 +15,11 @@ ## --------------------------------------------------------------------- # -# Setup necessary configuration for a testsuite sub project. +# Setup necessary configuration in the testsuite subprojects. +# This file is directly included by the test subprojects and not by the +# main project. # -# A testsuite subproject assumes the following cached variables to be set: +# It is assumed that the following variables are set: # # DEAL_II_BINARY_DIR # DEAL_II_SOURCE_DIR @@ -34,8 +36,7 @@ # # Load all macros: # - -FILE(GLOB _macro_files ${CMAKE_CURRENT_LIST_DIR}/macros/*.cmake) +FILE(GLOB _macro_files ${DEAL_II_SOURCE_DIR}/cmake/macros/*.cmake) FOREACH(_file ${_macro_files}) INCLUDE(${_file}) ENDFOREACH() @@ -43,7 +44,6 @@ ENDFOREACH() # # Pick up values from environment: # - SET_IF_EMPTY(DEAL_II_BINARY_DIR $ENV{DEAL_II_BINARY_DIR}) SET_IF_EMPTY(DEAL_II_BINARY_DIR $ENV{DEAL_II_DIR}) SET_IF_EMPTY(DEAL_II_SOURCE_DIR $ENV{DEAL_II_SOURCE_DIR}) @@ -54,7 +54,6 @@ SET_IF_EMPTY(TEST_PICKUP_REGEX $ENV{TEST_PICKUP_REGEX}) # # We need deal.II and Perl as external packages: # - FIND_PACKAGE(deal.II 8.0 REQUIRED HINTS ${DEAL_II_BINARY_DIR} ${DEAL_II_DIR} ) @@ -65,7 +64,6 @@ FIND_PACKAGE(Perl REQUIRED) # # We need a diff tool, preferably numdiff: # - FIND_PROGRAM(DIFF_EXECUTABLE NAMES diff ) @@ -94,17 +92,15 @@ IF("${TEST_DIFF}" STREQUAL "") ELSE() # TODO: I have no idea how to prepare a custom string comming possibly # through two layers of command line into a list... - SEPARATE_ARGUMENTS(TEST_DIFF UNIX_COMMAND ${TEST_DIFF}) + SEPARATE_ARGUMENTS(TEST_DIFF ${TEST_DIFF}) ENDIF() # # Set a default time limit of 600 seconds: # - SET_IF_EMPTY(TEST_TIME_LIMIT 600) # # And finally, enable testing: # - ENABLE_TESTING() diff --git a/deal.II/tests/CMakeLists.txt b/deal.II/tests/CMakeLists.txt index ad14ac2493..2ac4fed941 100644 --- a/deal.II/tests/CMakeLists.txt +++ b/deal.II/tests/CMakeLists.txt @@ -15,79 +15,101 @@ ## --------------------------------------------------------------------- # -# A minimalistic set of tests: +# 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 :-( +# + +ADD_SUBDIRECTORY(quick_tests) + +# +# Custom targets to set and clean up the testsuite: +# + +# Setup tests: +ADD_CUSTOM_TARGET(setup_test) + +# Clean all tests +ADD_CUSTOM_TARGET(clean_test) -ENABLE_TESTING() - -FOREACH(_build ${DEAL_II_BUILD_TYPES}) - STRING(TOLOWER ${_build} _build_lowercase) - - # - # Test whether it is possible to configure, build and run a simplistic - # project, we use step 1: - # - - SET(_target project.${_build_lowercase}) - SET(_project_src ${CMAKE_SOURCE_DIR}/examples/step-1) - SET(_project ${CMAKE_CURRENT_BINARY_DIR}/${_target}) - - ADD_CUSTOM_COMMAND(OUTPUT ${_project}/CMakeLists.txt - COMMAND ${CMAKE_COMMAND} -E copy ${_project_src}/step-1.cc ${_project}/step-1.cc - COMMAND ${CMAKE_COMMAND} -E copy ${_project_src}/CMakeLists.txt ${_project}/CMakeLists.txt - DEPENDS ${_project_src}/step-1.cc ${_project_src}/CMakeLists.txt - ) - ADD_CUSTOM_COMMAND(OUTPUT ${_project}-OK - COMMAND ${CMAKE_COMMAND} -DDEAL_II_DIR=${CMAKE_BINARY_DIR} -DCMAKE_BUILD_TYPE=${_build} . - || (rm ${_project}-OK && exit 1) - COMMAND ${CMAKE_COMMAND} --build ${_project} --target run > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK - || (rm ${_project}-OK && exit 1) - COMMAND touch ${_project}-OK - WORKING_DIRECTORY ${_project} - DEPENDS ${_project}/CMakeLists.txt - ) - ADD_CUSTOM_TARGET(${_target} DEPENDS ${_project}-OK) - - ADD_TEST(NAME ${_target} - COMMAND ${CMAKE_COMMAND} -DTRGT=${_target} -DTEST=${_target} - -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} - -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - SET_TESTS_PROPERTIES(${_test} PROPERTIES LABEL "sanity checks") - - # - # Test whether thread affinity is well behaved: - # - SET(_target affinity.${_build_lowercase}) - - ADD_EXECUTABLE(${_target} EXCLUDE_FROM_ALL affinity.cc) - DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${_build}) - - ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK - COMMAND ${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 || (rm ${_target}-OK && exit 1) - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - ADD_CUSTOM_TARGET(${_target}.run DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK) - - ADD_TEST(NAME ${_target} - COMMAND ${CMAKE_COMMAND} -DTRGT=${_target}.run -DTEST=${_target} - -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} - -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - SET_TESTS_PROPERTIES(${_target} PROPERTIES LABEL "sanity checks") +# Remove all tests: +ADD_CUSTOM_TARGET(prune_test) +# +# Write a minimalistic CTestTestfile.cmake file to CMAKE_BINARY_DIR and +# CMAKE_CURRENT_BINARY_DIR: +# +FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake + "SUBDIRS(tests)" + ) +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake "") + +# +# Pass all relevant "TEST_" and "_DIR" variables down to the subprojects: +# +SET(_options) +LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR}) +LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}) +FOREACH(_var TEST_DIFF TEST_TIME_LIMIT TEST_PICKUP_REGEX NUMDIFF_DIR) + LIST(APPEND _options "-U${_var}") + IF(DEFINED ${_var}) + LIST(APPEND _options "-D${_var}=${${_var}}") + ENDIF() ENDFOREACH() # -# A custom test target: +# Glob together a list of all subfolders to set up: # -# @TIMO: TODO, write a little script to be run after ctest that queries for -# (affinity|project|etc).(debug|release)-OK and outputs an appropriate -# message. +FILE(GLOB _categories RELATIVE ${TEST_DIR} ${TEST_DIR}/*) +SET(_categories all-headers build_tests ${_categories}) + # -ADD_CUSTOM_TARGET(test - COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) +# Define a subproject for every enabled category: +# + +FOREACH(_category ${_categories}) + IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_category}/CMakeLists.txt) + SET(_category_dir ${CMAKE_CURRENT_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_test_${_category} + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_CURRENT_BINARY_DIR}/${_category} + COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/${_category} && + ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_options} ${_category_dir} + > /dev/null # Shoo! + DEPENDS ${_category_dir} + COMMENT "Processing tests/${_category}" + ) + ADD_DEPENDENCIES(setup_test setup_test_${_category}) + + # depend on a valid build directory (libraries built, config in place): + ADD_DEPENDENCIES(setup_test_${_category} setup_build_dir) + + ADD_CUSTOM_TARGET(clean_test_${_category} + COMMAND [ ! -d ${_category} ] || ${CMAKE_COMMAND} + --build ${CMAKE_CURRENT_BINARY_DIR}/${_category} --target clean + ) + ADD_DEPENDENCIES(clean_test clean_test_${_category}) + + ADD_CUSTOM_TARGET(prune_test_${_category} + COMMAND ${CMAKE_COMMAND} -E remove_directory + ${CMAKE_CURRENT_BINARY_DIR}/${_category} + ) + ADD_DEPENDENCIES(prune_test prune_test_${_category}) + + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/CTestTestfile.cmake + "SUBDIRS(${_category})\n" + ) + + ENDIF() +ENDFOREACH() diff --git a/tests/all-headers/CMakeLists.txt b/deal.II/tests/all-headers/CMakeLists.txt similarity index 93% rename from tests/all-headers/CMakeLists.txt rename to deal.II/tests/all-headers/CMakeLists.txt index a43e407e95..607240037a 100644 --- a/tests/all-headers/CMakeLists.txt +++ b/deal.II/tests/all-headers/CMakeLists.txt @@ -15,7 +15,7 @@ ## --------------------------------------------------------------------- CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) @@ -68,11 +68,9 @@ FOREACH(_full_file ${_header}) # And finally add the test: ADD_TEST(NAME ${_test} - COMMAND ${CMAKE_COMMAND} - -DTRGT=${_target} - -DTEST=${_test} + COMMAND ${CMAKE_COMMAND} -DTRGT=${_target} -DTEST=${_test} -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} - -P ${TEST_DIR}/cmake/scripts/run_test.cmake + -P ${DEAL_II_SOURCE_DIR}/cmake/scripts/run_test.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) SET_TESTS_PROPERTIES(${_test} PROPERTIES diff --git a/tests/all-headers/test_header.cc b/deal.II/tests/all-headers/test_header.cc similarity index 100% rename from tests/all-headers/test_header.cc rename to deal.II/tests/all-headers/test_header.cc diff --git a/tests/build_tests/CMakeLists.txt b/deal.II/tests/build_tests/CMakeLists.txt similarity index 97% rename from tests/build_tests/CMakeLists.txt rename to deal.II/tests/build_tests/CMakeLists.txt index 95f8a63152..08aed09078 100644 --- a/tests/build_tests/CMakeLists.txt +++ b/deal.II/tests/build_tests/CMakeLists.txt @@ -15,7 +15,7 @@ ## --------------------------------------------------------------------- CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) @@ -164,11 +164,9 @@ FOREACH(_step_full ${_steps}) # And finally add the test: ADD_TEST(NAME ${_test} - COMMAND ${CMAKE_COMMAND} - -DTRGT=${_target} - -DTEST=${_test} + COMMAND ${CMAKE_COMMAND} -DTRGT=${_target} -DTEST=${_test} -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} - -P ${TEST_DIR}/cmake/scripts/run_test.cmake + -P ${DEAL_II_SOURCE_DIR}/cmake/scripts/run_test.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) SET_TESTS_PROPERTIES(${_test} PROPERTIES diff --git a/deal.II/tests/quick_tests/CMakeLists.txt b/deal.II/tests/quick_tests/CMakeLists.txt new file mode 100644 index 0000000000..e8cac30ca9 --- /dev/null +++ b/deal.II/tests/quick_tests/CMakeLists.txt @@ -0,0 +1,56 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## 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. +## +## --------------------------------------------------------------------- + +# +# A minimalistic set of tests: +# + +ENABLE_TESTING() + +FOREACH(_build ${DEAL_II_BUILD_TYPES}) + STRING(TOLOWER ${_build} _build_lowercase) + + # + # Test whether thread affinity is well behaved: + # + SET(_target affinity.${_build_lowercase}) + + ADD_EXECUTABLE(${_target} EXCLUDE_FROM_ALL affinity.cc) + DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${_build}) + + ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK + COMMAND ${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 || (rm ${_target}-OK && exit 1) + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + ADD_CUSTOM_TARGET(${_target}.run DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK) + + ADD_TEST(NAME ${_target} + COMMAND ${CMAKE_COMMAND} -DTRGT=${_target}.run -DTEST=${_target} + -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} + -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + SET_TESTS_PROPERTIES(${_target} PROPERTIES LABEL "sanity checks") + +ENDFOREACH() + +# +# A custom test target: +# +ADD_CUSTOM_TARGET(test + COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) diff --git a/deal.II/tests/affinity.cc b/deal.II/tests/quick_tests/affinity.cc similarity index 100% rename from deal.II/tests/affinity.cc rename to deal.II/tests/quick_tests/affinity.cc diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1de72dd17e..15b4d9ad0c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,150 +1,4 @@ -## --------------------------------------------------------------------- -## $Id$ -## -## 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. -## -## --------------------------------------------------------------------- - -# -# 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 :-( -# - -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -MESSAGE(STATUS "Proceed to test definitions now.") -ENABLE_TESTING() - -IF(NOT "${CMAKE_PROJECT_NAME}" STREQUAL "deal.II") - MESSAGE(FATAL_ERROR - "The testsuite cannot be set up as an independent project. Please configure \"deal.II\" instead." - ) -ENDIF() - -# -# Write a minimalistic CTestTestfile.cmake file to CMAKE_BINARY_DIR: -# -FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake - "SUBDIRS(tests)" +MESSAGE(FATAL_ERROR "\n +The testsuite cannot be set up as an independent project. +Please configure \"deal.II\" directly instead.\n\n" ) - -# -# The hook into CTest so that the tests from the suprojects get picked up -# by the main project: -# - -FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/deal.IITestfile.cmake "") -SET_PROPERTY(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - APPEND PROPERTY TEST_INCLUDE_FILE deal.IITestfile.cmake - ) - -# -# Pass all relevant "TEST_" and "_DIR" variables down to the subprojects: -# - -SET(_options) - -LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR}) -LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}) - -FOREACH(_var TEST_DIR TEST_DIFF TEST_TIME_LIMIT TEST_PICKUP_REGEX NUMDIFF_DIR) - LIST(APPEND _options "-U${_var}") - IF(DEFINED ${_var}) - LIST(APPEND _options "-D${_var}=${${_var}}") - ENDIF() -ENDFOREACH() - -# -# Custom targets to set and clean up the testsuite: -# - -# Setup tests: -ADD_CUSTOM_TARGET(setup_test) - -# Clean all tests -ADD_CUSTOM_TARGET(clean_test) - -# Remove all tests: -ADD_CUSTOM_TARGET(prune_test) - -# -# The list of subfolders to set up: -# - -SET(_categories - all-headers aniso base bits build_tests codim_one deal.II fe grid hp integrators lac matrix_free multigrid serialization - ) -IF(DEAL_II_WITH_LAPACK) - LIST(APPEND _categories lapack) -ENDIF() -IF(DEAL_II_WITH_METIS) - LIST(APPEND _categories metis) -ENDIF() -IF(DEAL_II_WITH_MPI AND DEAL_II_WITH_P4EST) - LIST(APPEND _categories gla mpi) -ENDIF() -IF(DEAL_II_WITH_P4EST) - LIST(APPEND _categories distributed_grids) -ENDIF() -IF(DEAL_II_WITH_PETSC) - LIST(APPEND _categories petsc) -ENDIF() -IF(DEAL_II_WITH_SLEPC) - LIST(APPEND _categories slepc) -ENDIF() -IF(DEAL_II_WITH_TRILINOS) - LIST(APPEND _categories trilinos) -ENDIF() -IF(DEAL_II_WITH_UMFPACK) - LIST(APPEND _categories umfpack) -ENDIF() - -# -# Define a subproject for every enabled category: -# - -FOREACH(_category ${_categories}) - ADD_CUSTOM_TARGET(setup_test_${_category} - COMMAND ${CMAKE_COMMAND} -E make_directory - ${CMAKE_CURRENT_BINARY_DIR}/${_category} - COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/${_category} && - ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} - ${_options} - ${CMAKE_CURRENT_SOURCE_DIR}/${_category} - > /dev/null # Shoo! - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_category} - COMMENT "Processing ./tests/${_category}" - ) - ADD_DEPENDENCIES(setup_test setup_test_${_category}) - - # depend on a valid build directory (libraries built, config in place): - ADD_DEPENDENCIES(setup_test_${_category} setup_build_dir) - - ADD_CUSTOM_TARGET(clean_test_${_category} - COMMAND [ ! -d ${_category} ] || ${CMAKE_COMMAND} - --build ${CMAKE_CURRENT_BINARY_DIR}/${_category} --target clean - ) - ADD_DEPENDENCIES(clean_test clean_test_${_category}) - - ADD_CUSTOM_TARGET(prune_test_${_category} - COMMAND ${CMAKE_COMMAND} -E remove_directory - ${CMAKE_CURRENT_BINARY_DIR}/${_category} - ) - ADD_DEPENDENCIES(prune_test prune_test_${_category}) - - FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/deal.IITestfile.cmake - "SUBDIRS(${_category})\n" - ) -ENDFOREACH() diff --git a/tests/TODO b/tests/TODO index cd5b4e2487..fcbc2952cf 100644 --- a/tests/TODO +++ b/tests/TODO @@ -13,8 +13,8 @@ Issues: distributed_grids/ fail. - ISSUE: - Depending on the version of boost, a version number in the serialization - output changes and all tests just under serialization/ just fail + Quite some tests that use PETSc depend on specific external packages, + e.g. hypre and mumps - Mesh converter tests? diff --git a/tests/a-framework/CMakeLists.txt b/tests/a-framework/CMakeLists.txt index a51b880d4f..e39c51b85d 100644 --- a/tests/a-framework/CMakeLists.txt +++ b/tests/a-framework/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/aniso/CMakeLists.txt b/tests/aniso/CMakeLists.txt index a51b880d4f..e39c51b85d 100644 --- a/tests/aniso/CMakeLists.txt +++ b/tests/aniso/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/base/CMakeLists.txt b/tests/base/CMakeLists.txt index a51b880d4f..e39c51b85d 100644 --- a/tests/base/CMakeLists.txt +++ b/tests/base/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.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 a51b880d4f..e39c51b85d 100644 --- a/tests/bits/CMakeLists.txt +++ b/tests/bits/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/cmake/macros/macro_item_matches.cmake b/tests/cmake/macros/macro_item_matches.cmake deleted file mode 100644 index 3e747bb4c4..0000000000 --- a/tests/cmake/macros/macro_item_matches.cmake +++ /dev/null @@ -1,35 +0,0 @@ -## --------------------------------------------------------------------- -## $Id$ -## -## Copyright (C) 2012 - 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. -## -## --------------------------------------------------------------------- - -# -# A small macro to test whether a given list contains an element. -# -# Usage: -# ITEM_MATCHES(var regex list) -# -# var is set to true if list contains an item that matches regex. -# - -MACRO(ITEM_MATCHES _var _regex) - SET(${_var}) - FOREACH (_item ${ARGN}) - IF("${_item}" MATCHES ${_regex}) - SET(${_var} TRUE) - BREAK() - ENDIF() - ENDFOREACH() -ENDMACRO() - diff --git a/tests/cmake/macros/macro_set_if_empty.cmake b/tests/cmake/macros/macro_set_if_empty.cmake deleted file mode 100644 index 35acf55729..0000000000 --- a/tests/cmake/macros/macro_set_if_empty.cmake +++ /dev/null @@ -1,25 +0,0 @@ -## --------------------------------------------------------------------- -## $Id$ -## -## Copyright (C) 2012 - 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. -## -## --------------------------------------------------------------------- - -# -# If 'variable' is empty it will be set to 'value' -# -MACRO(SET_IF_EMPTY _variable) - IF("${${_variable}}" STREQUAL "") - SET(${_variable} ${ARGN}) - ENDIF() -ENDMACRO() - diff --git a/tests/cmake/scripts/run_test.cmake b/tests/cmake/scripts/run_test.cmake deleted file mode 100644 index 4a27a36ee6..0000000000 --- a/tests/cmake/scripts/run_test.cmake +++ /dev/null @@ -1,76 +0,0 @@ -## --------------------------------------------------------------------- -## $Id$ -## -## 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. -## -## --------------------------------------------------------------------- - -# -# This is a small worker to run a single test in the testsuite -# -# The following variables have to be set: -# -# TRGT - the name of the target that should be invoked -# TEST - the test name (used for status messages) -# DEAL_II_BINARY_DIR - the build directory that contains the target -# - -EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} - --build ${DEAL_II_BINARY_DIR} --target ${TRGT} - RESULT_VARIABLE _result_code - OUTPUT_VARIABLE _output - ) - -IF("${_result_code}" STREQUAL "0") - - MESSAGE("Test ${TEST}: PASSED") - MESSAGE("=============================== OUTPUT BEGIN ===============================") - # Do not output everything, just that we are successful: - MESSAGE("${TEST}: PASSED.") - MESSAGE("=============================== OUTPUT END ===============================") - -ELSE() - - # - # Determine whether the CONFIGURE, BUILD or RUN stages were run successfully: - # - - # CONFIGURE is special because it only exists in build tests: - STRING(REGEX MATCH "${TEST}: CONFIGURE successful\\." _configure_regex ${_output}) - STRING(REGEX MATCH "${TEST}: CONFIGURE failed\\." _configure_regex_fail ${_output}) - STRING(REGEX MATCH "${TEST}: BUILD successful\\." _build_regex ${_output}) - STRING(REGEX MATCH "${TEST}: RUN successful\\." _run_regex ${_output}) - IF(NOT "${_configure_regex_fail}" STREQUAL "") - SET(_stage CONFIGURE) - ELSEIF("${_build_regex}" STREQUAL "") - SET(_stage BUILD) - ELSEIF("${_run_regex}" STREQUAL "") - SET(_stage RUN) - ELSE() - SET(_stage DIFF) - ENDIF() - - MESSAGE("Test ${TEST}: ${_stage}") - MESSAGE("=============================== OUTPUT BEGIN ===============================") - IF( "${_build_regex}" STREQUAL "" AND - "${_configure_regex}" STREQUAL "" ) - # Some special output in case the BUILD stage failed in a regression test: - MESSAGE("${TEST}: BUILD failed. Output:") - ENDIF() - MESSAGE(${_output}) - MESSAGE("") - MESSAGE("${TEST}: ****** ${_stage} failed *******") - MESSAGE("") - MESSAGE("=============================== OUTPUT END ===============================") - MESSAGE(FATAL_ERROR "*** abort") - -ENDIF() diff --git a/tests/codim_one/CMakeLists.txt b/tests/codim_one/CMakeLists.txt index a51b880d4f..e39c51b85d 100644 --- a/tests/codim_one/CMakeLists.txt +++ b/tests/codim_one/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.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 a51b880d4f..e39c51b85d 100644 --- a/tests/deal.II/CMakeLists.txt +++ b/tests/deal.II/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.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 a51b880d4f..e1ba866f7e 100644 --- a/tests/distributed_grids/CMakeLists.txt +++ b/tests/distributed_grids/CMakeLists.txt @@ -1,5 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) -DEAL_II_PICKUP_TESTS() +IF(DEAL_II_WITH_P4EST) + DEAL_II_PICKUP_TESTS() +ENDIF() diff --git a/tests/fail/CMakeLists.txt b/tests/fail/CMakeLists.txt index a51b880d4f..e39c51b85d 100644 --- a/tests/fail/CMakeLists.txt +++ b/tests/fail/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/fe/CMakeLists.txt b/tests/fe/CMakeLists.txt index a51b880d4f..e39c51b85d 100644 --- a/tests/fe/CMakeLists.txt +++ b/tests/fe/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.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 a51b880d4f..ef84a0b386 100644 --- a/tests/gla/CMakeLists.txt +++ b/tests/gla/CMakeLists.txt @@ -1,5 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) -DEAL_II_PICKUP_TESTS() +IF(DEAL_II_WITH_MPI AND DEAL_II_WITH_P4EST) + DEAL_II_PICKUP_TESTS() +ENDIF() diff --git a/tests/grid/CMakeLists.txt b/tests/grid/CMakeLists.txt index a51b880d4f..e39c51b85d 100644 --- a/tests/grid/CMakeLists.txt +++ b/tests/grid/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.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 a51b880d4f..e39c51b85d 100644 --- a/tests/hp/CMakeLists.txt +++ b/tests/hp/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.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 a51b880d4f..e39c51b85d 100644 --- a/tests/integrators/CMakeLists.txt +++ b/tests/integrators/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.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 a51b880d4f..e39c51b85d 100644 --- a/tests/lac/CMakeLists.txt +++ b/tests/lac/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.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 a51b880d4f..13d07cf2c3 100644 --- a/tests/lapack/CMakeLists.txt +++ b/tests/lapack/CMakeLists.txt @@ -1,5 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) -DEAL_II_PICKUP_TESTS() +IF(DEAL_II_WITH_LAPACK) + DEAL_II_PICKUP_TESTS() +ENDIF() diff --git a/tests/matrix_free/CMakeLists.txt b/tests/matrix_free/CMakeLists.txt index a51b880d4f..e39c51b85d 100644 --- a/tests/matrix_free/CMakeLists.txt +++ b/tests/matrix_free/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/metis/CMakeLists.txt b/tests/metis/CMakeLists.txt index a51b880d4f..3219ef35aa 100644 --- a/tests/metis/CMakeLists.txt +++ b/tests/metis/CMakeLists.txt @@ -1,5 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) -DEAL_II_PICKUP_TESTS() +IF(DEAL_II_WITH_METIS) + DEAL_II_PICKUP_TESTS() +ENDIF() diff --git a/tests/mpi/CMakeLists.txt b/tests/mpi/CMakeLists.txt index a51b880d4f..ef84a0b386 100644 --- a/tests/mpi/CMakeLists.txt +++ b/tests/mpi/CMakeLists.txt @@ -1,5 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) -DEAL_II_PICKUP_TESTS() +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 a51b880d4f..e39c51b85d 100644 --- a/tests/multigrid/CMakeLists.txt +++ b/tests/multigrid/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/petsc/CMakeLists.txt b/tests/petsc/CMakeLists.txt index a51b880d4f..5afa661fa1 100644 --- a/tests/petsc/CMakeLists.txt +++ b/tests/petsc/CMakeLists.txt @@ -1,5 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) -DEAL_II_PICKUP_TESTS() +IF(DEAL_II_WITH_PETSC) + DEAL_II_PICKUP_TESTS() +ENDIF() diff --git a/tests/run_buildtests.cmake b/tests/run_buildtests.cmake new file mode 100644 index 0000000000..98014f1de8 --- /dev/null +++ b/tests/run_buildtests.cmake @@ -0,0 +1,2 @@ +SET(TRACK "Build Tests") +INCLUDE(${CMAKE_CURRENT_LIST_DIR}/run_testsuite.cmake) diff --git a/tests/run_testsuite.cmake b/tests/run_testsuite.cmake index c44af61218..51f970e900 100644 --- a/tests/run_testsuite.cmake +++ b/tests/run_testsuite.cmake @@ -14,443 +14,26 @@ ## ## --------------------------------------------------------------------- - -######################################################################## -# # -# Test setup: # -# # -######################################################################## - -# -# This is the ctest script for running and submitting build and regression -# tests. -# -# Invoke it in a _build directory_ (or designated build directory) via: -# -# ctest -S <...>/run_testsuite.cmake -# -# The following configuration variables can be overwritten with -# -# ctest -D= [...] -# -# -# CTEST_SOURCE_DIRECTORY -# - The source directory of deal.II (usually ending in "[...]/deal.II" -# (equivalent to https://svn.dealii.org/trunk/deal.II) -# Note: This is _not_ the test directory ending in "[...]/tests" -# - If unspecified, "../deal.II" relative to the location of this -# script is used. If this is not a source directory, an error is -# thrown. -# -# CTEST_BINARY_DIRECTORY -# - The designated build directory (already configured, empty, or non -# existent - see the information about TRACKs what will happen) -# - If unspecified the current directory is used. If the current -# directory is equal to CTEST_SOURCE_DIRECTORY or the "tests" -# directory, an error is thrown. # -# CTEST_CMAKE_GENERATOR -# - The CMake Generator to use (e.g. "Unix Makefiles", or "Ninja", see -# $ man cmake) -# - If unspecified the generator of a configured build directory will -# be used, otherwise "Unix Makefiles". -# -# TRACK -# - The track the test should be submitted to. Defaults to -# "Experimental". Possible values are: -# -# "Experimental" - all tests that are not specifically "build" or -# "regression" tests should go into this track -# -# "Build Tests" - Build tests that configure and build in a -# clean directory and run the build tests -# "build_tests/*" -# -# "Regression Tests" - Reserved for the Regression tester -# -# CONFIG_FILE -# - A configuration file (see ../deal.II/docs/development/Config.sample) -# that will be used during the configuration stage (invokes -# # cmake -C ${CONFIG_FILE}). This only has an effect if -# CTEST_BINARY_DIRECTORY is empty. -# -# Furthermore, the following variables controlling the testsuite can be set -# and will be automatically handed down to cmake: -# -# TEST_DIFF -# TEST_TIME_LIMIT -# TEST_PICKUP_REGEX -# NUMDIFF_DIR -# -# For details, consult the ./README file. -# - - -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -MESSAGE("-- This is CTest ${CTEST_VERSION}") - -# -# TRACK: Default to Experimental: -# - -IF("${TRACK}" STREQUAL "") - SET(TRACK "Experimental") -ENDIF() - -IF( NOT "${TRACK}" STREQUAL "Experimental" - AND NOT "${TRACK}" STREQUAL "Build Tests" - AND NOT "${TRACK}" STREQUAL "Regression Tests" ) - MESSAGE(FATAL_ERROR " -Unknown TRACK \"${TRACK}\" - see the manual for valid values. -" - ) -ENDIF() - -MESSAGE("-- TRACK: ${TRACK}") - -# -# CTEST_SOURCE_DIRECTORY: +# Try to find the source directory and invoke +# ./cmake/scripts/run_testsuite.cmake from this location: # IF("${CTEST_SOURCE_DIRECTORY}" STREQUAL "") - # # If CTEST_SOURCE_DIRECTORY is not set we just assume that this script # was called residing under ../tests relative to the source directory. - # GET_FILENAME_COMPONENT(_path "${CMAKE_CURRENT_LIST_DIR}" PATH) SET(CTEST_SOURCE_DIRECTORY ${_path}/deal.II) - - IF(NOT EXISTS ${CTEST_SOURCE_DIRECTORY}/CMakeLists.txt) - MESSAGE(FATAL_ERROR " -Could not find a suitable source directory. Either the run_testsuite.cmake -script was called residing outside of \"tests\", or there is no source -directory \"../deal.II\" relative to the tests directory. -Please, set CTEST_SOURCE_DIRECTORY manually to the appropriate source -directory. -" - ) - ENDIF() -ENDIF() - -MESSAGE("-- CTEST_SOURCE_DIRECTORY: ${CTEST_SOURCE_DIRECTORY}") - -# -# Read in custom config files: -# - -CTEST_READ_CUSTOM_FILES(${CTEST_SOURCE_DIRECTORY}) - -# -# CTEST_BINARY_DIRECTORY: -# - -IF("${CTEST_BINARY_DIRECTORY}" STREQUAL "") - # - # If CTEST_BINARY_DIRECTORY is not set we just use the current directory - # except if it is equal to CTEST_SOURCE_DIRECTORY in which case we fail. - # - SET(CTEST_BINARY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - - IF( "${CTEST_BINARY_DIRECTORY}" STREQUAL "${CTEST_SOURCE_DIR}" - OR "${CTEST_BINARY_DIRECTORY}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}" ) - MESSAGE(FATAL_ERROR " -ctest was invoked in the source directory (or test source directory) and CTEST_BINARY_DIRECTORY is not set. -Please either call ctest from within a designated build directory, or set CTEST_BINARY_DIRECTORY accordingly. -" - ) - ENDIF() -ENDIF() - -# -# Read in custom config files: -# - -CTEST_READ_CUSTOM_FILES(${CTEST_BINARY_DIRECTORY}) - -# Make sure that for a build test the directory is empty: -FILE(GLOB _test ${CTEST_BINARY_DIRECTORY}/*) -IF( "${TRACK}" STREQUAL "Build Tests" - AND NOT "${_test}" STREQUAL "" ) - MESSAGE(FATAL_ERROR " -TRACK was set to \"Build Tests\" which require an empty build directory. -But files were found in \"${CTEST_BINARY_DIRECTORY}\" -" - ) -ENDIF() - -MESSAGE("-- CTEST_BINARY_DIRECTORY: ${CTEST_BINARY_DIRECTORY}") - -# -# CTEST_CMAKE_GENERATOR: -# - -# Query Generator from build directory (if possible): -IF(EXISTS ${CTEST_BINARY_DIRECTORY}/CMakeCache.txt) - FILE(STRINGS ${CTEST_BINARY_DIRECTORY}/CMakeCache.txt _generator - REGEX "^CMAKE_GENERATOR:" - ) - STRING(REGEX REPLACE "^.*=" "" _generator ${_generator}) -ENDIF() - -IF("${CTEST_CMAKE_GENERATOR}" STREQUAL "") - IF(NOT "${_generator}" STREQUAL "") - SET(CTEST_CMAKE_GENERATOR ${_generator}) - ELSE() - # default to "Unix Makefiles" - SET(CTEST_CMAKE_GENERATOR "Unix Makefiles") - ENDIF() -ELSE() - # ensure that CTEST_CMAKE_GENERATOR (that was apparantly set) is - # compatible with the build directory: - IF( NOT "${CTEST_CMAKE_GENERATOR}" STREQUAL "${_generator}" - AND NOT "${_generator}" STREQUAL "" ) - MESSAGE(FATAL_ERROR " -The build directory is already set up with Generator \"${_generator}\", but -CTEST_CMAKE_GENERATOR was set to a different Generator \"${CTEST_CMAKE_GENERATOR}\". -" - ) - ENDIF() -ENDIF() - -# -# CTEST_SITE: -# - -FIND_PROGRAM(HOSTNAME_COMMAND NAMES hostname) -EXEC_PROGRAM(${HOSTNAME_COMMAND} OUTPUT_VARIABLE _hostname) -SET(CTEST_SITE "${_hostname}") - -MESSAGE("-- CTEST_SITE: ${CTEST_SITE}") - -IF( "${TRACK}" STREQUAL "Regression Tests" - AND NOT CTEST_SITE MATCHES "c0541" ) - MESSAGE(FATAL_ERROR " -I'm sorry ${CTEST_SITE}, I'm afraid I can't do that. -The TRACK \"Regression Tests\" is not for you. -" - ) -ENDIF() - -# -# Assemble configuration options, we need it now: -# - -IF(NOT "${CONFIG_FILE}" STREQUAL "") - SET(_options "-C${CONFIG_FILE}") -ENDIF() - -IF("${TRACK}" STREQUAL "Build Tests") - SET(TEST_PICKUP_REGEX "^build_tests") -ENDIF() - -# Pass all relevant "TEST_" variables down to configure: -GET_CMAKE_PROPERTY(_variables VARIABLES) -FOREACH(_var ${_variables}) - IF(_var MATCHES - "^(TEST_DIFF|TEST_TIME_LIMIT|TEST_PICKUP_REGEX|NUMDIFF_DIR)$" - ) - LIST(APPEND _options "-D${_var}=${${_var}}") - ENDIF() -ENDFOREACH() - -# -# CTEST_BUILD_NAME: -# - -# Append compiler information to CTEST_BUILD_NAME: -IF(NOT EXISTS ${CTEST_BINARY_DIRECTORY}/detailed.log) - # Apparently, ${CTEST_BINARY_DIRECTORY} is not a configured build - # directory. In this case we need a trick: set up a dummy project and - # query it for the compiler information. - FILE(WRITE ${CTEST_BINARY_DIRECTORY}/query_for_compiler/CMakeLists.txt " -FILE(WRITE ${CTEST_BINARY_DIRECTORY}/detailed.log - \"# CMAKE_CXX_COMPILER: \${CMAKE_CXX_COMPILER_ID} \${CMAKE_CXX_COMPILER_VERSION} on platform \${CMAKE_SYSTEM_NAME} \${CMAKE_SYSTEM_PROCESSOR}\" - )" - ) - EXECUTE_PROCESS( - COMMAND ${CMAKE_COMMAND} ${_options} "-G${CTEST_CMAKE_GENERATOR}" . - OUTPUT_QUIET ERROR_QUIET - WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}/query_for_compiler - ) - FILE(REMOVE_RECURSE ${CTEST_BINARY_DIRECTORY}/query_for_compiler) -ENDIF() - -IF(EXISTS ${CTEST_BINARY_DIRECTORY}/detailed.log) - FILE(STRINGS ${CTEST_BINARY_DIRECTORY}/detailed.log _compiler_id - REGEX "CMAKE_CXX_COMPILER:" - ) - STRING(REGEX REPLACE - "^.*CMAKE_CXX_COMPILER: \(.*\) on platform.*$" "\\1" - _compiler_id ${_compiler_id} - ) - STRING(REGEX REPLACE "^\(.*\) .*$" "\\1" _compiler_name ${_compiler_id}) - STRING(REGEX REPLACE "^.* " "" _compiler_version ${_compiler_id}) - STRING(REGEX REPLACE " " "-" _compiler_id ${_compiler_id}) - IF( NOT "${_compiler_id}" STREQUAL "" OR - _compiler_id MATCHES "CMAKE_CXX_COMPILER" ) - SET(CTEST_BUILD_NAME "${_compiler_id}") - ENDIF() ENDIF() -# -# Append subversion branch to CTEST_BUILD_NAME: -# -FIND_PACKAGE(Subversion QUIET) -EXECUTE_PROCESS( - COMMAND ${Subversion_SVN_EXECUTABLE} info ${CTEST_SOURCE_DIRECTORY} - OUTPUT_QUIET ERROR_QUIET - RESULT_VARIABLE _result - ) -IF(${_result} EQUAL 0) - Subversion_WC_INFO(${CTEST_SOURCE_DIRECTORY} _svn) - STRING(REGEX REPLACE "^${_svn_WC_ROOT}/" "" _branch ${_svn_WC_URL}) - STRING(REGEX REPLACE "^branches/" "" _branch ${_branch}) - STRING(REGEX REPLACE "/deal.II$" "" _branch ${_branch}) - SET(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${_branch}") -ENDIF() - -# -# Append config file name to CTEST_BUILD_NAME: -# - -IF(NOT "${CONFIG_FILE}" STREQUAL "") - GET_FILENAME_COMPONENT(_conf ${CONFIG_FILE} NAME_WE) - STRING(REGEX REPLACE "#.*$" "" _conf ${_conf}) - SET(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${_conf}") -ENDIF() - -MESSAGE("-- CTEST_BUILD_NAME: ${CTEST_BUILD_NAME}") - -# -# We require valid svn information for build tests: -# - -IF( "${TRACK}" STREQUAL "Build Tests" - AND NOT DEFINED _svn_WC_REVISION ) +IF(NOT EXISTS ${CTEST_SOURCE_DIRECTORY}/cmake/scripts/run_testsuite.cmake) MESSAGE(FATAL_ERROR " -TRACK was set to \"Build Tests\" which requires the source directory to be -under Subversion version control. +Could not find a suitable source directory. +There is no source directory \"../deal.II\" relative to the location of this script. +Please, set CTEST_SOURCE_DIRECTORY manually to the appropriate source directory. " ) ENDIF() -# -# Write revision log: -# - -IF(DEFINED _svn_WC_REVISION) - FILE(WRITE ${CTEST_BINARY_DIRECTORY}/revision.log -"### -# -# SVN information: -# SVN_WC_URL: ${_svn_WC_URL} -# SVN_WC_REVISION: ${_svn_WC_REVISION} -# SVN_WC_LAST_CHANGED_DATE: ${_svn_WC_LAST_CHANGED_DATE} -# -###" - ) -ELSE() - FILE(WRITE ${CTEST_BINARY_DIRECTORY}/revision.log -"### -# -# No SVN information available. -# -###" - ) -ENDIF() - -# -# Declare files that should be submitted as notes: -# - -SET(CTEST_NOTES_FILES - ${CTEST_BINARY_DIRECTORY}/revision.log - ${CTEST_BINARY_DIRECTORY}/summary.log - ${CTEST_BINARY_DIRECTORY}/detailed.log - ${CTEST_BINARY_DIRECTORY}/include/deal.II/base/config.h - ) - - -######################################################################## -# # -# Run the testsuite: # -# # -######################################################################## - -IF(NOT "${_branch}" STREQUAL "") - SET_PROPERTY(GLOBAL PROPERTY SubProject ${_branch}) -ENDIF() - -CTEST_START(Experimental TRACK ${TRACK}) - -CTEST_CONFIGURE(OPTIONS "${_options}" RETURN_VALUE _res) - -IF("${_res}" STREQUAL "0") - # Only run the build stage if configure was successful: - - CTEST_BUILD(TARGET NUMBER_ERRORS _res) - - IF("${_res}" STREQUAL "0") - # Only run tests if the build was successful: - - EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} - --build ${CTEST_BINARY_DIRECTORY} --target setup_test - OUTPUT_QUIET RESULT_VARIABLE _res - ) - IF(NOT "${_res}" STREQUAL "0") - MESSAGE(FATAL_ERROR " -\"setup_test\" target exited with an error. Bailing out. -" - ) - ENDIF() - - CTEST_TEST() - ENDIF() -ENDIF() - -# -# Inject compiler information and svn revision into xml files: -# - -FILE(STRINGS ${CTEST_BINARY_DIRECTORY}/Testing/TAG _tag LIMIT_COUNT 1) -SET(_path "${CTEST_BINARY_DIRECTORY}/Testing/${_tag}") -IF(NOT EXISTS ${_path}) - MESSAGE(FATAL_ERROR " -Unable to determine test submission files from TAG. Bailing out. -" - ) -ENDIF() -FILE(GLOB _xml_files ${_path}/*.xml) -EXECUTE_PROCESS(COMMAND sed -i -e - s/CompilerName=\"\"/CompilerName=\"${_compiler_name}\"\\n\\tCompilerVersion=\"${_compiler_version}\"/g - ${_xml_files} - OUTPUT_QUIET RESULT_VARIABLE _res - ) -IF(NOT "${_res}" STREQUAL "0") - MESSAGE(FATAL_ERROR " -\"sed\" failed. Bailing out. -" - ) -ENDIF() - -IF(NOT "${_svn_WC_REVISION}" STREQUAL "") - FILE(WRITE ${_path}/Update.xml -" - - ${CTEST_SITE} - ${CTEST_BUILD_NAME} - ${_tag}-${TRACK} - SVN - ${_svn_WC_REVISION} - ${_branch} -" - ) -ENDIF() - -# -# And finally submit: -# - -CTEST_SUBMIT() - -# .oO( This script is freaky 456 lines long... ) +MESSAGE("-- Redirect to: ${CTEST_SOURCE_DIRECTORY}/cmake/scripts/run_testsuite.cmake") +INCLUDE(${CTEST_SOURCE_DIRECTORY}/cmake/scripts/run_testsuite.cmake) diff --git a/tests/serialization/CMakeLists.txt b/tests/serialization/CMakeLists.txt index a51b880d4f..e39c51b85d 100644 --- a/tests/serialization/CMakeLists.txt +++ b/tests/serialization/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) DEAL_II_PICKUP_TESTS() diff --git a/tests/slepc/CMakeLists.txt b/tests/slepc/CMakeLists.txt index a51b880d4f..d0e042634b 100644 --- a/tests/slepc/CMakeLists.txt +++ b/tests/slepc/CMakeLists.txt @@ -1,5 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) -DEAL_II_PICKUP_TESTS() +IF(DEAL_II_WITH_SLEPC) + DEAL_II_PICKUP_TESTS() +ENDIF() diff --git a/tests/trilinos/CMakeLists.txt b/tests/trilinos/CMakeLists.txt index a51b880d4f..862d6a1f5e 100644 --- a/tests/trilinos/CMakeLists.txt +++ b/tests/trilinos/CMakeLists.txt @@ -1,5 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) -DEAL_II_PICKUP_TESTS() +IF(DEAL_II_WITH_TRILINOS) + DEAL_II_PICKUP_TESTS() +ENDIF() diff --git a/tests/umfpack/CMakeLists.txt b/tests/umfpack/CMakeLists.txt index a51b880d4f..70aca765ff 100644 --- a/tests/umfpack/CMakeLists.txt +++ b/tests/umfpack/CMakeLists.txt @@ -1,5 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) -INCLUDE(${TEST_DIR}/cmake/setup_testsuite.cmake) +INCLUDE(${DEAL_II_SOURCE_DIR}/cmake/setup_testsuite.cmake) PROJECT(testsuite CXX) INCLUDE(${DEAL_II_TARGET_CONFIG}) -DEAL_II_PICKUP_TESTS() +IF(DEAL_II_WITH_UMFPACK) + DEAL_II_PICKUP_TESTS() +ENDIF() -- 2.39.5