# Add a top level target to run and compare the test:
#
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_test}/output
- COMMAND
- # A this stage a build is always successful: :-)
- ${CMAKE_COMMAND} -E echo "${_full_test}: BUILD successful"
COMMAND
${_run_command}
|| (mv ${CMAKE_CURRENT_BINARY_DIR}/${_test}/output
${CMAKE_CURRENT_BINARY_DIR}/${_test}/failing_output
- && echo "${_full_test}: RUN failed. Output:"
+ && echo "${_category}/${_test}: BUILD successful."
+ && echo "${_category}/${_test}: RUN failed. Output:"
&& cat ${CMAKE_CURRENT_BINARY_DIR}/${_test}/failing_output
&& exit 1)
COMMAND
${PERL_EXECUTABLE} -pi
${CMAKE_SOURCE_DIR}/cmake/scripts/normalize.pl
${CMAKE_CURRENT_BINARY_DIR}/${_test}/output
- COMMAND
- ${CMAKE_COMMAND} -E echo "${_full_test}: RUN successful"
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/${_test}
DEPENDS
> ${CMAKE_CURRENT_BINARY_DIR}/${_test}/diff
|| (mv ${CMAKE_CURRENT_BINARY_DIR}/${_test}/diff
${CMAKE_CURRENT_BINARY_DIR}/${_test}/failing_diff
- && echo "${_full_test}: DIFF failed. Output:"
+ && echo "${_category}/${_test}: BUILD successful."
+ && echo "${_category}/${_test}: RUN successful."
+ && echo "${_category}/${_test}: DIFF failed. Output:"
&& cat ${CMAKE_CURRENT_BINARY_DIR}/${_test}/failing_diff
&& exit 1)
COMMAND
- ${CMAKE_COMMAND} -E echo "${_full_test}: DIFF successful"
+ echo "${_category}/${_test}: BUILD successful."
+ && echo "${_category}/${_test}: RUN successful."
+ && echo "${_category}/${_test}: DIFF successful."
+ && echo "${_category}/${_test}: PASSED."
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/${_test}
DEPENDS
#
ADD_TEST(NAME ${_category}/${_test}
COMMAND ${CMAKE_COMMAND}
- -DTEST=${_full_test}.diff
+ -DTRGT=${_full_test}.diff
+ -DTEST=${_category}/${_test}
-DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_test}
#
# TODO: The following variables have to be set:
#
+# TARGET
# TEST
# DEAL_II_BINARY_DIR
#
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND}
- --build ${DEAL_II_BINARY_DIR} --target ${TEST}
+ --build ${DEAL_II_BINARY_DIR} --target ${TRGT}
RESULT_VARIABLE _result_code
OUTPUT_VARIABLE _output
)
-# Remove the trailing ".diff" from the target name:
-STRING(REGEX REPLACE ".diff$" "" TEST "${TEST}")
-
IF("${_result_code}" STREQUAL "0")
- MESSAGE("${TEST}: Test successful:")
+ MESSAGE("Test ${TEST}: PASSED")
MESSAGE("=============================== OUTPUT BEGIN ===============================")
# Do not output everything, just that we are successful:
- MESSAGE("${TEST}: BUILD successful")
- MESSAGE("${TEST}: RUN successful")
- MESSAGE("${TEST}: DIFF successful")
+ IF(TRGT MATCHES "\\.diff$")
+ MESSAGE("${TEST}: BUILD successful.")
+ MESSAGE("${TEST}: RUN successful.")
+ MESSAGE("${TEST}: DIFF successful.")
+ MESSAGE("${TEST}: PASSED.")
+ ELSE()
+ MESSAGE("${TEST}: BUILD successful.")
+ MESSAGE("${TEST}: PASSED.")
+ ENDIF()
MESSAGE("=============================== OUTPUT END ===============================")
ELSE()
+ #
+ # Determine whether the BUILD or RUN stages were run successfully:
+ #
+ STRING(REGEX MATCH "${TEST}: BUILD successful\\." _build_regex ${_output})
+ STRING(REGEX MATCH "${TEST}: RUN successful\\." _run_regex ${_output})
+ IF("${_build_regex}" STREQUAL "")
+ SET(_stage BUILD)
+ ELSEIF("${_run_regex}" STREQUAL "")
+ SET(_stage RUN)
+ ELSE()
+ SET(_stage DIFF)
+ ENDIF()
- MESSAGE("${TEST}: Test failed:")
+ MESSAGE("Test ${TEST}: ${_stage}")
MESSAGE("=============================== OUTPUT BEGIN ===============================")
+ IF("${_build_regex}" STREQUAL "")
+ # Some special output in case the BUILD stage failed:
+ MESSAGE("${TEST}: BUILD failed. Output:")
+ ENDIF()
MESSAGE(${_output})
+ MESSAGE("")
+ MESSAGE("${TEST}: ****** ${_stage} failed *******")
+ MESSAGE("")
MESSAGE("=============================== OUTPUT END ===============================")
MESSAGE(FATAL_ERROR "*** abort")
#
ADD_TEST(NAME ${_category}/${_path}/${_file}.${_build_lowercase}
COMMAND ${CMAKE_COMMAND}
- -DTEST=${_test}
+ -DTRGT=${_test}
+ -DTEST=${_category}/${_path}/${_file}.${_build_lowercase}
-DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR}
-P ${CMAKE_SOURCE_DIR}/cmake/scripts/run_test.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}