LIST(GET DEAL_II_BUILD_TYPES 0 _mybuild)
MESSAGE(STATUS "Setup quick_tests in ${_mybuild} mode")
+SET(ALL_TESTS) # clean variable
+
# define a macro to set up a quick test:
MACRO(make_quicktest test_basename build_name mpi_run)
STRING(TOLOWER ${build_name} _build_lowercase)
SET(_target ${test_basename}.${_build_lowercase})
- LIST(APPEND AllTests "${_target}")
+ LIST(APPEND ALL_TESTS "${_target}")
ADD_EXECUTABLE(${_target} EXCLUDE_FROM_ALL ${test_basename}.cc)
DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${build_name})
- IF(NOT ${mpi_run} EQUAL "")
- ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK
- DEPENDS ${_target}
- DEPENDS kill-${_target}-OK
- COMMAND mpirun -n ${mpi_run} ./${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 || (rm ${_target}-OK && exit 1)
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- )
+ IF("${mpi_run}" STREQUAL "")
+ SET(_command ./${_target})
ELSE()
- ADD_CUSTOM_TARGET(${_target}-OK
- DEPENDS ${_target}
- DEPENDS kill-${_target}-OK
- COMMAND ./${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 || (cat ${_target}-OK && rm ${_target}-OK && exit 1)
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- )
+ SET(_command mpirun -n ${mpi_run} ./${_target})
ENDIF()
-
- # this is a hack to make sure the -OK file is deleted
- ADD_CUSTOM_TARGET(kill-${_target}-OK
- COMMAND rm -f ${_target}-OK
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- )
-
- # make sure kill is run before the other two:
- ADD_DEPENDENCIES(${_target} kill-${_target}-OK)
-
ADD_CUSTOM_TARGET(${_target}.run
DEPENDS ${_target}
- DEPENDS ${_target}-OK
- COMMAND echo "${_target}: PASSED.")
+ COMMAND
+ ${_command} > ${_target}-OK 2>&1
+ ||(echo "${_target}: RUN failed. Output:"
+ && cat ${_target}-OK
+ && rm ${_target}-OK
+ && exit 1)
+ COMMAND echo "${_target}: PASSED."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
ADD_TEST(NAME ${_target}
COMMAND ${CMAKE_COMMAND} -DTRGT=${_target}.run -DTEST=${_target}
ENDMACRO()
-# simple assembly/solver test. This makes sure we can compile and link correctly
+# Simple assembly/solver test. This makes sure we can compile and link correctly
# in debug and release.
FOREACH(_build ${DEAL_II_BUILD_TYPES})
make_quicktest("step" ${_build} "")
# A custom test target:
ADD_CUSTOM_TARGET(test
- COMMAND ${CMAKE_COMMAND} -D ALL_TESTS="${AllTests}" -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake
+ COMMAND ${CMAKE_COMMAND} -D ALL_TESTS="${ALL_TESTS}" -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
ADD_DEPENDENCIES(test build_library)
EXECUTE_PROCESS(COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure -O quicktests.log RESULT_VARIABLE res_var)
if(NOT "${res_var}" STREQUAL "0")
- MESSAGE( "\n*************** WARNING *****************\nSome of the tests failed. Please scroll up or check the file tests/quick_tests/quicktests.log for the error messages. If you are unable to fix the problems, see the FAQ or write to the mailing list linked at http://www.dealii.org\n")
+ MESSAGE( "
+
+******************************* WARNING *******************************
+
+Some of the tests failed!
+
+Please scroll up or check the file tests/quick_tests/quicktests.log for the
+error messages. If you are unable to fix the problems, see the FAQ or write
+to the mailing list linked at http://www.dealii.org\n"
+ )
FOREACH(test ${ALL_TESTS})
IF (${test} MATCHES "^affinity" AND NOT EXISTS ${test}-OK)
- 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.")
+ 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.\n"
+ )
ENDIF()
IF (${test} MATCHES "^step-petsc" AND NOT EXISTS ${test}-OK)
- MESSAGE("Additional information about PETSc issues is available at:\nhttp://www.dealii.org/developer/external-libs/petsc.html")
+ 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)
- 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.")
+ 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()
ENDIF()
-