ENH: Divide CTest file submission list by part

This splits the list of files for CTest to submit into those belonging
to each part.  The set is recombined just before submission.  Later this
will allow piecewise submissions.
This commit is contained in:
Brad King 2009-01-12 10:37:55 -05:00
parent 4b97fab34d
commit 447f5b303e
10 changed files with 49 additions and 35 deletions

View File

@ -467,7 +467,7 @@ int cmCTestBuildHandler::ProcessHandler()
// Generate XML output
cmGeneratedFileStream xofs;
if( !this->StartResultingXML("Build", xofs))
if(!this->StartResultingXML(cmCTest::PartBuild, "Build", xofs))
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create build XML file"
<< std::endl);

View File

@ -67,7 +67,7 @@ int cmCTestConfigureHandler::ProcessHandler()
if ( !this->CTest->GetShowOnly() )
{
cmGeneratedFileStream os;
if ( !this->StartResultingXML("Configure", os) )
if(!this->StartResultingXML(cmCTest::PartConfigure, "Configure", os))
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open configure file"
<< std::endl);

View File

@ -162,7 +162,8 @@ bool cmCTestCoverageHandler::StartCoverageLogFile(
sprintf(covLogFilename, "CoverageLog-%d", logFileCount);
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Open file: "
<< covLogFilename << std::endl);
if (!this->StartResultingXML(covLogFilename, covLogFile) )
if(!this->StartResultingXML(cmCTest::PartCoverage,
covLogFilename, covLogFile))
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open log file: "
<< covLogFilename << std::endl);
@ -381,7 +382,7 @@ int cmCTestCoverageHandler::ProcessHandler()
cmGeneratedFileStream covSumFile;
cmGeneratedFileStream covLogFile;
if (!this->StartResultingXML("Coverage", covSumFile))
if(!this->StartResultingXML(cmCTest::PartCoverage, "Coverage", covSumFile))
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot open coverage summary file." << std::endl);
@ -1434,7 +1435,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
std::ostream& tmpLog = *cont->OFS;
// copen the Coverage.xml file in the Testing directory
cmGeneratedFileStream covSumFile;
if (!this->StartResultingXML("Coverage", covSumFile))
if(!this->StartResultingXML(cmCTest::PartCoverage, "Coverage", covSumFile))
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot open coverage summary file." << std::endl);

View File

@ -104,8 +104,9 @@ const char* cmCTestGenericHandler::GetOption(const char* op)
}
//----------------------------------------------------------------------
bool cmCTestGenericHandler::StartResultingXML(const char* name,
cmGeneratedFileStream& xofs)
bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part,
const char* name,
cmGeneratedFileStream& xofs)
{
if ( !name )
{
@ -139,7 +140,7 @@ bool cmCTestGenericHandler::StartResultingXML(const char* name,
<< std::endl);
return false;
}
this->CTest->AddSubmitFile(ostr.str().c_str());
this->CTest->AddSubmitFile(part, ostr.str().c_str());
return true;
}

View File

@ -20,8 +20,8 @@
#include "cmObject.h"
#include "cmCTest.h"
class cmCTest;
class cmMakefile;
class cmCTestCommand;
class cmGeneratedFileStream;
@ -91,7 +91,8 @@ public:
void SetAppendXML(bool b) { this->AppendXML = b; }
protected:
bool StartResultingXML(const char* name, cmGeneratedFileStream& xofs);
bool StartResultingXML(cmCTest::Part part,
const char* name, cmGeneratedFileStream& xofs);
bool StartLogFile(const char* name, cmGeneratedFileStream& xofs);
bool AppendXML;

View File

