cmCTestBuildHandler: Store path of temporary log file

This commit is contained in:
Daniel Pfeifer 2025-01-28 13:10:53 +01:00
parent 8dfb1f40b7
commit 8d4743b9e9
No known key found for this signature in database
GPG Key ID: 04F22A9DE0B13A16
6 changed files with 10 additions and 12 deletions

View File

@ -302,6 +302,8 @@ int cmCTestBuildHandler::ProcessHandler()
"Cannot create build log file" << std::endl);
}
this->LogFileName = ofs.GetTempName();
// Create lists of regular expression strings for errors, error exceptions,
// warnings and warning exceptions.
std::vector<std::string>::size_type cc;
@ -884,8 +886,7 @@ bool cmCTestBuildHandler::RunMakeCommand(std::string const& command,
// Use temporary BuildLog file to populate this error for
// CDash.
ofs.flush();
reporter.LogOut = this->LogFileNames["Build"];
reporter.LogOut += ".tmp";
reporter.LogOut = this->LogFileName;
reporter.WriteXML();
}
} else {

View File

@ -145,6 +145,7 @@ private:
bool UseCTestLaunch = false;
std::string CTestLaunchDir;
std::string LogFileName;
class LaunchHelper;
friend class LaunchHelper;

View File

@ -3,9 +3,9 @@
#include "cmCTestGenericHandler.h"
#include <sstream>
#include <string>
#include "cmCTest.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
cmCTestGenericHandler::cmCTestGenericHandler(cmCTest* ctest)
@ -72,8 +72,6 @@ bool cmCTestGenericHandler::StartLogFile(char const* name,
ostr << "_" << this->CTest->GetCurrentTag();
}
ostr << ".log";
this->LogFileNames[name] =
cmStrCat(this->CTest->GetBinaryDir(), "/Testing/Temporary/", ostr.str());
if (!this->CTest->OpenOutputFile("Temporary", ostr.str(), xofs)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot create log file: " << ostr.str() << std::endl);

View File

@ -4,9 +4,6 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <map>
#include <string>
#include "cmCTest.h"
#include "cmSystemTools.h"
@ -52,8 +49,6 @@ public:
cmCTestGenericHandler(cmCTest* ctest);
virtual ~cmCTestGenericHandler();
using t_StringToString = std::map<std::string, std::string>;
void SetSubmitIndex(int idx) { this->SubmitIndex = idx; }
int GetSubmitIndex() { return this->SubmitIndex; }
@ -75,7 +70,6 @@ protected:
unsigned long TestLoad = 0;
cmSystemTools::OutputOption HandlerVerbose = cmSystemTools::OUTPUT_NONE;
cmCTest* CTest;
t_StringToString LogFileNames;
cmake* CMake = nullptr;
int SubmitIndex = 0;

View File

@ -665,7 +665,6 @@ bool cmCTest::OpenOutputFile(std::string const& path, std::string const& name,
}
}
std::string filename = testingDir + "/" + name;
stream.SetTempExt("tmp");
stream.Open(filename);
if (!stream) {
cmCTestLog(this, ERROR_MESSAGE,

View File

@ -147,6 +147,11 @@ public:
*/
void SetTempExt(std::string const& ext);
/**
* Get the name of the temporary file.
*/
std::string const& GetTempName() const { return this->TempName; }
/**
* Write a specific string using an alternate encoding.
* Afterward, the original encoding is restored.