mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-23 08:18:37 -05:00
Tests/RunCMake: Add option to print custom details in failure output
This commit is contained in:
@@ -71,6 +71,8 @@ but do not actually build anything. To add a test:
|
||||
Top of test binary tree
|
||||
|
||||
and an failure must store a message in ``RunCMake_TEST_FAILED``.
|
||||
The check script may optionally set ``RunCMake_TEST_FAILURE_MESSAGE``
|
||||
with additional text to be included in the message if the test fails.
|
||||
|
||||
To speed up local testing, you can choose to run only a subset of
|
||||
``run_cmake()`` tests in a ``RunCMakeTest.cmake`` script by using the
|
||||
|
||||
@@ -248,6 +248,7 @@ function(run_cmake test)
|
||||
endif()
|
||||
endforeach()
|
||||
unset(RunCMake_TEST_FAILED)
|
||||
unset(RunCMake_TEST_FAILURE_MESSAGE)
|
||||
if(RunCMake-check-file AND EXISTS ${top_src}/${RunCMake-check-file})
|
||||
include(${top_src}/${RunCMake-check-file})
|
||||
else()
|
||||
@@ -278,6 +279,9 @@ function(run_cmake test)
|
||||
string(APPEND msg "Actual ${o}:\n${actual_${o}}\n")
|
||||
endif()
|
||||
endforeach()
|
||||
if(RunCMake_TEST_FAILURE_MESSAGE)
|
||||
string(APPEND msg "${RunCMake_TEST_FAILURE_MESSAGE}")
|
||||
endif()
|
||||
message(SEND_ERROR "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - FAILED:\n${msg}")
|
||||
else()
|
||||
message(STATUS "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - PASSED")
|
||||
|
||||
Reference in New Issue
Block a user