summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2022-09-23 14:07:18 (GMT)
committerBrad King <brad.king@kitware.com>2022-09-26 13:40:58 (GMT)
commit65260d6c1e09fbe2dd15e1b01a04c729c9d5bd6f (patch)
treeb55a5a35d2e4caef83e85ca1d98f52d289d4a514 /Source
parente7fd69fa3660be2283ce53b2a9d050f6ba59efde (diff)
downloadCMake-65260d6c1e09fbe2dd15e1b01a04c729c9d5bd6f.zip
CMake-65260d6c1e09fbe2dd15e1b01a04c729c9d5bd6f.tar.gz
CMake-65260d6c1e09fbe2dd15e1b01a04c729c9d5bd6f.tar.bz2
ctest: only report make-level errors when no others are found
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
Diffstat (limited to 'Source')
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx35
1 files changed, 25 insertions, 10 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 2aba79d..66c30c0 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -893,16 +893,31 @@ int cmCTestBuildHandler::RunMakeCommand(const std::string& command,
// If there was an error running command, report that on the
// dashboard.
if (this->UseCTestLaunch) {
- cmCTestLaunchReporter reporter;
- reporter.RealArgs = args;
- reporter.ComputeFileNames();
- reporter.ExitCode = *retVal;
- reporter.Process = cp;
- // Use temporary BuildLog file to populate this error for CDash.
- ofs.flush();
- reporter.LogOut = this->LogFileNames["Build"];
- reporter.LogOut += ".tmp";
- reporter.WriteXML();
+ // For launchers, do not record this top-level error if other
+ // more granular build errors have already been captured.
+ bool launcherXMLFound = false;
+ cmsys::Directory launchDir;
+ launchDir.Load(this->CTestLaunchDir);
+ unsigned long n = launchDir.GetNumberOfFiles();
+ for (unsigned long i = 0; i < n; ++i) {
+ const char* fname = launchDir.GetFile(i);
+ if (cmHasLiteralSuffix(fname, ".xml")) {
+ launcherXMLFound = true;
+ break;
+ }
+ }
+ if (!launcherXMLFound) {
+ cmCTestLaunchReporter reporter;
+ reporter.RealArgs = args;
+ reporter.ComputeFileNames();
+ reporter.ExitCode = *retVal;
+ reporter.Process = cp;
+ // Use temporary BuildLog file to populate this error for CDash.
+ ofs.flush();
+ reporter.LogOut = this->LogFileNames["Build"];
+ reporter.LogOut += ".tmp";
+ reporter.WriteXML();
+ }
} else {
cmCTestBuildErrorWarning errorwarning;
errorwarning.LineNumber = 0;