From 4d132dac69a5a6c97e6c203070a3cad8466da2f3 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Fri, 23 Aug 2013 00:55:44 +0000 Subject: [PATCH] Quick fix git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30443 0785d39b-7218-0410-832d-ea1e28bc413d --- .../cmake/macros/macro_deal_ii_add_test.cmake | 26 +++++------- deal.II/cmake/scripts/run_test.cmake | 41 ++++++------------- 2 files changed, 24 insertions(+), 43 deletions(-) diff --git a/deal.II/cmake/macros/macro_deal_ii_add_test.cmake b/deal.II/cmake/macros/macro_deal_ii_add_test.cmake index d25da5d0c9..2d2dd4c8f8 100644 --- a/deal.II/cmake/macros/macro_deal_ii_add_test.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_add_test.cmake @@ -37,8 +37,6 @@ # - specifying the maximal wall clock time in seconds a test is allowed # to run # -# TODO: LABEL and MEASUREMENT -# # Usage: # DEAL_II_ADD_TEST(category test_name [configurations]) # @@ -54,6 +52,10 @@ MACRO(DEAL_II_ADD_TEST _category _test_name) SET(_test ${_test_name}.${_build_lowercase}) SET(_full_test ${_category}-${_test_name}.${_build_lowercase}) + # + # Add an executable for the current test and set up compile + # definitions and the full link interface: + # ADD_EXECUTABLE(${_full_test} EXCLUDE_FROM_ALL ${_test_name}.cc) SET_TARGET_PROPERTIES(${_full_test} PROPERTIES @@ -78,19 +80,17 @@ MACRO(DEAL_II_ADD_TEST _category _test_name) ) + # + # Add a top level target to run the test and compare the output: + # ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_test}/output COMMAND ${_full_test} - # TODO: Refactor: COMMAND ${PERL_EXECUTABLE} -pi ${CMAKE_SOURCE_DIR}/cmake/scripts/normalize.pl ${CMAKE_CURRENT_BINARY_DIR}/${_test}/output WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_test} DEPENDS ${_full_test} ${CMAKE_SOURCE_DIR}/cmake/scripts/normalize.pl ) - ADD_CUSTOM_TARGET(${_full_test}.run - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_test}/output - ) - SET(_comparison ${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}) IF(EXISTS ${_comparison}.${_build_lowercase}.output) @@ -99,7 +99,7 @@ MACRO(DEAL_II_ADD_TEST _category _test_name) SET(_comparison ${_comparison}.output) ENDIF() - ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_test}/diff + ADD_CUSTOM_TARGET(${_full_test}.diff COMMAND ${DEAL_II_TEST_DIFF} ${CMAKE_CURRENT_BINARY_DIR}/${_test}/output ${_comparison} @@ -108,18 +108,14 @@ MACRO(DEAL_II_ADD_TEST _category _test_name) ${CMAKE_CURRENT_BINARY_DIR}/${_test}/output ${_comparison} ) - ADD_CUSTOM_TARGET(${_full_test}.diff - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_test}/diff - ) - IF(CMAKE_GENERATOR MATCHES "Makefiles") - SET(_test_suffix "/fast") - ENDIF() + # + # And finally add the test: + # ADD_TEST(NAME ${_category}/${_test} COMMAND ${CMAKE_COMMAND} -DTEST=${_full_test} - -DTEST_SUFFIX=${_test_suffix} -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_test} diff --git a/deal.II/cmake/scripts/run_test.cmake b/deal.II/cmake/scripts/run_test.cmake index 7df9678e02..9d52b2e0ba 100644 --- a/deal.II/cmake/scripts/run_test.cmake +++ b/deal.II/cmake/scripts/run_test.cmake @@ -2,38 +2,23 @@ # TODO: The following variables have to be set: # # TEST -# TEST_SUFFIX # DEAL_II_BINARY_DIR # -MACRO(CALLBACK _target _target_suffix _msg_success _msg_error) - EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} - --build ${DEAL_II_BINARY_DIR} --target ${_target}${_target_suffix} - RESULT_VARIABLE _result_code - OUTPUT_VARIABLE _output - ) - - IF("${_result_code}" STREQUAL "0") - MESSAGE("${_target}: ${_msg_success}.") - - ELSE() - - MESSAGE("*** ${_msg_error}: ***") - MESSAGE(${_output}) - MESSAGE(FATAL_ERROR "*** Test aborted.") - ENDIF() -ENDMACRO() - - -CALLBACK(${TEST} "${TEST_SUFFIX}" - "Build successful" "BUILD FAILED" +EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} + --build ${DEAL_II_BINARY_DIR} --target ${TEST}.diff + RESULT_VARIABLE _result_code + OUTPUT_VARIABLE _output ) -CALLBACK(${TEST} ".run${TEST_SUFFIX}" - "Run successful" "RUN FAILED" - ) +IF("${_result_code}" STREQUAL "0") + MESSAGE("${TEST}: Diff successful") -CALLBACK(${TEST} ".diff${TEST_SUFFIX}" - "Diff successful" "DIFF FAILED" - ) +ELSE() + MESSAGE("*** ***") + MESSAGE("${TEST}: Diff failed:") + MESSAGE(${_output}) + MESSAGE("*** ***") + MESSAGE(FATAL_ERROR "*** Test aborted.") +ENDIF() -- 2.39.5