From 7acb50dcb524bbcb405981739415b6273f80d786 Mon Sep 17 00:00:00 2001 From: heister Date: Sun, 8 Dec 2013 00:08:59 +0000 Subject: [PATCH] better output for 'make test' and provide some helpful error messages git-svn-id: https://svn.dealii.org/trunk@31927 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/tests/quick_tests/CMakeLists.txt | 5 +-- deal.II/tests/quick_tests/run.cmake | 44 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 deal.II/tests/quick_tests/run.cmake diff --git a/deal.II/tests/quick_tests/CMakeLists.txt b/deal.II/tests/quick_tests/CMakeLists.txt index a01e681928..930c811caa 100644 --- a/deal.II/tests/quick_tests/CMakeLists.txt +++ b/deal.II/tests/quick_tests/CMakeLists.txt @@ -27,6 +27,7 @@ MESSAGE(STATUS "Setup quick_tests in ${_mybuild} mode") 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}") ADD_EXECUTABLE(${_target} EXCLUDE_FROM_ALL ${test_basename}.cc) DEAL_II_INSOURCE_SETUP_TARGET(${_target} ${build_name}) @@ -39,7 +40,7 @@ MACRO(make_quicktest test_basename build_name mpi_run) ELSE() ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK DEPENDS ${_target} - COMMAND ./${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 || (rm ${_target}-OK && exit 1) + COMMAND ./${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 || (cat ${_target}-OK && rm ${_target}-OK && exit 1) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) ENDIF() @@ -96,7 +97,7 @@ ENDIF() # A custom test target: ADD_CUSTOM_TARGET(test - COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process + COMMAND ${CMAKE_COMMAND} -D ALL_TESTS="${AllTests}" -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) ADD_DEPENDENCIES(test build_library) diff --git a/deal.II/tests/quick_tests/run.cmake b/deal.II/tests/quick_tests/run.cmake new file mode 100644 index 0000000000..11eaf7d29a --- /dev/null +++ b/deal.II/tests/quick_tests/run.cmake @@ -0,0 +1,44 @@ +## --------------------------------------------------------------------- +## $Id: CMakeLists.txt 31666 2013-11-14 22:20:28Z maier $ +## +## 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. +## +## --------------------------------------------------------------------- + +# 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. + +SEPARATE_ARGUMENTS(ALL_TESTS) + +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") + + 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.") + 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") + 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.") + ENDIF() + + ENDFOREACH() + +ENDIF() + -- 2.39.5