if(DEFINED DEAL_II_HAVE_TESTS_DIRECTORY)
+
+ #
+ # Define a top-level "test" target that runs our quick tests wrapper.
+ #
+
+ if("${CMAKE_VERSION}" VERSION_LESS "3.11" AND POLICY CMP0037)
+ # allow to override "test" target for quick tests
+ cmake_policy(SET CMP0037 OLD)
+ endif()
+
+ # Use the first available build type (this prefers debug mode if available):
+ list(GET DEAL_II_BUILD_TYPES 0 _my_build)
+ add_custom_target(test
+ COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=${_my_build} -P ${CMAKE_CURRENT_SOURCE_DIR}/run_quick_tests.cmake
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMENT "Running quicktests..."
+ )
+
+ # Depend on the library target to ensure that deal.II is actually
+ # compiled, as well as on the setup_tests_quick_tests target to ensure
+ # that quick tests are actually available.
+ add_dependencies(test library)
+ add_dependencies(test setup_tests_quick_tests)
+
#
# Add a dummy target to make files known to IDEs like qtcreator
#
${CMAKE_CURRENT_SOURCE_DIR}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*/*.cc
${CMAKE_CURRENT_SOURCE_DIR}/*/*.h
- )
-
- add_custom_target(testsuite
- SOURCES ${_misc}
- )
+ )
+ add_custom_target(testsuite SOURCES ${_misc})
message(STATUS "Setting up testsuite - Done")
endif()
##
## ---------------------------------------------------------------------
+#
# This file is run when "make test" is executed by the user and is
-# responsible for running the tests and printing some helpful
-# error messages.
+# responsible for running the tests and printing some helpful error
+# messages.
+#
+
include(ProcessorCount)
PROCESSORCOUNT(_n_processors)
+
if(_n_processors EQUAL 0)
set(_n_processors "1")
endif()
-
-# Windows quick tests have a race condition, so disable compiling/running
-# tests in parallel. This avoid errors like:
-#
-# error MSB3491: Could not write lines to file
-# "obj_boost_system_debug.dir\Debug\obj_boos.4A356C5C.tlog\obj_boost_system_debug.lastbuildstate". The
-# process cannot access the file '...' because it is being used by another
-# process.
+# Avoid race conditions with native Windows build tools:
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
set(_n_processors "1")
endif()
-separate_arguments(ALL_TESTS)
+if("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ set(CMAKE_BUILD_TYPE "Debug")
+endif()
+message(STATUS "Running quick_tests in ${CMAKE_BUILD_TYPE} mode with -j${_n_processors}:")
-execute_process(COMMAND ${CMAKE_CTEST_COMMAND} -j${_n_processors}
- -C ${CMAKE_BUILD_TYPE}
- --force-new-ctest-process
- --output-on-failure
- -O quicktests.log
- RESULT_VARIABLE res_var)
+#
+# Always restrict quick tests with specified build type, but run the step
+# and affinity quick tests in all available configuration:
+#
+
+string(TOLOWER "${CMAKE_BUILD_TYPE}" _build_type)
+execute_process(COMMAND ${CMAKE_CTEST_COMMAND}
+ -j${_n_processors} -C ${CMAKE_BUILD_TYPE} --force-new-ctest-process
+ -R "quick_tests/(step.debug|step.release|affinity|.*.${_build_type})"
+ OUTPUT_VARIABLE _output ERROR_VARIABLE _output RESULT_VARIABLE _return_value
+ )
+message(${_output})
-if(NOT "${res_var}" STREQUAL "0")
+if(NOT "${_return_value}" STREQUAL "0")
message("
***************************************************************************
+** **
** Error: Some of the quick tests failed. **
+** **
***************************************************************************
Please scroll up or check the file tests/quick_tests/quicktests.log for the
to the mailing list linked at http://www.dealii.org\n"
)
- foreach(test ${ALL_TESTS})
- if (${test} MATCHES "^affinity" AND NOT EXISTS ${test}-OK)
+ string(REPLACE "\n" ";" _output "${_output}")
+ foreach(_line ${_output})
+ if ("${_line}" MATCHES "affinity.*FAILED")
message("
The affinity test can fail when you are linking in a library like BLAS
which uses OpenMP. Even without calling any BLAS functions, OpenMP messes
with the thread affinity which causes TBB to run single-threaded only. You
-can fix this by exporting OMP_NUM_THREADS=1. Also see GOMP_CPU_AFFINITY
+can fix this by exporting OMP_NUM_THREADS=1. Also see GOMP_CPU_AFFINITY
and OMP_PROC_BIND.\n"
)
endif()
- if (${test} MATCHES "^step-petsc" AND NOT EXISTS ${test}-OK)
+ if (${_line} MATCHES "step-petsc.*FAILED")
message("
Additional information about PETSc issues is available
at:\nhttp://www.dealii.org/developer/external-libs/petsc.html\n"
)
endif()
- if (${test} MATCHES "^p4est" AND NOT EXISTS ${test}-OK)
+ if (${test} MATCHES "p4est.*FAILED" AND NOT EXISTS ${test}-OK)
message("
The p4est test can fail if you are running an OpenMPI version before 1.5.
This is a known problem and the only work around is to update to a more
recent version or use a different MPI library like MPICH.\n"
)
endif()
-
endforeach()
-
- # The CMake command message(SEND_ERROR ...) is, to the best of the authors'
- # knowledge, the only way to set the exit status of CMake to a nonzero value.
- # If we used message(SEND_ERROR ...) at the top (with the actual error
- # message) then subsequent messages (i.e., the test specific help) would not
- # be printed. Hence, do it down here.
- message(SEND_ERROR "")
-
endif()