From 54866346de24d46896bc22d717200035db9115bc Mon Sep 17 00:00:00 2001 From: Pawel Dac Date: Wed, 13 Jan 2021 19:22:54 +0100 Subject: CTest: Save sanitizer output files after test execution Prior to this change after tests were executed output files produced by sanitizers were removed. User couldn't check in detail why test case didn't pass. Output files are kept without pid in the end. --- Source/CTest/cmCTestMemCheckHandler.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 8a30dc0..6e8091b 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -1364,9 +1364,15 @@ void cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res, } } if (this->LogWithPID) { - cmSystemTools::RemoveFile(ofile); - cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, - "Remove: " << ofile << "\n", this->Quiet); + auto pos = ofile.find_last_of('.'); + if (pos != std::string::npos) { + auto ofileWithoutPid = ofile.substr(0, pos); + cmSystemTools::RenameFile(ofile, ofileWithoutPid); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Renaming: " << ofile << " to: " << ofileWithoutPid + << "\n", + this->Quiet); + } } } -- cgit v0.12