@ -852,15 +852,14 @@ int cmCTestSubmitHandler::ProcessHandler()
cmGeneratedFileStream ofs;
this->StartLogFile("Submit", ofs);
cmCTest::SetOfStrings files;
std::string prefix = this->GetSubmitResultsPrefix();
// TODO:
// Check if test is enabled
this->CTest->AddIfExists(files, "Update.xml");
this->CTest->AddIfExists(files, "Configure.xml");
this->CTest->AddIfExists(files, "Build.xml");
this->CTest->AddIfExists(files, "Test.xml");
if ( this->CTest->AddIfExists(files, "Coverage.xml") )
this->CTest->AddIfExists(cmCTest::PartUpdate, "Update.xml");
this->CTest->AddIfExists(cmCTest::PartConfigure, "Configure.xml");
this->CTest->AddIfExists(cmCTest::PartBuild, "Build.xml");
this->CTest->AddIfExists(cmCTest::PartTest, "Test.xml");
if(this->CTest->AddIfExists(cmCTest::PartCoverage, "Coverage.xml"))
{
cmCTest::VectorOfStrings gfiles;
std::string gpath
@ -877,7 +876,7 @@ int cmCTestSubmitHandler::ProcessHandler()
gfiles[cc] = gfiles[cc].substr(glen);
cmCTestLog(this->CTest, DEBUG, "Glob file: " << gfiles[cc].c_str()
<< std::endl);
files.insert(gfiles[cc]);
this->CTest->AddSubmitFile(cmCTest::PartCoverage, gfiles[cc].c_str());
}
}
else
@ -885,22 +884,28 @@ int cmCTestSubmitHandler::ProcessHandler()
cmCTestLog(this->CTest, ERROR_MESSAGE, "Problem globbing" << std::endl);
}
}
this->CTest->AddIfExists(files, "DynamicAnalysis.xml");
this->CTest->AddIfExists(files, "Purify.xml");
this->CTest->AddIfExists(files, "Notes.xml");
this->CTest->AddIfExists(cmCTest::PartMemCheck, "DynamicAnalysis.xml");
this->CTest->AddIfExists(cmCTest::PartMemCheck, "Purify.xml");
this->CTest->AddIfExists(cmCTest::PartNotes, "Notes.xml");
cmCTest::SetOfStrings::iterator it;
for ( it = this->CTest->GetSubmitFiles()->begin();
it != this->CTest->GetSubmitFiles()->end();
++ it )
// Query parts for files to submit.
cmCTest::SetOfStrings files;
for(cmCTest::Part p = cmCTest::PartStart;
p != cmCTest::PartCount; p = cmCTest::Part(p+1))
{
files.insert(files.end(), *it);
std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p);
for(std::vector<std::string>::const_iterator pi = pfiles.begin();
pi != pfiles.end(); ++pi)
{
files.insert(*pi);
}
}
if ( ofs )
{
ofs << "Upload files:" << std::endl;
int cnt = 0;
cmCTest::SetOfStrings::iterator it;
for ( it = files.begin(); it != files.end(); ++ it )
{
ofs << cnt << "\t" << it->c_str() << std::endl;

View File

@ -592,6 +592,7 @@ int cmCTestTestHandler::ProcessHandler()
{
cmGeneratedFileStream xmlfile;
if( !this->StartResultingXML(
(this->MemCheck ? cmCTest::PartMemCheck : cmCTest::PartTest),
(this->MemCheck ? "DynamicAnalysis" : "Test"), xmlfile) )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create "

View File

@ -578,7 +578,7 @@ int cmCTestUpdateHandler::ProcessHandler()
// Now update repository and remember what files were updated
//
cmGeneratedFileStream os;
if ( !this->StartResultingXML("Update", os) )
if(!this->StartResultingXML(cmCTest::PartUpdate, "Update", os))
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open log file"
<< std::endl);

View File

@ -269,6 +269,7 @@ cmCTest::cmCTest()
this->Parts[PartMemCheck].SetName("MemCheck");
this->Parts[PartSubmit].SetName("Submit");
this->Parts[PartNotes].SetName("Notes");
this->Parts[PartExtraFiles].SetName("ExtraFiles");
// Fill the part name-to-id map.
for(Part p = PartStart; p != PartCount; p = Part(p+1))
@ -734,11 +735,11 @@ bool cmCTest::OpenOutputFile(const std::string& path,
}
//----------------------------------------------------------------------
bool cmCTest::AddIfExists(SetOfStrings& files, const char* file)
bool cmCTest::AddIfExists(Part part, const char* file)
{
if ( this->CTestFileExists(file) )
{
files.insert(file);
this->AddSubmitFile(part, file);
}
else
{
@ -746,7 +747,7 @@ bool cmCTest::AddIfExists(SetOfStrings& files, const char* file)
name += ".gz";
if ( this->CTestFileExists(name.c_str()) )
{
files.insert(name.c_str());
this->AddSubmitFile(part, file);
}
else
{
@ -1448,7 +1449,7 @@ bool cmCTest::SubmitExtraFiles(const std::vector<cmStdString> &files)
<< std::endl;);
return false;
}
this->AddSubmitFile(it->c_str());
this->AddSubmitFile(PartExtraFiles, it->c_str());
}
return true;
}
@ -2436,9 +2437,9 @@ void cmCTest::SetSpecificTrack(const char* track)
}
//----------------------------------------------------------------------
void cmCTest::AddSubmitFile(const char* name)
void cmCTest::AddSubmitFile(Part part, const char* name)
{
this->SubmitFiles.insert(name);
this->Parts[part].SubmitFiles.push_back(name);
}
//----------------------------------------------------------------------

View File

@ -62,6 +62,7 @@ public:
PartMemCheck,
PartSubmit,
PartNotes,
PartExtraFiles,
PartCount // Update names in constructor when adding a part
};
@ -75,6 +76,8 @@ public:
void Enable() { this->Enabled = true; }
operator bool() const { return this->Enabled; }
std::vector<std::string> SubmitFiles;
private:
bool Enabled;
std::string Name;
@ -147,7 +150,7 @@ public:
* Check if CTest file exists
*/
bool CTestFileExists(const std::string& filename);
bool AddIfExists(SetOfStrings& files, const char* file);
bool AddIfExists(Part part, const char* file);
/**
* Set the cmake test
@ -352,8 +355,9 @@ public:
int GetDartVersion() { return this->DartVersion; }
//! Add file to be submitted
void AddSubmitFile(const char* name);
SetOfStrings* GetSubmitFiles() { return &this->SubmitFiles; }
void AddSubmitFile(Part part, const char* name);
std::vector<std::string> const& GetSubmitFiles(Part part)
{ return this->Parts[part].SubmitFiles; }
//! Read the custom configuration files and apply them to the current ctest
int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf);