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:
Andy Cedilnik 2003-08-18 11:30:53 -04:00
parent 3935711e01
commit 7f5b38b190
2 changed files with 82 additions and 56 deletions

View File

@ -564,7 +564,7 @@ int cmCTest::UpdateDirectory()
{
res = cmSystemTools::RunSingleCommand(command.c_str(), &goutput,
&retVal, sourceDirectory.c_str(),
m_Verbose, m_TimeOut);
m_Verbose, 0 /*m_TimeOut*/);
if ( this->OpenOutputFile("Temporary", "LastUpdate.log", ofs) )
{
ofs << goutput << std::endl;;
@ -619,7 +619,7 @@ int cmCTest::UpdateDirectory()
std::string output;
res = cmSystemTools::RunSingleCommand(logcommand.c_str(), &output,
&retVal, sourceDirectory.c_str(),
m_Verbose, m_TimeOut);
m_Verbose, 0 /*m_TimeOut*/);
if ( ofs )
{
ofs << output << std::endl;
@ -861,7 +861,7 @@ int cmCTest::ConfigureDirectory()
std::string output;
int retVal = 0;
bool res = true;
int res = 0;
if ( !m_ShowOnly )
{
std::ofstream os;
@ -875,7 +875,7 @@ int cmCTest::ConfigureDirectory()
this->OpenOutputFile("Temporary", "LastConfigure.log", ofs);
res = this->RunMakeCommand(cCommand.c_str(), &output,
&retVal, buildDirectory.c_str(),
m_Verbose, m_TimeOut, ofs);
m_Verbose, 0, ofs);
if ( ofs )
{
@ -891,7 +891,7 @@ int cmCTest::ConfigureDirectory()
<< m_DartConfiguration["Site"] << "\">\n"
<< "<Configure>\n"
<< "\t<StartDateTime>" << start_time << "</StartDateTime>" << std::endl;
if ( retVal )
if ( res == cmsysProcess_State_Exited && retVal )
{
os << retVal;
}
@ -941,19 +941,19 @@ int cmCTest::BuildDirectory()
m_StartBuild = ::CurrentTime();
std::string output;
int retVal = 0;
bool res = true;
int res = cmsysProcess_State_Exited;
if ( !m_ShowOnly )
{
res = this->RunMakeCommand(makeCommand.c_str(), &output,
&retVal, buildDirectory.c_str(),
m_Verbose, m_TimeOut, ofs);
m_Verbose, 0, ofs);
}
else
{
std::cout << "Build with command: " << makeCommand << std::endl;
}
m_EndBuild = ::CurrentTime();
if (! res || retVal )
if (res != cmsysProcess_State_Exited || retVal )
{
std::cerr << "Error(s) when building project" << std::endl;
}
@ -1230,7 +1230,7 @@ int cmCTest::CoverageDirectory()
{
res = cmSystemTools::RunSingleCommand(command.c_str(), &output,
&retVal, opath.c_str(),
m_Verbose, m_TimeOut);
m_Verbose, 0 /*m_TimeOut*/);
}
if ( res && retVal == 0 )
{
@ -1713,6 +1713,8 @@ void cmCTest::ProcessDirectory(std::vector<std::string> &passed,
{
std::cerr << "Unable to find executable: " <<
args[1].Value.c_str() << "\n";
cres.m_Status = cmCTest::NOT_RUN;
m_TestResults.push_back( cres );
continue;
}
@ -2041,8 +2043,20 @@ void cmCTest::GenerateDartTestOutput(std::ostream& os)
for ( cc = 0; cc < m_TestResults.size(); cc ++ )
{
cmCTestTestResult *result = &m_TestResults[cc];
os << "\t<Test Status=\"" << (result->m_Status==cmCTest::COMPLETED?"passed":"failed")
<< "\">\n"
os << "\t<Test Status=\"";
if ( result->m_Status == cmCTest::COMPLETED )
{
os << "passed";
}
else if ( result->m_Status == cmCTest::NOT_RUN )
{
os << "notrun";
}
else
{
os << "failed";
}
os << "\">\n"
<< "\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)
@ -2051,6 +2065,8 @@ void cmCTest::GenerateDartTestOutput(std::ostream& os)
<< 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>"
@ -2061,10 +2077,13 @@ void cmCTest::GenerateDartTestOutput(std::ostream& os)
os << result->m_RegressionImages;
os << "\t\t\t<NamedMeasurement type=\"numeric/double\" "
<< "name=\"Execution Time\"><Value>"
<< result->m_ExecutionTime << "</Value></NamedMeasurement>\n"
<< result->m_ExecutionTime << "</Value></NamedMeasurement>\n";
os
<< "\t\t\t<NamedMeasurement type=\"text/string\" "
<< "name=\"Completion Status\"><Value>"
<< result->m_CompletionStatus << "</Value></NamedMeasurement>\n"
<< result->m_CompletionStatus << "</Value></NamedMeasurement>\n";
}
os
<< "\t\t\t<Measurement>\n"
<< "\t\t\t\t<Value>" << this->MakeXMLSafe(result->m_Output)
<< "</Value>\n"
@ -2277,7 +2296,7 @@ std::string cmCTest::GenerateRegressionImages(const std::string& xml)
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)
{
std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
@ -2356,24 +2375,25 @@ bool cmCTest::RunMakeCommand(const char* command, std::string* output,
cmsysProcess_WaitForExit(cp, 0);
bool result = true;
if(cmsysProcess_GetState(cp) == cmsysProcess_State_Exited)
{
if ( retVal )
int result = cmsysProcess_GetState(cp);
if(result == cmsysProcess_State_Exited)
{
*retVal = cmsysProcess_GetExitValue(cp);
}
else
else if(result == cmsysProcess_State_Exception)
{
if ( cmsysProcess_GetExitValue(cp) != 0 )
*retVal = cmsysProcess_GetExitException(cp);
std::cout << "There was an exception: " << *retVal << std::endl;
}
else if(result == cmsysProcess_State_Expired)
{
result = false;
std::cout << "There was a timeout" << std::endl;
}
}
}
else
else if(result == cmsysProcess_State_Error)
{
result = false;
*output += "\n*** ERROR executing: ";
*output += cmsysProcess_GetErrorString(cp);
}
cmsysProcess_Delete(cp);

View File

@ -238,8 +238,14 @@ private:
std::string MakeXMLSafe(const std::string&);
std::string MakeURLSafe(const std::string&);
bool RunMakeCommand(const char* command, std::string* output,
int* retVal, const char* dir, bool verbose, int timeout, std::ofstream& ofs);
//! Run command specialized for make and configure. Returns process status
// 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);
std::string GenerateRegressionImages(const std::string& xml);