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()
#
# 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})
# 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()
#
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
ENDIF()
-OPTION(BUILD_TESTING
- "This option will enable the configuration of the build tests"
- OFF
- )
-
-
########################################################################
# #
# Compilation and linking: #
#
# 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()
--- /dev/null
+## ---------------------------------------------------------------------
+## $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()
# 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=<deal.II/${_path}/${_file}>
)