From 1dec35942215817ff2e7535239a89bc239abed16 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 21 Feb 2020 16:53:48 -0500 Subject: Refactor: Require detail when calling cmCTestRunTest::StartFailure() --- Source/CTest/cmCTestMultiProcessHandler.cxx | 7 ++++--- Source/CTest/cmCTestRunTest.cxx | 10 ++++++---- Source/CTest/cmCTestRunTest.h | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 37679b9..bee7165 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -197,7 +197,7 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test) this->LockResources(test); if (!this->TestsHaveSufficientResources[test]) { - testRun->StartFailure("Insufficient resources"); + testRun->StartFailure("Insufficient resources", "Failed to start"); this->FinishTestProcess(testRun, false); return false; } @@ -205,8 +205,9 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test) cmWorkingDirectory workdir(this->Properties[test]->Directory); if (workdir.Failed()) { testRun->StartFailure("Failed to change working directory to " + - this->Properties[test]->Directory + " : " + - std::strerror(workdir.GetLastResult())); + this->Properties[test]->Directory + " : " + + std::strerror(workdir.GetLastResult()), + "Failed to start"); } else { if (testRun->StartTest(this->Completed, this->Total)) { // Ownership of 'testRun' has moved to another structure. diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index cc5de43..f0a3af1 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -324,8 +324,9 @@ bool cmCTestRunTest::StartAgain(size_t completed) cmWorkingDirectory workdir(this->TestProperties->Directory); if (workdir.Failed()) { this->StartFailure("Failed to change working directory to " + - this->TestProperties->Directory + " : " + - std::strerror(workdir.GetLastResult())); + this->TestProperties->Directory + " : " + + std::strerror(workdir.GetLastResult()), + "Failed to start"); return true; } @@ -381,7 +382,8 @@ void cmCTestRunTest::MemCheckPostProcess() handler->PostProcessTest(this->TestResult, this->Index); } -void cmCTestRunTest::StartFailure(std::string const& output) +void cmCTestRunTest::StartFailure(std::string const& output, + std::string const& detail) { // Still need to log the Start message so the test summary records our // attempt to start this test @@ -404,7 +406,7 @@ void cmCTestRunTest::StartFailure(std::string const& output) this->TestResult.ExecutionTime = cmDuration::zero(); this->TestResult.CompressOutput = false; this->TestResult.ReturnValue = -1; - this->TestResult.CompletionStatus = "Failed to start"; + this->TestResult.CompletionStatus = detail; this->TestResult.Status = cmCTestTestHandler::NOT_RUN; this->TestResult.TestCount = this->TestProperties->Index; this->TestResult.Name = this->TestProperties->Name; diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 7eeaebd..4988839 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -76,7 +76,7 @@ public: bool StartAgain(size_t completed); - void StartFailure(std::string const& output); + void StartFailure(std::string const& output, std::string const& detail); cmCTest* GetCTest() const { return this->CTest; } -- cgit v0.12