BUG: Fix Bug #153 - CTest does not detect tests that are not found and Bug #153 - CTest does not detect tests that are not found
This commit is contained in:
parent
3935711e01
commit
7f5b38b190
|
@ -564,7 +564,7 @@ int cmCTest::UpdateDirectory()
|
||||||
{
|
{
|
||||||
res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput,
|
res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput,
|
||||||
&retVal, sourceDirectory.c_str(),
|
&retVal, sourceDirectory.c_str(),
|
||||||
m_Verbose, m_TimeOut);
|
m_Verbose, 0 /*m_TimeOut*/);
|
||||||
if ( this->OpenOutputFile("Temporary", "LastUpdate.log", ofs) )
|
if ( this->OpenOutputFile("Temporary", "LastUpdate.log", ofs) )
|
||||||
{
|
{
|
||||||
ofs << goutput << std::endl;;
|
ofs << goutput << std::endl;;
|
||||||
|
@ -619,7 +619,7 @@ int cmCTest::UpdateDirectory()
|
||||||
std::string output;
|
std::string output;
|
||||||
res = cmSystemTools::RunSingleCommand(logcommand.c_str(), &output,
|
res = cmSystemTools::RunSingleCommand(logcommand.c_str(), &output,
|
||||||
&retVal, sourceDirectory.c_str(),
|
&retVal, sourceDirectory.c_str(),
|
||||||
m_Verbose, m_TimeOut);
|
m_Verbose, 0 /*m_TimeOut*/);
|
||||||
if ( ofs )
|
if ( ofs )
|
||||||
{
|
{
|
||||||
ofs << output << std::endl;
|
ofs << output << std::endl;
|
||||||
|
@ -861,7 +861,7 @@ int cmCTest::ConfigureDirectory()
|
||||||
|
|
||||||
std::string output;
|
std::string output;
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
bool res = true;
|
int res = 0;
|
||||||
if ( !m_ShowOnly )
|
if ( !m_ShowOnly )
|
||||||
{
|
{
|
||||||
std::ofstream os;
|
std::ofstream os;
|
||||||
|
@ -875,7 +875,7 @@ int cmCTest::ConfigureDirectory()
|
||||||
this->OpenOutputFile("Temporary", "LastConfigure.log", ofs);
|
this->OpenOutputFile("Temporary", "LastConfigure.log", ofs);
|
||||||
res = this->RunMakeCommand(cCommand.c_str(), &output,
|
res = this->RunMakeCommand(cCommand.c_str(), &output,
|
||||||
&retVal, buildDirectory.c_str(),
|
&retVal, buildDirectory.c_str(),
|
||||||
m_Verbose, m_TimeOut, ofs);
|
m_Verbose, 0, ofs);
|
||||||
|
|
||||||
if ( ofs )
|
if ( ofs )
|
||||||
{
|
{
|
||||||
|
@ -891,7 +891,7 @@ int cmCTest::ConfigureDirectory()
|
||||||
<< m_DartConfiguration["Site"] << "\">\n"
|
<< m_DartConfiguration["Site"] << "\">\n"
|
||||||
<< "<Configure>\n"
|
<< "<Configure>\n"
|
||||||
<< "\t<StartDateTime>" << start_time << "</StartDateTime>" << std::endl;
|
<< "\t<StartDateTime>" << start_time << "</StartDateTime>" << std::endl;
|
||||||
if ( retVal )
|
if ( res == cmsysProcess_State_Exited && retVal )
|
||||||
{
|
{
|
||||||
os << retVal;
|
os << retVal;
|
||||||
}
|
}
|
||||||
|
@ -941,19 +941,19 @@ int cmCTest::BuildDirectory()
|
||||||
m_StartBuild = ::CurrentTime();
|
m_StartBuild = ::CurrentTime();
|
||||||
std::string output;
|
std::string output;
|
||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
bool res = true;
|
int res = cmsysProcess_State_Exited;
|
||||||
if ( !m_ShowOnly )
|
if ( !m_ShowOnly )
|
||||||
{
|
{
|
||||||
res = this->RunMakeCommand(makeCommand.c_str(), &output,
|
res = this->RunMakeCommand(makeCommand.c_str(), &output,
|
||||||
&retVal, buildDirectory.c_str(),
|
&retVal, buildDirectory.c_str(),
|
||||||
m_Verbose, m_TimeOut, ofs);
|
m_Verbose, 0, ofs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Build with command: " << makeCommand << std::endl;
|
std::cout << "Build with command: " << makeCommand << std::endl;
|
||||||
}
|
}
|
||||||
m_EndBuild = ::CurrentTime();
|
m_EndBuild = ::CurrentTime();
|
||||||
if (! res || retVal )
|
if (res != cmsysProcess_State_Exited || retVal )
|
||||||
{
|
{
|
||||||
std::cerr << "Error(s) when building project" << std::endl;
|
std::cerr << "Error(s) when building project" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -1230,7 +1230,7 @@ int cmCTest::CoverageDirectory()
|
||||||
{
|
{
|
||||||
res = cmSystemTools::RunSingleCommand(command.c_str(), &output,
|
res = cmSystemTools::RunSingleCommand(command.c_str(), &output,
|
||||||
&retVal, opath.c_str(),
|
&retVal, opath.c_str(),
|
||||||
m_Verbose, m_TimeOut);
|
m_Verbose, 0 /*m_TimeOut*/);
|
||||||
}
|
}
|
||||||
if ( res && retVal == 0 )
|
if ( res && retVal == 0 )
|
||||||
{
|
{
|
||||||
|
@ -1713,6 +1713,8 @@ void cmCTest::ProcessDirectory(std::vector<std::string> &passed,
|
||||||
{
|
{
|
||||||
std::cerr << "Unable to find executable: " <<
|
std::cerr << "Unable to find executable: " <<
|
||||||
args[1].Value.c_str() << "\n";
|
args[1].Value.c_str() << "\n";
|
||||||
|
cres.m_Status = cmCTest::NOT_RUN;
|
||||||
|
m_TestResults.push_back( cres );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2041,36 +2043,53 @@ void cmCTest::GenerateDartTestOutput(std::ostream& os)
|
||||||
for ( cc = 0; cc < m_TestResults.size(); cc ++ )
|
for ( cc = 0; cc < m_TestResults.size(); cc ++ )
|
||||||
{
|
{
|
||||||
cmCTestTestResult *result = &m_TestResults[cc];
|
cmCTestTestResult *result = &m_TestResults[cc];
|
||||||
os << "\t<Test Status=\"" << (result->m_Status==cmCTest::COMPLETED?"passed":"failed")
|
os << "\t<Test Status=\"";
|
||||||
<< "\">\n"
|
if ( result->m_Status == cmCTest::COMPLETED )
|
||||||
<< "\t\t<Name>" << this->MakeXMLSafe(result->m_Name) << "</Name>\n"
|
|
||||||
<< "\t\t<Path>" << this->MakeXMLSafe(result->m_Path) << "</Path>\n"
|
|
||||||
<< "\t\t<FullName>" << this->MakeXMLSafe(result->m_Path)
|
|
||||||
<< "/" << this->MakeXMLSafe(result->m_Name) << "</FullName>\n"
|
|
||||||
<< "\t\t<FullCommandLine>"
|
|
||||||
<< this->MakeXMLSafe(result->m_FullCommandLine)
|
|
||||||
<< "</FullCommandLine>\n"
|
|
||||||
<< "\t\t<Results>" << std::endl;
|
|
||||||
if ( result->m_Status != cmCTest::COMPLETED || result->m_ReturnValue )
|
|
||||||
{
|
{
|
||||||
os << "\t\t\t<NamedMeasurement type=\"text/string\" name=\"Exit Code\"><Value>"
|
os << "passed";
|
||||||
<< this->GetTestStatus(result->m_Status) << "</Value></NamedMeasurement>\n"
|
|
||||||
<< "\t\t\t<NamedMeasurement type=\"text/string\" name=\"Exit Value\"><Value>"
|
|
||||||
<< result->m_ReturnValue << "</Value></NamedMeasurement>" << std::endl;
|
|
||||||
}
|
}
|
||||||
os << result->m_RegressionImages;
|
else if ( result->m_Status == cmCTest::NOT_RUN )
|
||||||
os << "\t\t\t<NamedMeasurement type=\"numeric/double\" "
|
{
|
||||||
<< "name=\"Execution Time\"><Value>"
|
os << "notrun";
|
||||||
<< result->m_ExecutionTime << "</Value></NamedMeasurement>\n"
|
}
|
||||||
<< "\t\t\t<NamedMeasurement type=\"text/string\" "
|
else
|
||||||
<< "name=\"Completion Status\"><Value>"
|
{
|
||||||
<< result->m_CompletionStatus << "</Value></NamedMeasurement>\n"
|
os << "failed";
|
||||||
<< "\t\t\t<Measurement>\n"
|
}
|
||||||
<< "\t\t\t\t<Value>" << this->MakeXMLSafe(result->m_Output)
|
os << "\">\n"
|
||||||
<< "</Value>\n"
|
<< "\t\t<Name>" << this->MakeXMLSafe(result->m_Name) << "</Name>\n"
|
||||||
<< "\t\t\t</Measurement>\n"
|
<< "\t\t<Path>" << this->MakeXMLSafe(result->m_Path) << "</Path>\n"
|
||||||
<< "\t\t</Results>\n"
|
<< "\t\t<FullName>" << this->MakeXMLSafe(result->m_Path)
|
||||||
<< "\t</Test>" << std::endl;
|
<< "/" << this->MakeXMLSafe(result->m_Name) << "</FullName>\n"
|
||||||
|
<< "\t\t<FullCommandLine>"
|
||||||
|
<< this->MakeXMLSafe(result->m_FullCommandLine)
|
||||||
|
<< "</FullCommandLine>\n"
|
||||||
|
<< "\t\t<Results>" << std::endl;
|
||||||
|
if ( result->m_Status != cmCTest::NOT_RUN )
|
||||||
|
{
|
||||||
|
if ( result->m_Status != cmCTest::COMPLETED || result->m_ReturnValue )
|
||||||
|
{
|
||||||
|
os << "\t\t\t<NamedMeasurement type=\"text/string\" name=\"Exit Code\"><Value>"
|
||||||
|
<< this->GetTestStatus(result->m_Status) << "</Value></NamedMeasurement>\n"
|
||||||
|
<< "\t\t\t<NamedMeasurement type=\"text/string\" name=\"Exit Value\"><Value>"
|
||||||
|
<< result->m_ReturnValue << "</Value></NamedMeasurement>" << std::endl;
|
||||||
|
}
|
||||||
|
os << result->m_RegressionImages;
|
||||||
|
os << "\t\t\t<NamedMeasurement type=\"numeric/double\" "
|
||||||
|
<< "name=\"Execution Time\"><Value>"
|
||||||
|
<< result->m_ExecutionTime << "</Value></NamedMeasurement>\n";
|
||||||
|
os
|
||||||
|
<< "\t\t\t<NamedMeasurement type=\"text/string\" "
|
||||||
|
<< "name=\"Completion Status\"><Value>"
|
||||||
|
<< result->m_CompletionStatus << "</Value></NamedMeasurement>\n";
|
||||||
|
}
|
||||||
|
os
|
||||||
|
<< "\t\t\t<Measurement>\n"
|
||||||
|
<< "\t\t\t\t<Value>" << this->MakeXMLSafe(result->m_Output)
|
||||||
|
<< "</Value>\n"
|
||||||
|
<< "\t\t\t</Measurement>\n"
|
||||||
|
<< "\t\t</Results>\n"
|
||||||
|
<< "\t</Test>" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
os << "\t<EndDateTime>" << m_EndTest << "</EndDateTime>\n"
|
os << "\t<EndDateTime>" << m_EndTest << "</EndDateTime>\n"
|
||||||
|
@ -2277,7 +2296,7 @@ std::string cmCTest::GenerateRegressionImages(const std::string& xml)
|
||||||
return ostr.str();
|
return ostr.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmCTest::RunMakeCommand(const char* command, std::string* output,
|
int cmCTest::RunMakeCommand(const char* command, std::string* output,
|
||||||
int* retVal, const char* dir, bool verbose, int timeout, std::ofstream& ofs)
|
int* retVal, const char* dir, bool verbose, int timeout, std::ofstream& ofs)
|
||||||
{
|
{
|
||||||
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
|
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
|
||||||
|
@ -2356,24 +2375,25 @@ bool cmCTest::RunMakeCommand(const char* command, std::string* output,
|
||||||
|
|
||||||
cmsysProcess_WaitForExit(cp, 0);
|
cmsysProcess_WaitForExit(cp, 0);
|
||||||
|
|
||||||
bool result = true;
|
int result = cmsysProcess_GetState(cp);
|
||||||
if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exited)
|
|
||||||
|
if(result == cmsysProcess_State_Exited)
|
||||||
{
|
{
|
||||||
if ( retVal )
|
*retVal = cmsysProcess_GetExitValue(cp);
|
||||||
{
|
|
||||||
*retVal = cmsysProcess_GetExitValue(cp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( cmsysProcess_GetExitValue(cp) != 0 )
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else if(result == cmsysProcess_State_Exception)
|
||||||
{
|
{
|
||||||
result = false;
|
*retVal = cmsysProcess_GetExitException(cp);
|
||||||
|
std::cout << "There was an exception: " << *retVal << std::endl;
|
||||||
|
}
|
||||||
|
else if(result == cmsysProcess_State_Expired)
|
||||||
|
{
|
||||||
|
std::cout << "There was a timeout" << std::endl;
|
||||||
|
}
|
||||||
|
else if(result == cmsysProcess_State_Error)
|
||||||
|
{
|
||||||
|
*output += "\n*** ERROR executing: ";
|
||||||
|
*output += cmsysProcess_GetErrorString(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmsysProcess_Delete(cp);
|
cmsysProcess_Delete(cp);
|
||||||
|
|
|
@ -140,7 +140,7 @@ private:
|
||||||
ALL_TEST = 9,
|
ALL_TEST = 9,
|
||||||
LAST_TEST = 10
|
LAST_TEST = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { // Program statuses
|
enum { // Program statuses
|
||||||
NOT_RUN = 0,
|
NOT_RUN = 0,
|
||||||
TIMEOUT,
|
TIMEOUT,
|
||||||
|
@ -238,8 +238,14 @@ private:
|
||||||
std::string MakeXMLSafe(const std::string&);
|
std::string MakeXMLSafe(const std::string&);
|
||||||
std::string MakeURLSafe(const std::string&);
|
std::string MakeURLSafe(const std::string&);
|
||||||
|
|
||||||
bool RunMakeCommand(const char* command, std::string* output,
|
//! Run command specialized for make and configure. Returns process status
|
||||||
int* retVal, const char* dir, bool verbose, int timeout, std::ofstream& ofs);
|
// and retVal is return value or exception.
|
||||||
|
int RunMakeCommand(const char* command, std::string* output,
|
||||||
|
int* retVal, const char* dir, bool verbose, int timeout,
|
||||||
|
std::ofstream& ofs);
|
||||||
|
|
||||||
|
//! Run command specialized for tests. Returns process status and retVal is
|
||||||
|
// return value or exception.
|
||||||
int RunTest( const char* command, std::string* output, int *retVal);
|
int RunTest( const char* command, std::string* output, int *retVal);
|
||||||
|
|
||||||
std::string GenerateRegressionImages(const std::string& xml);
|
std::string GenerateRegressionImages(const std::string& xml);
|
||||||
|
|
Loading…
Reference in New Issue