diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-12-02 21:37:43 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-12-02 21:37:43 (GMT) |
commit | 22c37b2b199e99aa15b6a17e71dc8999a49ba624 (patch) | |
tree | 59fe19562904a0f9d69a85dc88cac87bb1450b05 /Source | |
parent | 4d72006bd6ba8c471236a9732ae4fd9cc9e90cfa (diff) | |
download | CMake-22c37b2b199e99aa15b6a17e71dc8999a49ba624.zip CMake-22c37b2b199e99aa15b6a17e71dc8999a49ba624.tar.gz CMake-22c37b2b199e99aa15b6a17e71dc8999a49ba624.tar.bz2 |
Hanle the case where a test can not be run because it is a bad executable.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 22 | ||||
-rw-r--r-- | 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 511b995..a984c6c 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 4437c56..cbac272 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<std::string>::iterator l = p.Labels.begin(); |