Hanle the case where a test can not be run because it is a bad executable.
This commit is contained in:
parent
4d72006bd6
commit
22c37b2b19
@ -177,12 +177,6 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
|
|||||||
this->TestResult.Status = cmCTestTestHandler::OTHER_FAULT;
|
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;
|
passed = this->TestResult.Status == cmCTestTestHandler::COMPLETED;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
sprintf(buf, "%6.2f sec", this->TestProcess->GetTotalTime());
|
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;
|
<< std::endl << std::endl;
|
||||||
}
|
}
|
||||||
|
// if the test actually stared and ran
|
||||||
|
// record the results in TestResult
|
||||||
if(started)
|
if(started)
|
||||||
{
|
{
|
||||||
this->TestResult.Output = this->ProcessOutput;
|
this->TestResult.Output = this->ProcessOutput;
|
||||||
this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
|
this->TestResult.ReturnValue = this->TestProcess->GetExitValue();
|
||||||
this->TestResult.CompletionStatus = "Completed";
|
this->TestResult.CompletionStatus = "Completed";
|
||||||
this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
|
this->TestResult.ExecutionTime = this->TestProcess->GetTotalTime();
|
||||||
this->TestHandler->TestResults.push_back(this->TestResult);
|
|
||||||
|
|
||||||
this->MemCheckPostProcess();
|
this->MemCheckPostProcess();
|
||||||
}
|
}
|
||||||
|
// Always push the current TestResult onto the
|
||||||
|
// TestHandler vector
|
||||||
|
this->TestHandler->TestResults.push_back(this->TestResult);
|
||||||
delete this->TestProcess;
|
delete this->TestProcess;
|
||||||
return passed;
|
return passed;
|
||||||
}
|
}
|
||||||
@ -309,8 +306,8 @@ bool cmCTestRunTest::StartTest(size_t total)
|
|||||||
this->TestResult.Properties = this->TestProperties;
|
this->TestResult.Properties = this->TestProperties;
|
||||||
this->TestResult.ExecutionTime = 0;
|
this->TestResult.ExecutionTime = 0;
|
||||||
this->TestResult.ReturnValue = -1;
|
this->TestResult.ReturnValue = -1;
|
||||||
this->TestResult.CompletionStatus = "Not Run";
|
this->TestResult.CompletionStatus = "Failed to start";
|
||||||
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
|
this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND;
|
||||||
this->TestResult.TestCount = this->TestProperties->Index;
|
this->TestResult.TestCount = this->TestProperties->Index;
|
||||||
this->TestResult.Name = this->TestProperties->Name;
|
this->TestResult.Name = this->TestProperties->Name;
|
||||||
this->TestResult.Path = this->TestProperties->Directory.c_str();
|
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
|
// log and return if we did not find the executable
|
||||||
if (this->ActualCommand == "")
|
if (this->ActualCommand == "")
|
||||||
{
|
{
|
||||||
|
// if the command was not found create a TestResult object
|
||||||
|
// that has that information
|
||||||
this->TestProcess = new cmProcess;
|
this->TestProcess = new cmProcess;
|
||||||
*this->TestHandler->LogFile << "Unable to find executable: "
|
*this->TestHandler->LogFile << "Unable to find executable: "
|
||||||
<< args[1].c_str() << std::endl;
|
<< args[1].c_str() << std::endl;
|
||||||
@ -325,7 +324,8 @@ bool cmCTestRunTest::StartTest(size_t total)
|
|||||||
<< args[1].c_str() << std::endl);
|
<< args[1].c_str() << std::endl);
|
||||||
this->TestResult.Output = "Unable to find executable: " + args[1];
|
this->TestResult.Output = "Unable to find executable: " + args[1];
|
||||||
this->TestResult.FullCommandLine = "";
|
this->TestResult.FullCommandLine = "";
|
||||||
this->TestHandler->TestResults.push_back(this->TestResult);
|
this->TestResult.CompletionStatus = "Not Run";
|
||||||
|
this->TestResult.Status = cmCTestTestHandler::NOT_RUN;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this->StartTime = this->CTest->CurrentTime();
|
this->StartTime = this->CTest->CurrentTime();
|
||||||
|
@ -689,13 +689,12 @@ void cmCTestTestHandler::PrintLabelSummary()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it = this->TestList.begin();
|
|
||||||
ri = this->TestResults.begin();
|
ri = this->TestResults.begin();
|
||||||
// fill maps
|
// 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)
|
if(p.Labels.size() != 0)
|
||||||
{
|
{
|
||||||
for(std::vector<std::string>::iterator l = p.Labels.begin();
|
for(std::vector<std::string>::iterator l = p.Labels.begin();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user