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 // Generate XML output
cmGeneratedFileStream xofs; cmGeneratedFileStream xofs;
if( !this->StartResultingXML("Build", xofs)) if(!this->StartResultingXML(cmCTest::PartBuild, "Build", xofs))
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create build XML file" cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create build XML file"
<< std::endl); << std::endl);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -592,6 +592,7 @@ int cmCTestTestHandler::ProcessHandler()
{ {
cmGeneratedFileStream xmlfile; cmGeneratedFileStream xmlfile;
if( !this->StartResultingXML( if( !this->StartResultingXML(
(this->MemCheck ? cmCTest::PartMemCheck : cmCTest::PartTest),
(this->MemCheck ? "DynamicAnalysis" : "Test"), xmlfile) ) (this->MemCheck ? "DynamicAnalysis" : "Test"), xmlfile) )
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create " 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 // Now update repository and remember what files were updated
// //
cmGeneratedFileStream os; cmGeneratedFileStream os;
if ( !this->StartResultingXML("Update", os) ) if(!this->StartResultingXML(cmCTest::PartUpdate, "Update", os))
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open log file" cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open log file"
<< std::endl); << std::endl);

View File

@ -269,6 +269,7 @@ cmCTest::cmCTest()
this->Parts[PartMemCheck].SetName("MemCheck"); this->Parts[PartMemCheck].SetName("MemCheck");
this->Parts[PartSubmit].SetName("Submit"); this->Parts[PartSubmit].SetName("Submit");
this->Parts[PartNotes].SetName("Notes"); this->Parts[PartNotes].SetName("Notes");
this->Parts[PartExtraFiles].SetName("ExtraFiles");
// Fill the part name-to-id map. // Fill the part name-to-id map.
for(Part p = PartStart; p != PartCount; p = Part(p+1)) 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) ) if ( this->CTestFileExists(file) )
{ {
files.insert(file); this->AddSubmitFile(part, file);
} }
else else
{ {
@ -746,7 +747,7 @@ bool cmCTest::AddIfExists(SetOfStrings& files, const char* file)
name += ".gz"; name += ".gz";
if ( this->CTestFileExists(name.c_str()) ) if ( this->CTestFileExists(name.c_str()) )
{ {
files.insert(name.c_str()); this->AddSubmitFile(part, file);
} }
else else
{ {
@ -1448,7 +1449,7 @@ bool cmCTest::SubmitExtraFiles(const std::vector<cmStdString> &files)
<< std::endl;); << std::endl;);
return false; return false;
} }
this->AddSubmitFile(it->c_str()); this->AddSubmitFile(PartExtraFiles, it->c_str());
} }
return true; 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, PartMemCheck,
PartSubmit, PartSubmit,
PartNotes, PartNotes,
PartExtraFiles,
PartCount // Update names in constructor when adding a part PartCount // Update names in constructor when adding a part
}; };
@ -75,6 +76,8 @@ public:
void Enable() { this->Enabled = true; } void Enable() { this->Enabled = true; }
operator bool() const { return this->Enabled; } operator bool() const { return this->Enabled; }
std::vector<std::string> SubmitFiles;
private: private:
bool Enabled; bool Enabled;
std::string Name; std::string Name;
@ -147,7 +150,7 @@ public:
* Check if CTest file exists * Check if CTest file exists
*/ */
bool CTestFileExists(const std::string& filename); bool CTestFileExists(const std::string& filename);
bool AddIfExists(SetOfStrings& files, const char* file); bool AddIfExists(Part part, const char* file);
/** /**
* Set the cmake test * Set the cmake test
@ -352,8 +355,9 @@ public:
int GetDartVersion() { return this->DartVersion; } int GetDartVersion() { return this->DartVersion; }
//! Add file to be submitted //! Add file to be submitted
void AddSubmitFile(const char* name); void AddSubmitFile(Part part, const char* name);
SetOfStrings* GetSubmitFiles() { return &this->SubmitFiles; } 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 //! Read the custom configuration files and apply them to the current ctest
int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf); int ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf);