ENH: Teach ctest_* to create appending XML files

This adds an APPEND option to the ctest_* commands which tells them to
put the Append="true" attribute in the Site element of their XML file.
This commit is contained in:
Brad King 2009-01-12 09:11:29 -05:00
parent ae2c4143d2
commit cccac773ce
11 changed files with 27 additions and 9 deletions

View File

@ -484,7 +484,7 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
std::vector<cmCTestBuildErrorWarning> ew,
double elapsed_build_time)
{
this->CTest->StartXML(os);
this->CTest->StartXML(os, this->AppendXML);
os << "<Build>\n"
<< "\t<StartDateTime>" << this->StartBuild << "</StartDateTime>\n"
<< "\t<StartBuildTime>" <<

View File

@ -92,7 +92,7 @@ int cmCTestConfigureHandler::ProcessHandler()
if ( os )
{
this->CTest->StartXML(os);
this->CTest->StartXML(os, this->AppendXML);
os << "<Configure>\n"
<< "\t<StartDateTime>" << start_time << "</StartDateTime>"
<< std::endl

View File

@ -169,7 +169,7 @@ bool cmCTestCoverageHandler::StartCoverageLogFile(
return false;
}
std::string local_start_time = this->CTest->CurrentTime();
this->CTest->StartXML(covLogFile);
this->CTest->StartXML(covLogFile, this->AppendXML);
covLogFile << "<CoverageLog>" << std::endl
<< "\t<StartDateTime>" << local_start_time << "</StartDateTime>"
<< "\t<StartTime>"
@ -388,7 +388,7 @@ int cmCTestCoverageHandler::ProcessHandler()
return -1;
}
this->CTest->StartXML(covSumFile);
this->CTest->StartXML(covSumFile, this->AppendXML);
// Produce output xml files
covSumFile << "<Coverage>" << std::endl
@ -1440,7 +1440,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
"Cannot open coverage summary file." << std::endl);
return 0;
}
this->CTest->StartXML(covSumFile);
this->CTest->StartXML(covSumFile, this->AppendXML);
double elapsed_time_start = cmSystemTools::GetTime();
std::string coverage_start_time = this->CTest->CurrentTime();
covSumFile << "<Coverage>" << std::endl

View File

@ -26,6 +26,7 @@ cmCTestGenericHandler::cmCTestGenericHandler()
this->HandlerVerbose = false;
this->CTest = 0;
this->SubmitIndex = 0;
this->AppendXML = false;
}
//----------------------------------------------------------------------

View File

@ -88,10 +88,13 @@ public:
void SetSubmitIndex(int idx) { this->SubmitIndex = idx; }
int GetSubmitIndex() { return this->SubmitIndex; }
void SetAppendXML(bool b) { this->AppendXML = b; }
protected:
bool StartResultingXML(const char* name, cmGeneratedFileStream& xofs);
bool StartLogFile(const char* name, cmGeneratedFileStream& xofs);
bool AppendXML;
bool HandlerVerbose;
cmCTest *CTest;
t_StringToString Options;

View File

@ -33,6 +33,7 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
this->Arguments[ct_BUILD] = "BUILD";
this->Arguments[ct_SUBMIT_INDEX] = "SUBMIT_INDEX";
this->Last = ct_LAST;
this->AppendXML = false;
}
bool cmCTestHandlerCommand
@ -73,6 +74,8 @@ bool cmCTestHandlerCommand
return false;
}
handler->SetAppendXML(this->AppendXML);
handler->PopulateCustomVectors(this->Makefile);
if ( this->Values[ct_BUILD] )
{
@ -143,6 +146,14 @@ bool cmCTestHandlerCommand
//----------------------------------------------------------------------------
bool cmCTestHandlerCommand::CheckArgumentKeyword(std::string const& arg)
{
// Look for non-value arguments common to all commands.
if(arg == "APPEND")
{
this->ArgumentDoing = ArgumentDoingNone;
this->AppendXML = true;
return true;
}
// Check for a keyword in our argument/value table.
for(unsigned int k=0; k < this->Arguments.size(); ++k)
{

View File

@ -66,6 +66,8 @@ protected:
int ArgumentDoing;
unsigned int ArgumentIndex;
bool AppendXML;
std::string ReturnVariable;
std::vector<const char*> Arguments;
std::vector<const char*> Values;

View File

@ -287,7 +287,7 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os)
return;
}
this->CTest->StartXML(os);
this->CTest->StartXML(os, this->AppendXML);
os << "<DynamicAnalysis Checker=\"";
switch ( this->MemoryTesterStyle )
{

View File

@ -1442,7 +1442,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
return;
}
this->CTest->StartXML(os);
this->CTest->StartXML(os, this->AppendXML);
os << "<Testing>\n"
<< "\t<StartDateTime>" << this->StartTest << "</StartDateTime>\n"
<< "\t<StartTestTime>" << this->StartTestTime << "</StartTestTime>\n"

View File

@ -1269,7 +1269,7 @@ int cmCTest::RunTest(std::vector<const char*> argv,
}
//----------------------------------------------------------------------
void cmCTest::StartXML(std::ostream& ostr)
void cmCTest::StartXML(std::ostream& ostr, bool append)
{
if(this->CurrentTag.empty())
{
@ -1289,6 +1289,7 @@ void cmCTest::StartXML(std::ostream& ostr)
<< this->GetTestModelString() << "\"\n\tName=\""
<< this->GetCTestConfiguration("Site") << "\"\n\tGenerator=\"ctest"
<< cmVersion::GetCMakeVersion() << "\"\n"
<< (append? "\tAppend=\"true\"\n":"")
<< "\tOSName=\"" << info.GetOSName() << "\"\n"
<< "\tHostname=\"" << info.GetHostname() << "\"\n"
<< "\tOSRelease=\"" << info.GetOSRelease() << "\"\n"

View File

@ -199,7 +199,7 @@ public:
int* retVal = 0, const char* dir = 0, double timeout = 0.0);
//! Start CTest XML output file
void StartXML(std::ostream& ostr);
void StartXML(std::ostream& ostr, bool append);
//! End CTest XML output file
void EndXML(std::ostream& ostr);