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.
This commit is contained in:
Pawel Dac
2021-01-13 19:22:54 +01:00
parent 438ed46c13
commit 54866346de

View File

@@ -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);
}
}
}