From 1eee9de896cefffe77af65319c0019b3673723a0 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sun, 8 Dec 2013 01:50:50 +0000 Subject: [PATCH] Quicktests: Fix and cleanup the hack in quicktests :-] git-svn-id: https://svn.dealii.org/trunk@31930 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/tests/quick_tests/CMakeLists.txt | 45 +++++++++--------------- deal.II/tests/quick_tests/run.cmake | 30 +++++++++++++--- deal.II/tests/quick_tests/tbb.cc | 4 +-- 3 files changed, 44 insertions(+), 35 deletions(-) diff --git a/deal.II/tests/quick_tests/CMakeLists.txt b/deal.II/tests/quick_tests/CMakeLists.txt index f8dec2f061..37ff9f5df2 100644 --- a/deal.II/tests/quick_tests/CMakeLists.txt +++ b/deal.II/tests/quick_tests/CMakeLists.txt @@ -23,43 +23,32 @@ ENABLE_TESTING() 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} @@ -71,7 +60,7 @@ MACRO(make_quicktest test_basename build_name mpi_run) 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} "") @@ -108,7 +97,7 @@ ENDIF() # 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) diff --git a/deal.II/tests/quick_tests/run.cmake b/deal.II/tests/quick_tests/run.cmake index a574cad7e3..4cf38f1f2a 100644 --- a/deal.II/tests/quick_tests/run.cmake +++ b/deal.II/tests/quick_tests/run.cmake @@ -23,22 +23,42 @@ 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") + 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() - diff --git a/deal.II/tests/quick_tests/tbb.cc b/deal.II/tests/quick_tests/tbb.cc index 654da479bf..0e8110caf9 100644 --- a/deal.II/tests/quick_tests/tbb.cc +++ b/deal.II/tests/quick_tests/tbb.cc @@ -76,7 +76,7 @@ void test2() std_cxx1x::_1), scratch_data(), copy_data()); std::cout << "result: " << result << std::endl; - + if (result != (3*3+5*5+1*1)) exit(2); } @@ -84,7 +84,7 @@ void test2() int main () { std::cout << "TBB will use " << tbb::task_scheduler_init::default_num_threads() << " threads." << std::endl; - + test1(); test2(); } -- 2.39.5