mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 22:59:56 -05:00
65260d6c1e
In commit ab9ad2a6a0 (ctest: report make-level errors to CDash when
using launchers, 2020-09-24, v3.19.0-rc1~84^2~1) we taught CTest to
capture and report errors from the build command when using launchers.
This had the unintended side effect of reporting a separate build error containing
the full build output when the build command returns non-zero. To fix this problem,
we now only report build command errors from CTest launchers when no other
more specific build errors are found.
Fixes: #23991
24 lines
1.0 KiB
CMake
24 lines
1.0 KiB
CMake
file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml")
|
|
if(build_xml_file)
|
|
file(READ "${build_xml_file}" build_xml LIMIT 8192)
|
|
string(FIND "${build_xml}" [[This should not be compiled]] expected_failure_pos)
|
|
if(expected_failure_pos EQUAL "-1")
|
|
string(REPLACE "\n" "\n " build_xml " ${build_xml}")
|
|
set(RunCMake_TEST_FAILED
|
|
"Build.xml does not have expected error message:\n${build_xml}"
|
|
)
|
|
else()
|
|
string(SUBSTRING "${build_xml}" "${expected_failure_pos}" -1 remaining_xml)
|
|
string(FIND "${remaining_xml}" [[<Failure type="Error">]] unexpected_failure_pos)
|
|
if(NOT unexpected_failure_pos EQUAL "-1")
|
|
string(SUBSTRING "${remaining_xml}" "${unexpected_failure_pos}" -1 error_msg_xml)
|
|
string(REPLACE "\n" "\n " error_msg_xml " ${error_msg_xml}")
|
|
set(RunCMake_TEST_FAILED
|
|
"Build.xml contains unexpected extra <Failure> elements:\n${error_msg_xml}"
|
|
)
|
|
endif()
|
|
endif()
|
|
else()
|
|
set(RunCMake_TEST_FAILED "Build.xml not found")
|
|
endif()
|