From 22c37b2b199e99aa15b6a17e71dc8999a49ba624 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 2 Dec 2009 16:37:43 -0500 Subject: [PATCH] Hanle the case where a test can not be run because it is a bad executable. --- Source/CTest/cmCTestRunTest.cxx | 22 +++++++++++----------- Source/CTest/cmCTestTestHandler.cxx | 7 +++---- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 511b995b1..a984c6c6c 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -177,12 +177,6 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) this->TestResult.Status = cmCTestTestHandler::OTHER_FAULT; } } - else // if ( res == cmsysProcess_State_Error ) - { - cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Bad command " << res ); - this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND; - } - passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED; char buf[1024]; sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime()); @@ -258,16 +252,19 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) << "----------------------------------------------------------" << std::endl << std::endl; } + // if the test actually stared and ran + // record the results in TestResult if(started) { this->TestResult.Output = this->ProcessOutput; this->TestResult.ReturnValue = this->TestProcess->GetExitValue(); this->TestResult.CompletionStatus = "Completed"; this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime(); - this->TestHandler->TestResults.push_back(this->TestResult); - this->MemCheckPostProcess(); } + // Always push the current TestResult onto the + // TestHandler vector + this->TestHandler->TestResults.push_back(this->TestResult); delete this->TestProcess; return passed; } @@ -309,8 +306,8 @@ bool cmCTestRunTest::StartTest(size_t total) this->TestResult.Properties = this->TestProperties; this->TestResult.ExecutionTime = 0; this->TestResult.ReturnValue = -1; - this->TestResult.CompletionStatus = "Not Run"; - this->TestResult.Status = cmCTestTestHandler::NOT_RUN; + this->TestResult.CompletionStatus = "Failed to start"; + this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND; this->TestResult.TestCount = this->TestProperties->Index; this->TestResult.Name = this->TestProperties->Name; this->TestResult.Path = this->TestProperties->Directory.c_str(); @@ -318,6 +315,8 @@ bool cmCTestRunTest::StartTest(size_t total) // log and return if we did not find the executable if (this->ActualCommand == "") { + // if the command was not found create a TestResult object + // that has that information this->TestProcess = new cmProcess; *this->TestHandler->LogFile << "Unable to find executable: " << args[1].c_str() << std::endl; @@ -325,7 +324,8 @@ bool cmCTestRunTest::StartTest(size_t total) << args[1].c_str() << std::endl); this->TestResult.Output = "Unable to find executable: " + args[1]; this->TestResult.FullCommandLine = ""; - this->TestHandler->TestResults.push_back(this->TestResult); + this->TestResult.CompletionStatus = "Not Run"; + this->TestResult.Status = cmCTestTestHandler::NOT_RUN; return false; } this->StartTime = this->CTest->CurrentTime(); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 4437c5674..cbac2726c 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -689,13 +689,12 @@ void cmCTestTestHandler::PrintLabelSummary() } } } - it = this->TestList.begin(); ri = this->TestResults.begin(); // fill maps - for(; it != this->TestList.end(); ++it, ++ri) + for(; ri != this->TestResults.end(); ++ri) { - cmCTestTestProperties& p = *it; - cmCTestTestResult &result = *ri; + cmCTestTestResult &result = *ri; + cmCTestTestProperties& p = *result.Properties; if(p.Labels.size() != 0) { for(std::vector::iterator l = p.Labels.begin();