From: Matthias Maier Date: Mon, 16 Sep 2013 00:11:30 +0000 (+0000) Subject: Big refactoring to avoid a severe performance regression with GNU Make X-Git-Tag: v8.1.0~570^2~331 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcefd53af6bfbe79deaa3e4bb41fd4696f268b6c;p=dealii.git Big refactoring to avoid a severe performance regression with GNU Make git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30720 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 01b9da29d8..5a6f6f4c2c 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -149,7 +149,7 @@ ADD_SUBDIRECTORY(examples) ADD_SUBDIRECTORY(tests ${CMAKE_BINARY_DIR}/quick_tests) -IF(DEAL_II_COMPONENT_TESTSUITE AND DEAL_II_HAVE_TESTS_DIRECTORY) +IF(DEAL_II_HAVE_TESTS_DIRECTORY) ADD_SUBDIRECTORY(${TEST_DIR} ${CMAKE_BINARY_DIR}/tests) ENDIF() diff --git a/deal.II/cmake/config/CMakeLists.txt b/deal.II/cmake/config/CMakeLists.txt index 48cf9f0c92..5cef0a75a6 100644 --- a/deal.II/cmake/config/CMakeLists.txt +++ b/deal.II/cmake/config/CMakeLists.txt @@ -315,6 +315,7 @@ ADD_CUSTOM_TARGET(setup_build_dir ALL ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + COMMENT "Update build configuration" ) ADD_DEPENDENCIES(library setup_build_dir) diff --git a/deal.II/cmake/macros/macro_set_if_empty.cmake b/deal.II/cmake/macros/macro_set_if_empty.cmake index 43f0125445..35acf55729 100644 --- a/deal.II/cmake/macros/macro_set_if_empty.cmake +++ b/deal.II/cmake/macros/macro_set_if_empty.cmake @@ -17,9 +17,9 @@ # # If 'variable' is empty it will be set to 'value' # -MACRO(SET_IF_EMPTY _variable _value) +MACRO(SET_IF_EMPTY _variable) IF("${${_variable}}" STREQUAL "") - SET(${_variable} ${_value}) + SET(${_variable} ${ARGN}) ENDIF() ENDMACRO() diff --git a/deal.II/cmake/setup_cached_variables.cmake b/deal.II/cmake/setup_cached_variables.cmake index 9d9f29bb09..c2e04fe20d 100644 --- a/deal.II/cmake/setup_cached_variables.cmake +++ b/deal.II/cmake/setup_cached_variables.cmake @@ -28,7 +28,6 @@ # DEAL_II_COMPONENT_EXAMPLES # DEAL_II_COMPONENT_MESH_CONVERTER # DEAL_II_COMPONENT_PARAMETER_GUI -# DEAL_II_COMPONENT_TESTSUITE # DEAL_II_FORCE_AUTODETECTION # # Options regarding compilation and linking: @@ -94,13 +93,6 @@ OPTION(DEAL_II_COMPONENT_PARAMETER_GUI OFF ) -If(DEAL_II_HAVE_TESTS_DIRECTORY) - OPTION(DEAL_II_COMPONENT_TESTSUITE - "Enable the full regression testsuite." - OFF - ) -ENDIF() - OPTION(DEAL_II_ALLOW_AUTODETECTION "Allow to automatically setup features by setting all undefined DEAL_II_WITH_* variables to ON or OFF" ON @@ -322,7 +314,7 @@ FOREACH(_var ${_res}) # # Same for components: # - IF(_var MATCHES "^(COMPAT_FILES|DOCUMENTATION|EXAMPLES|MESH_CONVERTER|PARAMETER_GUI|TESTSUITE)") + IF(_var MATCHES "^(COMPAT_FILES|DOCUMENTATION|EXAMPLES|MESH_CONVERTER|PARAMETER_GUI)") SET(DEAL_II_COMPONENT_${_var} ${${_var}} CACHE BOOL "" FORCE) UNSET(${_var} CACHE) ENDIF() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f40ded87ce..b41f9899c9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,72 +14,91 @@ ## ## --------------------------------------------------------------------- -# # Setup the testsuite: -# -INCLUDE(setup_testsuite) +INCLUDE(cmake/setup_testsuite.cmake) # -# And include all subdirectories: +# This is a bloody hack to avoid a severe performance regression with +# GNU Make that really does not like 12k top level targets at once... +# +# 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 :-( # -MESSAGE(STATUS "") -MESSAGE(STATUS "Proceed to test definitions now:") - -#ADD_SUBDIRECTORY(a-framework) -- no idea what to do with that ... - -ADD_SUBDIRECTORY(all-headers) -ADD_SUBDIRECTORY(aniso) -ADD_SUBDIRECTORY(base) -ADD_SUBDIRECTORY(bits) -ADD_SUBDIRECTORY(build_tests) -ADD_SUBDIRECTORY(codim_one) -ADD_SUBDIRECTORY(deal.II) - -IF(DEAL_II_WITH_P4EST) - ADD_SUBDIRECTORY(distributed_grids) -ENDIF() -#ADD_SUBDIRECTORY(fail) -- the good old failing tests +MESSAGE(STATUS "Proceed to test definitions now.") -ADD_SUBDIRECTORY(fe) -ADD_SUBDIRECTORY(grid) -ADD_SUBDIRECTORY(hp) -ADD_SUBDIRECTORY(integrators) -ADD_SUBDIRECTORY(lac) +ADD_CUSTOM_TARGET(setup_test) +ADD_CUSTOM_TARGET(cleanup_test) +FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/deal.IITestfile.cmake "") +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) - ADD_SUBDIRECTORY(lapack) + LIST(APPEND _categories lapack) ENDIF() - -ADD_SUBDIRECTORY(matrix_free) - IF(DEAL_II_WITH_METIS) - ADD_SUBDIRECTORY(metis) + LIST(APPEND _categories metis) ENDIF() - -# TODO: Really with P4EST? IF(DEAL_II_WITH_MPI AND DEAL_II_WITH_P4EST) - ADD_SUBDIRECTORY(gla) - ADD_SUBDIRECTORY(mpi) + LIST(APPEND _categories gla mpi) +ENDIF() +IF(DEAL_II_WITH_P4EST) + LIST(APPEND _categories distributed_grids) ENDIF() - -ADD_SUBDIRECTORY(multigrid) - IF(DEAL_II_WITH_PETSC) - ADD_SUBDIRECTORY(petsc) + LIST(APPEND _categories petsc) ENDIF() - -ADD_SUBDIRECTORY(serialization) - IF(DEAL_II_WITH_SLEPC) - ADD_SUBDIRECTORY(slepc) + LIST(APPEND _categories slepc) ENDIF() - IF(DEAL_II_WITH_TRILINOS) - ADD_SUBDIRECTORY(trilinos) + LIST(APPEND _categories trilinos) ENDIF() - IF(DEAL_II_WITH_UMFPACK) - ADD_SUBDIRECTORY(umfpack) + LIST(APPEND _categories umfpack) ENDIF() +FOREACH(_category ${_categories}) + # avoid stale test definitions: + FILE(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${_category}/CTestTestfile.cmake) + + ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${_category} + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_CURRENT_BINARY_DIR}/${_category} + ) + ADD_CUSTOM_TARGET(setup_test_${_category} + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_CURRENT_BINARY_DIR}/${_category} + COMMAND ${CMAKE_COMMAND} + -G${CMAKE_GENERATOR} + -DDEAL_II_DIR=${CMAKE_BINARY_DIR} + -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR} + -DTEST_CMAKE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/cmake # TODO: Refactor + -DTEST_DIFF="${TEST_DIFF}" # TODO: Refactor + -DTEST_PICKUP_REGEX=${TEST_PICKUP_REGEX} # TODO: Refactor + -DTEST_TIME_LIMIT=${TEST_TIME_LIMIT} # TODO: Refactor + ${CMAKE_CURRENT_SOURCE_DIR}/${_category} + > /dev/null # Shoo! + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_category} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_category} + COMMENT "Processing ./tests/${_category}" + ) + ADD_DEPENDENCIES(setup_test_${_category} library) + ADD_DEPENDENCIES(setup_test setup_test_${_category}) + + ADD_CUSTOM_TARGET(cleanup_test_${_category} + COMMAND ${CMAKE_COMMAND} -E remove_directory + ${CMAKE_CURRENT_BINARY_DIR}/${_category} + ) + ADD_DEPENDENCIES(cleanup_test cleanup_test_${_category}) + + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/deal.IITestfile.cmake + "SUBDIRS(${_category})\n" + ) +ENDFOREACH() + +SET_PROPERTY(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + APPEND PROPERTY TEST_INCLUDE_FILE deal.IITestfile.cmake + ) diff --git a/tests/README b/tests/README index 7dc46144ac..c39fb88daa 100644 --- a/tests/README +++ b/tests/README @@ -99,12 +99,13 @@ simultaneous processes in the following way: How to set up and run the testsuite =================================== -To enable the testsuite, configure deal.II in a build directory with +To enable the testsuite, configure and build deal.II in a build directory +as normal (installation is not necessary). After that you can setup the +tests via the "setup_test" target: - # cmake -DTESTSUITE=ON . + # make setup_test -After you have build deal.II as usual (installation is not necessary) you -can run the testsuite in the _build directory_ via +Now, the testsuite can be run in the _build directory_ via # ctest [-j x] @@ -143,12 +144,17 @@ Setup only a subset of tests ---------------------------- It is possible to set up only a subset of tests that match a regular -expression during configuration: +expression during test setup. - # cmake -DTESTSUITE=ON -DTEST_PICKUP_REGEX="" . + # make setup_test TEST_PICKUP_REGEX="" -Note: If you wish to disable this filter again, undefine TEST_PICKUP_REGEX -in the Cache: +Alternatively, you can specify TEST_PICKUP_REGEX upon configuration: + + # cmake -DTEST_PICKUP_REGEX=" ) @@ -60,15 +78,21 @@ FOREACH(_full_file ${_header}) -DTRGT=${_target} -DTEST=${_test} -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} - -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake + -P ${TEST_CMAKE_DIR}/scripts/run_test.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) SET_TESTS_PROPERTIES(${_test} PROPERTIES LABEL "${_category}" TIMEOUT ${TEST_TIME_LIMIT} ) + MATH(EXPR _count "${_count}+1") ENDIF() ENDFOREACH() ENDFOREACH() -MESSAGE(STATUS "Process ./tests/${_category} - Done") +MESSAGE(STATUS + "Testsuite: Set up ${_count} regression tests in category ${_category}." + ) +MESSAGE(STATUS + " (Timeout: ${TEST_TIME_LIMIT}, Diff: "${_test_diff}")" + ) diff --git a/tests/aniso/CMakeLists.txt b/tests/aniso/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/aniso/CMakeLists.txt +++ b/tests/aniso/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/base/CMakeLists.txt b/tests/base/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/base/CMakeLists.txt +++ b/tests/base/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/bits/CMakeLists.txt b/tests/bits/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/bits/CMakeLists.txt +++ b/tests/bits/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/build_tests/CMakeLists.txt b/tests/build_tests/CMakeLists.txt index 2bb8d008b8..2afd5496a5 100644 --- a/tests/build_tests/CMakeLists.txt +++ b/tests/build_tests/CMakeLists.txt @@ -14,6 +14,19 @@ ## ## --------------------------------------------------------------------- +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() + +SET_IF_EMPTY(TEST_PICKUP_REGEX "$ENV{TEST_PICKUP_REGEX}") + +# +# avoid bogus warnings: +# +SET(TEST_DIFF) + # # build_tests tests are special: # @@ -26,7 +39,6 @@ # SET(_category build_tests) -MESSAGE(STATUS "Process ./tests/${_category}") # Run a minimalistic set of steps in debug configuration: SET(_debug_steps @@ -44,7 +56,8 @@ SET(_release_steps step-47 step-48 step-49 ) -FILE(GLOB _steps ${CMAKE_SOURCE_DIR}/examples/step-*) +SET(_count "0") +FILE(GLOB _steps ${DEAL_II_SOURCE_DIR}/examples/step-*) FOREACH(_step_full ${_steps}) GET_FILENAME_COMPONENT(_step ${_step_full} NAME) @@ -145,16 +158,22 @@ FOREACH(_step_full ${_steps}) -DTRGT=${_target} -DTEST=${_test} -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} - -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake + -P ${TEST_CMAKE_DIR}/scripts/run_test.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) SET_TESTS_PROPERTIES(${_test} PROPERTIES LABEL "${_category}" TIMEOUT ${TEST_TIME_LIMIT} ) + MATH(EXPR _count "${_count}+1") ENDIF() ENDFOREACH() ENDFOREACH() -MESSAGE(STATUS "Process ./tests/${_category} - Done") +MESSAGE(STATUS + "Testsuite: Set up ${_count} regression tests in category ${_category}." + ) +MESSAGE(STATUS + " (Timeout: ${TEST_TIME_LIMIT}, Diff: "${_test_diff}")" + ) diff --git a/deal.II/cmake/macros/macro_deal_ii_add_test.cmake b/tests/cmake/macros/macro_add_test.cmake similarity index 83% rename from deal.II/cmake/macros/macro_deal_ii_add_test.cmake rename to tests/cmake/macros/macro_add_test.cmake index 340ee7b242..b39d1cc003 100644 --- a/deal.II/cmake/macros/macro_deal_ii_add_test.cmake +++ b/tests/cmake/macros/macro_add_test.cmake @@ -15,7 +15,7 @@ ## --------------------------------------------------------------------- # -# A Macro to set up tests for thes testsuite +# A Macro to set up tests for the testsuite # # The following variables must be set: # @@ -26,6 +26,10 @@ # - specifying the maximal wall clock time in seconds a test is allowed # to run # +# TEST_CMAKE_DIR +# - pointing to a cmake folder where normalize.pl and run_test.cmake are +# located +# # # Usage: # DEAL_II_ADD_TEST(category test_name comparison_file n_cpu [configurations]) @@ -54,6 +58,14 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file _n_cpu) + IF(NOT DEAL_II_PROJECT_CONFIG_INCLUDED) + MESSAGE(FATAL_ERROR + "\nDEAL_II_ADD_TEST can only be called in external test subprojects after " + "the inclusion of deal.IIConfig.cmake. It is not intended for " + "internal use.\n\n" + ) + ENDIF() + FOREACH(_build ${DEAL_II_BUILD_TYPES}) ITEM_MATCHES(_match "${_build}" ${ARGN}) @@ -91,11 +103,22 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file _n_cpu) # only add the target once ADD_EXECUTABLE(${_target} EXCLUDE_FROM_ALL ${_test_name}.cc) - DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${_build}) + + SET_TARGET_PROPERTIES(${_target} PROPERTIES + LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}}" + COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}" + COMPILE_FLAGS "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}" + LINKER_LANGUAGE "CXX" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_test_short}" + ) + SET_PROPERTY(TARGET ${_target} APPEND PROPERTY + INCLUDE_DIRECTORIES "${DEAL_II_INCLUDE_DIRS}" + ) SET_PROPERTY(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" ) + TARGET_LINK_LIBRARIES(${_target} ${DEAL_II_TARGET}) ENDIF() # @@ -113,13 +136,13 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file _n_cpu) && exit 1) COMMAND ${PERL_EXECUTABLE} -pi - ${CMAKE_SOURCE_DIR}/cmake/scripts/normalize.pl + ${TEST_CMAKE_DIR}/scripts/normalize.pl ${_test_directory}/output WORKING_DIRECTORY ${_test_directory} DEPENDS ${_target} - ${CMAKE_SOURCE_DIR}/cmake/scripts/normalize.pl + ${TEST_CMAKE_DIR}/scripts/normalize.pl ) ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/diff COMMAND @@ -157,7 +180,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 ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake + -P ${TEST_CMAKE_DIR}/scripts/run_test.cmake WORKING_DIRECTORY ${_test_directory} ) SET_TESTS_PROPERTIES(${_test_full} PROPERTIES diff --git a/tests/cmake/macros/macro_item_matches.cmake b/tests/cmake/macros/macro_item_matches.cmake new file mode 100644 index 0000000000..3e747bb4c4 --- /dev/null +++ b/tests/cmake/macros/macro_item_matches.cmake @@ -0,0 +1,35 @@ +## --------------------------------------------------------------------- +## $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/deal.II/cmake/macros/macro_deal_ii_pickup_tests.cmake b/tests/cmake/macros/macro_pickup_tests.cmake similarity index 79% rename from deal.II/cmake/macros/macro_deal_ii_pickup_tests.cmake rename to tests/cmake/macros/macro_pickup_tests.cmake index cf5fdc1bb4..d78715da7e 100644 --- a/deal.II/cmake/macros/macro_deal_ii_pickup_tests.cmake +++ b/tests/cmake/macros/macro_pickup_tests.cmake @@ -24,11 +24,28 @@ # DEAL_II_PICKUP_TESTS() # +IF(NOT DEFINED SET_IF_EMPTY) + MACRO(SET_IF_EMPTY _variable) + IF("${${_variable}}" STREQUAL "") + SET(${_variable} ${ARGN}) + ENDIF() + ENDMACRO() +ENDIF() + MACRO(DEAL_II_PICKUP_TESTS) + SET_IF_EMPTY(TEST_PICKUP_REGEX "$ENV{TEST_PICKUP_REGEX}") + GET_FILENAME_COMPONENT(_category ${CMAKE_CURRENT_SOURCE_DIR} NAME) - MESSAGE(STATUS "Process ./tests/${_category}") + # + # Strip the quoting from TEST_DIFF: + # + SET(_test_diff ${TEST_DIFF}) + SEPARATE_ARGUMENTS(TEST_DIFF UNIX_COMMAND ${TEST_DIFF}) + SET(DEAL_II_SOURCE_DIR) # avoid a bogus warning + + SET(_count "0") FILE(GLOB _tests "*.output") FOREACH(_test ${_tests}) SET(_comparison ${_test}) @@ -67,9 +84,7 @@ MACRO(DEAL_II_PICKUP_TESTS) ENDIF() ENDFOREACH() - IF(_define_test) - # # Determine whether the test should be run with mpirun: # @@ -83,19 +98,24 @@ MACRO(DEAL_II_PICKUP_TESTS) IF(_test MATCHES debug) SET(_configuration DEBUG) + MATH(EXPR _count "${_count}+1") ELSEIF(_test MATCHES release) SET(_configuration RELEASE) + MATH(EXPR _count "${_count}+1") ELSE() SET(_configuration) + MATH(EXPR _count "${_count}+2") ENDIF() STRING(REGEX REPLACE "\\..*" "" _test ${_test}) DEAL_II_ADD_TEST(${_category} ${_test} ${_comparison} ${_n_cpu} ${_configuration}) ENDIF() - ENDFOREACH() - MESSAGE(STATUS "Process ./tests/${_category} - Done") - + MESSAGE(STATUS + "Testsuite: Set up ${_count} regression tests in category ${_category}." + ) + MESSAGE(STATUS + " (Timeout: ${TEST_TIME_LIMIT}, Diff: "${_test_diff}")" + ) ENDMACRO() - diff --git a/tests/cmake/macros/macro_set_if_empty.cmake b/tests/cmake/macros/macro_set_if_empty.cmake new file mode 100644 index 0000000000..35acf55729 --- /dev/null +++ b/tests/cmake/macros/macro_set_if_empty.cmake @@ -0,0 +1,25 @@ +## --------------------------------------------------------------------- +## $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/deal.II/cmake/scripts/normalize.pl b/tests/cmake/scripts/normalize.pl similarity index 100% rename from deal.II/cmake/scripts/normalize.pl rename to tests/cmake/scripts/normalize.pl diff --git a/tests/cmake/scripts/run_test.cmake b/tests/cmake/scripts/run_test.cmake new file mode 100644 index 0000000000..1955519fdf --- /dev/null +++ b/tests/cmake/scripts/run_test.cmake @@ -0,0 +1,76 @@ +# +# TODO: The following variables have to be set: +# +# TARGET +# TEST +# DEAL_II_BINARY_DIR +# + +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: + # + 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("=============================== 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 failed\\." _configure_regex ${_output}) + STRING(REGEX MATCH "${TEST}: BUILD successful\\." _build_regex ${_output}) + STRING(REGEX MATCH "${TEST}: RUN successful\\." _run_regex ${_output}) + IF(NOT "${_configure_regex}" 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 "") + # Some special output in case the BUILD stage failed: + 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/cmake/setup_macros.cmake b/tests/cmake/setup_macros.cmake new file mode 100644 index 0000000000..8914c9d6a0 --- /dev/null +++ b/tests/cmake/setup_macros.cmake @@ -0,0 +1,24 @@ +## --------------------------------------------------------------------- +## $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. +## +## --------------------------------------------------------------------- + +# +# Load all macros: +# + +FILE(GLOB _macro_files "${CMAKE_CURRENT_LIST_DIR}/macros/*.cmake") +FOREACH(_file ${_macro_files}) + INCLUDE(${_file}) +ENDFOREACH() diff --git a/deal.II/cmake/setup_testsuite.cmake b/tests/cmake/setup_testsuite.cmake similarity index 76% rename from deal.II/cmake/setup_testsuite.cmake rename to tests/cmake/setup_testsuite.cmake index 2e9300f5d4..7e54481092 100644 --- a/deal.II/cmake/setup_testsuite.cmake +++ b/tests/cmake/setup_testsuite.cmake @@ -25,18 +25,7 @@ # # -# We need perl for the testsuite: -# - -FIND_PACKAGE(Perl) -IF(NOT PERL_FOUND) - MESSAGE(FATAL_ERROR - "Could not find a perl installation which is required for running the test suite" - ) -ENDIF() - -# -# And a diff tool, preferably numdiff: +# Wee need a diff tool, preferably numdiff: # FIND_PROGRAM(NUMDIFF_EXECUTABLE @@ -55,16 +44,19 @@ IF( NUMDIFF_EXECUTABLE MATCHES "-NOTFOUND" ENDIF() IF(NOT NUMDIFF_EXECUTABLE MATCHES "-NOTFOUND") - SET_IF_EMPTY(TEST_DIFF ${NUMDIFF_EXECUTABLE} -a 1e-6 -q -s ' \t\n:') + SET_IF_EMPTY(TEST_DIFF "${NUMDIFF_EXECUTABLE} -a 1e-6 -q") ELSE() - SET_IF_EMPTY(TEST_DIFF ${DIFF_EXECUTABLE}) + SET_IF_EMPTY(TEST_DIFF "${DIFF_EXECUTABLE}") ENDIF() +# +# Son, we have to talk about quotings: +# +SEPARATE_ARGUMENTS(TEST_DIFF UNIX_COMMAND ${TEST_DIFF}) MARK_AS_ADVANCED(DIFF_EXECUTABLE NUMDIFF_EXECUTABLE) # -# Set a default time limit of 60 seconds: +# Set a default time limit of 120 seconds: # - SET_IF_EMPTY(TEST_TIME_LIMIT 120) diff --git a/tests/codim_one/CMakeLists.txt b/tests/codim_one/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/codim_one/CMakeLists.txt +++ b/tests/codim_one/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/deal.II/CMakeLists.txt b/tests/deal.II/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/deal.II/CMakeLists.txt +++ b/tests/deal.II/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/distributed_grids/CMakeLists.txt b/tests/distributed_grids/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/distributed_grids/CMakeLists.txt +++ b/tests/distributed_grids/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/fail/CMakeLists.txt b/tests/fail/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/fail/CMakeLists.txt +++ b/tests/fail/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/fe/CMakeLists.txt b/tests/fe/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/fe/CMakeLists.txt +++ b/tests/fe/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/gla/CMakeLists.txt b/tests/gla/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/gla/CMakeLists.txt +++ b/tests/gla/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/grid/CMakeLists.txt b/tests/grid/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/grid/CMakeLists.txt +++ b/tests/grid/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/hp/CMakeLists.txt b/tests/hp/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/hp/CMakeLists.txt +++ b/tests/hp/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/integrators/CMakeLists.txt b/tests/integrators/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/integrators/CMakeLists.txt +++ b/tests/integrators/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/lac/CMakeLists.txt b/tests/lac/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/lac/CMakeLists.txt +++ b/tests/lac/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/lapack/CMakeLists.txt b/tests/lapack/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/lapack/CMakeLists.txt +++ b/tests/lapack/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/matrix_free/CMakeLists.txt b/tests/matrix_free/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/matrix_free/CMakeLists.txt +++ b/tests/matrix_free/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/metis/CMakeLists.txt b/tests/metis/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/metis/CMakeLists.txt +++ b/tests/metis/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/mpi/CMakeLists.txt b/tests/mpi/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/mpi/CMakeLists.txt +++ b/tests/mpi/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/multigrid/CMakeLists.txt b/tests/multigrid/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/multigrid/CMakeLists.txt +++ b/tests/multigrid/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/petsc/CMakeLists.txt b/tests/petsc/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/petsc/CMakeLists.txt +++ b/tests/petsc/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/scripts/find_identical.sh b/tests/scripts/find_identical.sh deleted file mode 100644 index 998f068f93..0000000000 --- a/tests/scripts/find_identical.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -###################################################################### -# Find equal reference files -# -# Called from one of the top level test directories, finds all doubled -# reference files in */cmp and outputs them for possible removal. -# -###################################################################### - -# go through all files -for dir in *; do - # if file is a directory, - if ! test -d $dir; then continue; fi - # change to the subdirectory with reference files - cd $dir/cmp - - # now diff all possible combinations and - # write a line if files are equal. - for file in *; do - for cmp in *; do - if test "$file" = "$cmp"; then break; fi - if diff -q $file $cmp &> /dev/null ; then - echo "$dir $file $cmp equal" - fi - done - done - cd ../.. - done diff --git a/tests/scripts/grid_generator_extract.pl b/tests/scripts/grid_generator_extract.pl deleted file mode 100644 index 463478e472..0000000000 --- a/tests/scripts/grid_generator_extract.pl +++ /dev/null @@ -1,29 +0,0 @@ -###################################################################### -# $Id$ -# Copyright 2005 by the deal.II authors -# -###################################################################### -# Extracts xfig and eps files from the output of -# bits/grid_generator_01.exe -###################################################################### -# call: -# perl thisfile outpufile -###################################################################### - -# Just open it in order to be able to close it -open OUT, ">0d-void.eps"; - -while (<>) -{ - if (m/DEAL:(\d)d-GridTest::(.+)/) - { - my $name = $2; - $name .= ".eps" if ($1==1); - $name .= ".fig" if ($1==2); - $name .= ".eps" if ($1==3); - close OUT; - open OUT, ">$1d-$name\n"; - next; - } - print OUT; -} diff --git a/tests/scripts/report_to_db.pl b/tests/scripts/report_to_db.pl deleted file mode 100644 index 7fa7957412..0000000000 --- a/tests/scripts/report_to_db.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/perl - -use strict; - -my $path = '.'; -my $revision; -my $id; -my $date; - -while(<>) -{ - if (m/^Date:\s*(\d+)\s+(\d+)/) - { - my $name = sprintf("%s/%04d-%03d", $path, $1, $2); -# print $name; - } - $revision = $1 if (m/^Revision:\s*(\d+)/); - $id = $1 . $2 if (m/^Id:\s*(\S+)\s+(\S+)?\n/); - if (m/^\d\d\d\d-\d\d-\d\d \d\d:\d\d/) - { - chop; - s/\s+/ /g; - s/ \+ / 4 /; - print "$revision $_ $id\n" - } -} diff --git a/tests/serialization/CMakeLists.txt b/tests/serialization/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/serialization/CMakeLists.txt +++ b/tests/serialization/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/slepc/CMakeLists.txt b/tests/slepc/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/slepc/CMakeLists.txt +++ b/tests/slepc/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/trilinos/CMakeLists.txt b/tests/trilinos/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/trilinos/CMakeLists.txt +++ b/tests/trilinos/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS() diff --git a/tests/umfpack/CMakeLists.txt b/tests/umfpack/CMakeLists.txt index 0efb828f2c..2b3c102b8a 100644 --- a/tests/umfpack/CMakeLists.txt +++ b/tests/umfpack/CMakeLists.txt @@ -1 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.1 REQUIRED HINTS ${DEAL_II_DIR}) +FIND_PACKAGE(Perl REQUIRED) +INCLUDE(${TEST_CMAKE_DIR}/setup_macros.cmake) +ENABLE_TESTING() DEAL_II_PICKUP_TESTS()