BUG: CVS update fix. If the CVS command was not set there was no indication that something went wrong. Now it will make sure it does. Also start working on multiple configuration scripts

This commit is contained in:
Andy Cedilnik 2004-02-24 10:05:12 -05:00
parent c6c1f70012
commit 3c832dd1b8
2 changed files with 264 additions and 237 deletions

View File

@ -673,11 +673,17 @@ int cmCTest::UpdateDirectory()
os << "\t<StartDateTime>" << start_time << "</StartDateTime>\n"
<< "\t<UpdateCommand>" << command << "</UpdateCommand>\n"
<< "\t<UpdateReturnStatus>";
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 << "</UpdateReturnStatus>" << std::endl;
if ( !failed )
{
std::vector<cmStdString> lines;
cmSystemTools::Split(goutput.c_str(), lines);
@ -923,6 +929,7 @@ int cmCTest::UpdateDirectory()
{
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;
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,6 +1460,8 @@ int cmCTest::CoverageDirectory()
// {
// std::cout << "File: " << files[cc] << std::endl;
// }
if ( missing_files.size() > 0 )
{
std::cout << "---------------------------------------------------------------" << std::endl;
std::cout << "The following files were missing:" << std::endl;
for ( cc = 0; cc < missing_files.size(); cc ++ )
@ -1457,6 +1469,7 @@ int cmCTest::CoverageDirectory()
std::cout << "File: " << missing_files[cc] << std::endl;
}
std::cout << "---------------------------------------------------------------" << std::endl;
}
std::map<std::string, cmCTest::tm_VectorOfStrings >::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::vector<std::string>const& 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 )

View File

@ -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,