diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 57ace62e7..31d60f393 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -673,255 +673,262 @@ int cmCTest::UpdateDirectory()
os << "\t" << start_time << "\n"
<< "\t" << command << "\n"
<< "\t";
- if ( retVal )
+ int failed = 0;
+ if ( !res || retVal )
{
+ os << "Update error: ";
os << goutput;
+ std::cerr << "Update with command: " << command << " failed" << std::endl;
+ failed = 1;
}
os << "" << std::endl;
-
- std::vector lines;
- cmSystemTools::Split(goutput.c_str(), lines);
- std::cout << "Updated; gathering version information" << std::endl;
- cmsys::RegularExpression date_author("^date: +([^;]+); +author: +([^;]+); +state: +[^;]+;");
- cmsys::RegularExpression revision("^revision +([^ ]*) *$");
- cmsys::RegularExpression end_of_file("^=============================================================================$");
- cmsys::RegularExpression end_of_comment("^----------------------------$");
- std::string current_path = "";
- bool first_file = true;
-
- cmCTest::AuthorsToUpdatesMap authors_files_map;
- int num_updated = 0;
- int num_modified = 0;
- int num_conflicting = 0;
- for ( cc= 0 ; cc < lines.size(); cc ++ )
+ if ( !failed )
{
- const char* line = lines[cc].c_str();
- char mod = line[0];
- if ( line[1] == ' ' && mod != '?' )
+
+ std::vector lines;
+ cmSystemTools::Split(goutput.c_str(), lines);
+ std::cout << "Updated; gathering version information" << std::endl;
+ cmsys::RegularExpression date_author("^date: +([^;]+); +author: +([^;]+); +state: +[^;]+;");
+ cmsys::RegularExpression revision("^revision +([^ ]*) *$");
+ cmsys::RegularExpression end_of_file("^=============================================================================$");
+ cmsys::RegularExpression end_of_comment("^----------------------------$");
+ std::string current_path = "";
+ bool first_file = true;
+
+ cmCTest::AuthorsToUpdatesMap authors_files_map;
+ int num_updated = 0;
+ int num_modified = 0;
+ int num_conflicting = 0;
+ for ( cc= 0 ; cc < lines.size(); cc ++ )
{
- count ++;
- const char* file = line + 2;
- //std::cout << "Line" << cc << ": " << mod << " - " << file << std::endl;
- std::string logcommand = cvsCommand + " -z3 log -N " + file;
- //std::cout << "Do log: " << logcommand << std::endl;
- std::string output;
- res = cmSystemTools::RunSingleCommand(logcommand.c_str(), &output,
- &retVal, sourceDirectory.c_str(),
- m_Verbose, 0 /*m_TimeOut*/);
- if ( ofs )
+ const char* line = lines[cc].c_str();
+ char mod = line[0];
+ if ( line[1] == ' ' && mod != '?' )
{
- ofs << output << std::endl;
- }
- if ( res && retVal == 0)
- {
- //std::cout << output << std::endl;
- std::vector ulines;
- cmSystemTools::Split(output.c_str(), ulines);
- std::string::size_type sline = 0;
- std::string srevision1 = "Unknown";
- std::string sdate1 = "Unknown";
- std::string sauthor1 = "Unknown";
- std::string semail1 = "Unknown";
- std::string comment1 = "";
- std::string srevision2 = "Unknown";
- std::string sdate2 = "Unknown";
- std::string sauthor2 = "Unknown";
- std::string comment2 = "";
- std::string semail2 = "Unknown";
- bool have_first = false;
- bool have_second = false;
- for ( kk = 0; kk < ulines.size(); kk ++ )
+ count ++;
+ const char* file = line + 2;
+ //std::cout << "Line" << cc << ": " << mod << " - " << file << std::endl;
+ std::string logcommand = cvsCommand + " -z3 log -N " + file;
+ //std::cout << "Do log: " << logcommand << std::endl;
+ std::string output;
+ res = cmSystemTools::RunSingleCommand(logcommand.c_str(), &output,
+ &retVal, sourceDirectory.c_str(),
+ m_Verbose, 0 /*m_TimeOut*/);
+ if ( ofs )
{
- const char* clp = ulines[kk].c_str();
- if ( !have_second && !sline && revision.find(clp) )
+ ofs << output << std::endl;
+ }
+ if ( res && retVal == 0)
+ {
+ //std::cout << output << std::endl;
+ std::vector ulines;
+ cmSystemTools::Split(output.c_str(), ulines);
+ std::string::size_type sline = 0;
+ std::string srevision1 = "Unknown";
+ std::string sdate1 = "Unknown";
+ std::string sauthor1 = "Unknown";
+ std::string semail1 = "Unknown";
+ std::string comment1 = "";
+ std::string srevision2 = "Unknown";
+ std::string sdate2 = "Unknown";
+ std::string sauthor2 = "Unknown";
+ std::string comment2 = "";
+ std::string semail2 = "Unknown";
+ bool have_first = false;
+ bool have_second = false;
+ for ( kk = 0; kk < ulines.size(); kk ++ )
{
- if ( !have_first )
+ const char* clp = ulines[kk].c_str();
+ if ( !have_second && !sline && revision.find(clp) )
{
- srevision1 = revision.match(1);
+ if ( !have_first )
+ {
+ srevision1 = revision.match(1);
+ }
+ else
+ {
+ srevision2 = revision.match(1);
+ }
+ }
+ else if ( !have_second && !sline && date_author.find(clp) )
+ {
+ sline = kk + 1;
+ if ( !have_first )
+ {
+ sdate1 = date_author.match(1);
+ sauthor1 = date_author.match(2);
+ }
+ else
+ {
+ sdate2 = date_author.match(1);
+ sauthor2 = date_author.match(2);
+ }
+ }
+ else if ( sline && end_of_comment.find(clp) || end_of_file.find(clp))
+ {
+ if ( !have_first )
+ {
+ have_first = true;
+ }
+ else if ( !have_second )
+ {
+ have_second = true;
+ }
+ sline = 0;
+ }
+ else if ( sline )
+ {
+ if ( !have_first )
+ {
+ comment1 += clp;
+ comment1 += "\n";
+ }
+ else
+ {
+ comment2 += clp;
+ comment2 += "\n";
+ }
+ }
+ }
+ if ( mod == 'M' )
+ {
+ comment1 = "Locally modified file\n";
+ }
+ if ( mod == 'C' )
+ {
+ comment1 = "Conflict while updating\n";
+ }
+ std::string path = cmSystemTools::GetFilenamePath(file);
+ std::string fname = cmSystemTools::GetFilenameName(file);
+ if ( path != current_path )
+ {
+ if ( !first_file )
+ {
+ os << "\t" << std::endl;
}
else
{
- srevision2 = revision.match(1);
+ first_file = false;
}
+ os << "\t\n"
+ << "\t\t" << path << "" << std::endl;
}
- else if ( !have_second && !sline && date_author.find(clp) )
+ if ( mod == 'C' )
{
- sline = kk + 1;
- if ( !have_first )
- {
- sdate1 = date_author.match(1);
- sauthor1 = date_author.match(2);
- }
- else
- {
- sdate2 = date_author.match(1);
- sauthor2 = date_author.match(2);
- }
+ num_conflicting ++;
+ os << "\t" << std::endl;
}
- else if ( sline && end_of_comment.find(clp) || end_of_file.find(clp))
+ else if ( mod == 'M' )
{
- if ( !have_first )
- {
- have_first = true;
- }
- else if ( !have_second )
- {
- have_second = true;
- }
- sline = 0;
- }
- else if ( sline )
- {
- if ( !have_first )
- {
- comment1 += clp;
- comment1 += "\n";
- }
- else
- {
- comment2 += clp;
- comment2 += "\n";
- }
- }
- }
- if ( mod == 'M' )
- {
- comment1 = "Locally modified file\n";
- }
- if ( mod == 'C' )
- {
- comment1 = "Conflict while updating\n";
- }
- std::string path = cmSystemTools::GetFilenamePath(file);
- std::string fname = cmSystemTools::GetFilenameName(file);
- if ( path != current_path )
- {
- if ( !first_file )
- {
- os << "\t" << std::endl;
+ num_modified ++;
+ os << "\t" << std::endl;
}
else
{
- first_file = false;
+ num_updated ++;
+ os << "\t" << std::endl;
}
- os << "\t\n"
- << "\t\t" << path << "" << std::endl;
- }
- if ( mod == 'C' )
- {
- num_conflicting ++;
- os << "\t" << std::endl;
- }
- else if ( mod == 'M' )
- {
- num_modified ++;
- os << "\t" << std::endl;
- }
- else
- {
- num_updated ++;
- os << "\t" << std::endl;
- }
- if ( srevision2 == "Unknown" )
- {
- srevision2 = srevision1;
- }
- os << "\t\t" << fname
- << "\n"
- << "\t\t" << path << "\n"
- << "\t\t" << file << "\n"
- << "\t\t" << sdate1 << "\n"
- << "\t\t" << sauthor1 << "\n"
- << "\t\t" << semail1 << "\n"
- << "\t\t" << this->MakeXMLSafe(comment1) << "\n"
- << "\t\t" << srevision1 << "\n"
- << "\t\t" << srevision2 << ""
- << std::endl;
- if ( srevision2 != srevision1 )
- {
- os
- << "\t\t\n"
- << "\t\t\t" << srevision1 << "\n"
- << "\t\t\t" << srevision2 << "\n"
- << "\t\t\t" << sauthor1<< "\n"
- << "\t\t\t" << sdate1 << "\n"
- << "\t\t\t" << this->MakeXMLSafe(comment1) << "\n"
- << "\t\t\t" << semail1 << "\n"
- << "\t\t\n"
- << "\t\t\n"
- << "\t\t\t" << srevision2 << "\n"
- << "\t\t\t" << srevision2 << "\n"
- << "\t\t\t" << sauthor2<< "\n"
- << "\t\t\t" << sdate2 << "\n"
- << "\t\t\t" << this->MakeXMLSafe(comment2) << "\n"
- << "\t\t\t" << semail2 << "\n"
- << "\t\t" << std::endl;
- }
- if ( mod == 'C' )
- {
- os << "\t" << std::endl;
- }
- else if ( mod == 'M' )
- {
- os << "\t" << std::endl;
- }
- else
- {
- os << "\t" << std::endl;
- }
- cmCTest::UpdateFiles *u = &authors_files_map[sauthor1];
- cmCTest::StringPair p;
- p.first = path;
- p.second = fname;
- u->push_back(p);
+ if ( srevision2 == "Unknown" )
+ {
+ srevision2 = srevision1;
+ }
+ os << "\t\t" << fname
+ << "\n"
+ << "\t\t" << path << "\n"
+ << "\t\t" << file << "\n"
+ << "\t\t" << sdate1 << "\n"
+ << "\t\t" << sauthor1 << "\n"
+ << "\t\t" << semail1 << "\n"
+ << "\t\t" << this->MakeXMLSafe(comment1) << "\n"
+ << "\t\t" << srevision1 << "\n"
+ << "\t\t" << srevision2 << ""
+ << std::endl;
+ if ( srevision2 != srevision1 )
+ {
+ os
+ << "\t\t\n"
+ << "\t\t\t" << srevision1 << "\n"
+ << "\t\t\t" << srevision2 << "\n"
+ << "\t\t\t" << sauthor1<< "\n"
+ << "\t\t\t" << sdate1 << "\n"
+ << "\t\t\t" << this->MakeXMLSafe(comment1) << "\n"
+ << "\t\t\t" << semail1 << "\n"
+ << "\t\t\n"
+ << "\t\t\n"
+ << "\t\t\t" << srevision2 << "\n"
+ << "\t\t\t" << srevision2 << "\n"
+ << "\t\t\t" << sauthor2<< "\n"
+ << "\t\t\t" << sdate2 << "\n"
+ << "\t\t\t" << this->MakeXMLSafe(comment2) << "\n"
+ << "\t\t\t" << semail2 << "\n"
+ << "\t\t" << std::endl;
+ }
+ if ( mod == 'C' )
+ {
+ os << "\t" << std::endl;
+ }
+ else if ( mod == 'M' )
+ {
+ os << "\t" << std::endl;
+ }
+ else
+ {
+ os << "\t" << std::endl;
+ }
+ cmCTest::UpdateFiles *u = &authors_files_map[sauthor1];
+ cmCTest::StringPair p;
+ p.first = path;
+ p.second = fname;
+ u->push_back(p);
- current_path = path;
+ current_path = path;
+ }
}
}
- }
- if ( num_updated )
- {
- std::cout << "Found " << num_updated << " updated files" << std::endl;
- }
- if ( num_modified )
- {
- std::cout << "Found " << num_modified << " locally modified files"
- << std::endl;
- }
- if ( num_conflicting )
- {
- std::cout << "Found " << num_conflicting << " conflicting files"
- << std::endl;
- }
- if ( !first_file )
- {
- os << "\t" << std::endl;
- }
-
- cmCTest::AuthorsToUpdatesMap::iterator it;
- for ( it = authors_files_map.begin();
- it != authors_files_map.end();
- it ++ )
- {
- os << "\t\n"
- << "\t\t" << it->first << "" << std::endl;
- cmCTest::UpdateFiles *u = &(it->second);
- for ( cc = 0; cc < u->size(); cc ++ )
+ if ( num_updated )
{
- os << "\t\t"
- << (*u)[cc].second << "" << std::endl;
+ std::cout << "Found " << num_updated << " updated files" << std::endl;
+ }
+ if ( num_modified )
+ {
+ std::cout << "Found " << num_modified << " locally modified files"
+ << std::endl;
+ }
+ if ( num_conflicting )
+ {
+ std::cout << "Found " << num_conflicting << " conflicting files"
+ << std::endl;
+ }
+ if ( !first_file )
+ {
+ os << "\t" << std::endl;
}
- os << "\t" << std::endl;
- }
-
- //std::cout << "End" << std::endl;
- std::string end_time = ::CurrentTime();
- os << "\t" << end_time << "\n"
- << "" << std::endl;
- if ( ofs )
- {
- ofs.close();
+ cmCTest::AuthorsToUpdatesMap::iterator it;
+ for ( it = authors_files_map.begin();
+ it != authors_files_map.end();
+ it ++ )
+ {
+ os << "\t\n"
+ << "\t\t" << it->first << "" << std::endl;
+ cmCTest::UpdateFiles *u = &(it->second);
+ for ( cc = 0; cc < u->size(); cc ++ )
+ {
+ os << "\t\t"
+ << (*u)[cc].second << "" << std::endl;
+ }
+ os << "\t" << std::endl;
+ }
+
+ //std::cout << "End" << std::endl;
+ std::string end_time = ::CurrentTime();
+ os << "\t" << end_time << "\n"
+ << "" << std::endl;
+
+ if ( ofs )
+ {
+ ofs.close();
+ }
}
if (! res || retVal )
@@ -1376,7 +1383,10 @@ int cmCTest::CoverageDirectory()
std::string command = coverageCommand + " -o \"" + currPath + "\" -l \"" + files[cc] + "\"";
std::string output;
int retVal = 0;
- std::cerr << "Run gcov on " << files[cc] << " in directory: " << currPath.c_str() << std::endl;
+ if ( m_Verbose )
+ {
+ std::cerr << "Run gcov on " << files[cc] << " in directory: " << currPath.c_str() << std::endl;
+ }
//std::cout << " --- Run [" << command << "]" << std::endl;
bool res = true;
if ( !m_ShowOnly )
@@ -1450,13 +1460,16 @@ int cmCTest::CoverageDirectory()
// {
// std::cout << "File: " << files[cc] << std::endl;
// }
- std::cout << "---------------------------------------------------------------" << std::endl;
- std::cout << "The following files were missing:" << std::endl;
- for ( cc = 0; cc < missing_files.size(); cc ++ )
+ if ( missing_files.size() > 0 )
{
- std::cout << "File: " << missing_files[cc] << std::endl;
+ std::cout << "---------------------------------------------------------------" << std::endl;
+ std::cout << "The following files were missing:" << std::endl;
+ for ( cc = 0; cc < missing_files.size(); cc ++ )
+ {
+ std::cout << "File: " << missing_files[cc] << std::endl;
+ }
+ std::cout << "---------------------------------------------------------------" << std::endl;
}
- std::cout << "---------------------------------------------------------------" << std::endl;
std::map::iterator it;
cmCTest::tm_CoverageMap coverageresults;
@@ -3144,15 +3157,28 @@ void cmCTest::RestoreBackupDirectories(bool backup,
int cmCTest::RunConfigurationScript()
{
- m_ConfigurationScript =
- cmSystemTools::CollapseFullPath(m_ConfigurationScript.c_str());
-
- // make sure the file exists
- if (!cmSystemTools::FileExists(m_ConfigurationScript.c_str()))
+ int res = 0;
+ cmCTest::tm_VectorOfStrings::iterator it;
+ for ( it = m_ConfigurationScripts.begin();
+ it != m_ConfigurationScripts.end();
+ it ++ )
{
+ res += this->RunConfigurationScript(
+ cmSystemTools::CollapseFullPath(it->c_str()));
+ }
+ return res;
+}
+
+int cmCTest::RunConfigurationScript(const std::string& script)
+{
+ // make sure the file exists
+ if (!cmSystemTools::FileExists(script.c_str()))
+ {
+ std::cerr << "Cannot find file: " << script.c_str() << std::endl;
return 1;
}
+
// create a cmake instance to read the configuration script
cmake cm;
cmGlobalGenerator gg;
@@ -3165,11 +3191,11 @@ int cmCTest::RunConfigurationScript()
// set a variable with the path to the current script
lg->GetMakefile()->AddDefinition("CTEST_SCRIPT_DIRECTORY",
cmSystemTools::GetFilenamePath(
- m_ConfigurationScript).c_str());
+ script).c_str());
lg->GetMakefile()->AddDefinition("CTEST_SCRIPT_NAME",
cmSystemTools::GetFilenameName(
- m_ConfigurationScript).c_str());
- if (!lg->GetMakefile()->ReadListFile(0, m_ConfigurationScript.c_str()))
+ script).c_str());
+ if (!lg->GetMakefile()->ReadListFile(0, script.c_str()))
{
return 2;
}
@@ -3693,7 +3719,7 @@ int cmCTest::Run(std::vectorconst& args, std::string* output)
{
this->m_RunConfigurationScript = true;
i++;
- this->m_ConfigurationScript = args[i];
+ this->m_ConfigurationScripts.push_back(args[i]);
}
if( arg.find("-D",0) == 0 && i < args.size() - 1 )
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index c9d15d286..fbdde44b8 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -35,6 +35,7 @@ public:
* Run a dashboard using a specified confiuration script
*/
int RunConfigurationScript();
+ int RunConfigurationScript(const std::string& script);
/**
* Initialize and finalize testing
@@ -140,7 +141,7 @@ public:
bool m_ShowOnly;
bool m_RunConfigurationScript;
- std::string m_ConfigurationScript;
+ tm_VectorOfStrings m_ConfigurationScripts;
enum {
EXPERIMENTAL,