ctest: Add source and binary directories to Build.xml

Introduce two new fields, SourceDirectory and BinaryDirectory,
to the Build.XML file with the appropriate data stored in it.

Fixes: #27628
This commit is contained in:
Joseph Snyder committed 2026-02-24 15:36:45 -05:00
1 parent 8705b0fa47
commit 446175e631
5 files changed
+28

No files matched your search

+3
View File
@@ -465,6 +465,9 @@ void cmCTestBuildHandler::GenerateXMLHeader(cmXMLWriter& xml)
xml.StartElement("Build");
xml.Element("StartDateTime", this->StartBuild);
xml.Element("StartBuildTime", this->StartBuildTime);
xml.Element("SourceDirectory",
this->CTest->GetCTestConfiguration("SourceDirectory"));
xml.Element("BinaryDirectory", this->CTest->GetBinaryDir());
xml.Element("BuildCommand", this->GetMakeCommand());
}
@@ -0,0 +1,18 @@
file(GLOB build_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Build.xml")
if(build_xml_file)
file(READ "${build_xml_file}" build_xml LIMIT 4096)
if(NOT build_xml MATCHES [[<SourceDirectory>]])
string(REPLACE "\n" "\n " build_xml " ${build_xml}")
set(RunCMake_TEST_FAILED
"Build.xml does not have expected attribute:\n${build_xml}"
)
endif()
if(NOT build_xml MATCHES [[<BinaryDirectory>]])
string(REPLACE "\n" "\n " build_xml " ${build_xml}")
set(RunCMake_TEST_FAILED
"Build.xml does not have expected attribute:\n${build_xml}"
)
endif()
else()
set(RunCMake_TEST_FAILED "Build.xml not found")
endif()
@@ -0,0 +1 @@
(-1|255)
@@ -0,0 +1 @@
^Error\(s\) when building project
@@ -61,6 +61,11 @@ set(RunCMake_BUILD_COMMAND "${FAKE_BUILD_COMMAND_EXE}")
run_ctest(BuildCommandFailure)
unset(RunCMake_BUILD_COMMAND)
set(RunCMake_USE_CUSTOM_BUILD_COMMAND TRUE)
set(RunCMake_BUILD_COMMAND "${FAKE_BUILD_COMMAND_EXE}")
run_ctest(BuildDirectories)
unset(RunCMake_BUILD_COMMAND)
set(RunCMake_USE_LAUNCHERS FALSE)
set(RunCMake_BUILD_COMMAND "${COLOR_WARNING}")
run_ctest(IgnoreColor)