diff options
Diffstat (limited to 'Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake')
-rw-r--r-- | Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake new file mode 100644 index 0000000..7089d70 --- /dev/null +++ b/Tests/RunCMake/ctest_build/NinjaLauncherSingleBuildFailure-check.cmake @@ -0,0 +1,23 @@ +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() |