ENH: add a CDash measured value showing the reason for passed and failed tests based on regular expressions
This commit is contained in:
parent
1353ed0bd8
commit
3b73cdc89f
@ -240,6 +240,10 @@ bool cmCTestMultiProcessHandler::CheckOutput()
|
|||||||
|
|
||||||
void cmCTestMultiProcessHandler::EndTest(cmProcess* p)
|
void cmCTestMultiProcessHandler::EndTest(cmProcess* p)
|
||||||
{
|
{
|
||||||
|
// Should have a way of getting this stuff from the
|
||||||
|
// launched ctest, maybe a temp file or some extra xml
|
||||||
|
// stuff in the stdout
|
||||||
|
// Need things like Reason and ExecutionTime, Path, etc.
|
||||||
int test = p->GetId();
|
int test = p->GetId();
|
||||||
int exitVal = p->GetExitValue();
|
int exitVal = p->GetExitValue();
|
||||||
cmCTestTestHandler::cmCTestTestResult cres;
|
cmCTestTestHandler::cmCTestTestResult cres;
|
||||||
|
@ -799,22 +799,23 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
|
|||||||
if ( passIt->first.find(output.c_str()) )
|
if ( passIt->first.find(output.c_str()) )
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
reason = "Required regular expression found.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !found )
|
if ( !found )
|
||||||
{
|
{
|
||||||
reason = "Required regular expression not found.";
|
reason = "Required regular expression not found.";
|
||||||
reason += "Regex=[";
|
|
||||||
for ( passIt = it->RequiredRegularExpressions.begin();
|
|
||||||
passIt != it->RequiredRegularExpressions.end();
|
|
||||||
++ passIt )
|
|
||||||
{
|
|
||||||
reason += passIt->second;
|
|
||||||
reason += "\n";
|
|
||||||
}
|
|
||||||
reason += "]";
|
|
||||||
forceFail = true;
|
forceFail = true;
|
||||||
}
|
}
|
||||||
|
reason += "Regex=[";
|
||||||
|
for ( passIt = it->RequiredRegularExpressions.begin();
|
||||||
|
passIt != it->RequiredRegularExpressions.end();
|
||||||
|
++ passIt )
|
||||||
|
{
|
||||||
|
reason += passIt->second;
|
||||||
|
reason += "\n";
|
||||||
|
}
|
||||||
|
reason += "]";
|
||||||
}
|
}
|
||||||
if ( it->ErrorRegularExpressions.size() > 0 )
|
if ( it->ErrorRegularExpressions.size() > 0 )
|
||||||
{
|
{
|
||||||
@ -947,7 +948,7 @@ void cmCTestTestHandler::ProcessOneTest(cmCTestTestProperties *it,
|
|||||||
(this->CustomMaximumFailedTestOutputSize));
|
(this->CustomMaximumFailedTestOutputSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cres.Reason = reason;
|
||||||
cres.Output = output;
|
cres.Output = output;
|
||||||
cres.ReturnValue = retVal;
|
cres.ReturnValue = retVal;
|
||||||
cres.CompletionStatus = "Completed";
|
cres.CompletionStatus = "Completed";
|
||||||
@ -1585,6 +1586,19 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
|
|||||||
<< "name=\"Execution Time\"><Value>"
|
<< "name=\"Execution Time\"><Value>"
|
||||||
<< result->ExecutionTime
|
<< result->ExecutionTime
|
||||||
<< "</Value></NamedMeasurement>\n";
|
<< "</Value></NamedMeasurement>\n";
|
||||||
|
if(result->Reason.size())
|
||||||
|
{
|
||||||
|
const char* reasonType = "Pass Reason";
|
||||||
|
if(result->Status != cmCTestTestHandler::COMPLETED &&
|
||||||
|
result->Status != cmCTestTestHandler::NOT_RUN)
|
||||||
|
{
|
||||||
|
reasonType = "Fail Reason";
|
||||||
|
}
|
||||||
|
os << "\t\t\t<NamedMeasurement type=\"text/string\" "
|
||||||
|
<< "name=\"" << reasonType << "\"><Value>"
|
||||||
|
<< cmXMLSafe(result->Reason)
|
||||||
|
<< "</Value></NamedMeasurement>\n";
|
||||||
|
}
|
||||||
os
|
os
|
||||||
<< "\t\t\t<NamedMeasurement type=\"text/string\" "
|
<< "\t\t\t<NamedMeasurement type=\"text/string\" "
|
||||||
<< "name=\"Completion Status\"><Value>"
|
<< "name=\"Completion Status\"><Value>"
|
||||||
|
@ -102,6 +102,7 @@ public:
|
|||||||
{
|
{
|
||||||
std::string Name;
|
std::string Name;
|
||||||
std::string Path;
|
std::string Path;
|
||||||
|
std::string Reason;
|
||||||
std::string FullCommandLine;
|
std::string FullCommandLine;
|
||||||
double ExecutionTime;
|
double ExecutionTime;
|
||||||
int ReturnValue;
|
int ReturnValue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user