From: Matthias Maier Date: Sun, 15 Sep 2013 15:15:46 +0000 (+0000) Subject: Add a minimalistic 1 minute testsuite X-Git-Tag: v8.1.0~570^2~335 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=536196cbd97580668ea0878f1f0f1d5ba8e66857;p=dealii.git Add a minimalistic 1 minute testsuite git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30714 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index 9d92608c0b..01b9da29d8 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -147,9 +147,9 @@ ADD_SUBDIRECTORY(cmake/config) # has to be included after source ADD_SUBDIRECTORY(contrib) # has to be included after source ADD_SUBDIRECTORY(examples) -ADD_SUBDIRECTORY(quick_tests) +ADD_SUBDIRECTORY(tests ${CMAKE_BINARY_DIR}/quick_tests) -IF(BUILD_TESTING AND DEAL_II_HAVE_TESTS_DIRECTORY) +IF(DEAL_II_COMPONENT_TESTSUITE AND DEAL_II_HAVE_TESTS_DIRECTORY) ADD_SUBDIRECTORY(${TEST_DIR} ${CMAKE_BINARY_DIR}/tests) ENDIF() diff --git a/deal.II/cmake/macros/macro_deal_ii_add_test.cmake b/deal.II/cmake/macros/macro_deal_ii_add_test.cmake index ffc8cc13d3..340ee7b242 100644 --- a/deal.II/cmake/macros/macro_deal_ii_add_test.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_add_test.cmake @@ -62,47 +62,23 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file _n_cpu) # # Setup a bunch of variables describing the test: # - STRING(TOLOWER ${_build} _build_lowercase) - - # Short test name: - SET(_test_short ${_test_name}.${_build_lowercase}) - - # The target name for the executable: - SET(_target ${_category}-${_test_short}) + SET(_test_short ${_test_name}.${_build_lowercase}) # short test name + SET(_target ${_category}-${_test_short}) # the target name for the executable # If _n_cpu is equal to "0", a normal, sequental test will be run, # otherwise run the test with mpirun: IF("${_n_cpu}" STREQUAL "0") - # Diff target name: - SET(_diff_target ${_target}.diff) - - # Full test name: - SET(_test_full ${_category}/${_test_name}.${_build_lowercase}) - - # Directory to run the test in: - SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}) - - # The command to issue: - SET(_run_command ${_target}) - - # Finally set it to one, we'll still occupy one processor to run a - # test ;-) - SET(_n_cpu 1) - + SET(_diff_target ${_target}.diff) # diff target name + SET(_test_full ${_category}/${_test_name}.${_build_lowercase}) # full test name + SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}) # directory to run the test in + SET(_run_command ${_target}) # the command to issue + SET(_n_cpu 1) # set it to one, we'll still occupy one processor to run a test ;-) ELSE() - - # Diff target name: - SET(_diff_target ${_category}-${_test_name}.mpirun=${_n_cpu}.${_build_lowercase}.diff) - - # Full test name: - SET(_test_full ${_category}/${_test_name}.mpirun=${_n_cpu}.${_build_lowercase}) - - # Directory to run the test in: - SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}/mpirun=${_n_cpu}) - - # The command to issue: - SET(_run_command mpirun -np ${_n_cpu} ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}/${_target}) + SET(_diff_target ${_category}-${_test_name}.mpirun=${_n_cpu}.${_build_lowercase}.diff) # diff target name + SET(_test_full ${_category}/${_test_name}.mpirun=${_n_cpu}.${_build_lowercase}) # full test name + SET(_test_directory ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}/mpirun=${_n_cpu}) # directory to run the test in + SET(_run_command mpirun -np ${_n_cpu} ${CMAKE_CURRENT_BINARY_DIR}/${_test_short}/${_target}) # the command to issue ENDIF() FILE(MAKE_DIRECTORY ${_test_directory}) @@ -111,32 +87,15 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file _n_cpu) # Add an executable for the current test and set up compile # definitions and the full link interface: # - IF(NOT TARGET ${_target}) # only add the target once ADD_EXECUTABLE(${_target} EXCLUDE_FROM_ALL ${_test_name}.cc) - - 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_${_build}}" - LINKER_LANGUAGE "CXX" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_test_short}" - ) - SET_PROPERTY(TARGET ${_target} APPEND PROPERTY - INCLUDE_DIRECTORIES - "${CMAKE_BINARY_DIR}/include" - "${CMAKE_SOURCE_DIR}/include" - "${CMAKE_SOURCE_DIR}/include/deal.II/" - ) + DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${_build}) SET_PROPERTY(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" ) - TARGET_LINK_LIBRARIES(${_target} - ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX} - ) ENDIF() # diff --git a/deal.II/cmake/setup_cached_variables.cmake b/deal.II/cmake/setup_cached_variables.cmake index abf4013f1f..9d9f29bb09 100644 --- a/deal.II/cmake/setup_cached_variables.cmake +++ b/deal.II/cmake/setup_cached_variables.cmake @@ -94,6 +94,13 @@ 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 @@ -113,12 +120,6 @@ IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") ENDIF() -OPTION(BUILD_TESTING - "This option will enable the configuration of the build tests" - OFF - ) - - ######################################################################## # # # Compilation and linking: # @@ -321,7 +322,7 @@ FOREACH(_var ${_res}) # # Same for components: # - IF(_var MATCHES "^(COMPAT_FILES|DOCUMENTATION|EXAMPLES|MESH_CONVERTER|PARAMETER_GUI)") + IF(_var MATCHES "^(COMPAT_FILES|DOCUMENTATION|EXAMPLES|MESH_CONVERTER|PARAMETER_GUI|TESTSUITE)") SET(DEAL_II_COMPONENT_${_var} ${${_var}} CACHE BOOL "" FORCE) UNSET(${_var} CACHE) ENDIF() diff --git a/deal.II/quick_tests/CMakeLists.txt b/deal.II/quick_tests/CMakeLists.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/deal.II/tests/CMakeLists.txt b/deal.II/tests/CMakeLists.txt new file mode 100644 index 0000000000..6c0bf42d03 --- /dev/null +++ b/deal.II/tests/CMakeLists.txt @@ -0,0 +1,84 @@ +## --------------------------------------------------------------------- +## $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: +# + + +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 "${_category}") + + # + # 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} > ${_target}-OK 2>&1 + || (mv ${_target}-OK ${_target}-FAILED + && echo "${_target}: FAILED": + && cat ${_target}-FAILED + && 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} -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() diff --git a/deal.II/quick_tests/threads/affinity.cc b/deal.II/tests/affinity.cc similarity index 100% rename from deal.II/quick_tests/threads/affinity.cc rename to deal.II/tests/affinity.cc diff --git a/tests/all-headers/CMakeLists.txt b/tests/all-headers/CMakeLists.txt index c9e9c8204f..a3cb5dca3d 100644 --- a/tests/all-headers/CMakeLists.txt +++ b/tests/all-headers/CMakeLists.txt @@ -47,16 +47,7 @@ FOREACH(_full_file ${_header}) # Add an object library for each header file and build configuration: ADD_LIBRARY(${_target} OBJECT EXCLUDE_FROM_ALL test_header.cc) - SET_TARGET_PROPERTIES(${_target} PROPERTIES - COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}" - COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}" - ) - SET_PROPERTY(TARGET ${_target} APPEND PROPERTY - INCLUDE_DIRECTORIES - "${CMAKE_BINARY_DIR}/include" - "${CMAKE_SOURCE_DIR}/include" - "${CMAKE_SOURCE_DIR}/include/deal.II/" - ) + DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${_build}) SET_PROPERTY(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS HEADER= )