ctest -S support for multiple ctest command arguments

This commit is contained in:
Ken Martin 2004-05-28 15:02:16 -04:00
parent 42bc978b5b
commit 27deb152b6
2 changed files with 61 additions and 35 deletions

View File

@ -3592,9 +3592,24 @@ int cmCTest::RunConfigurationScript(const std::string& total_script_arg)
} }
} }
// if the dashboard root isn't specified then we can compute it from the
// srcDir
char *ctestRoot;
if (mf->GetDefinition("CTEST_DASHBOARD_ROOT"))
{
ctestRoot = new char [strlen(mf->GetDefinition("CTEST_DASHBOARD_ROOT"))+1];
strcpy(ctestRoot,mf->GetDefinition("CTEST_DASHBOARD_ROOT"));
}
else
{
ctestRoot = new char [cmSystemTools::GetFilenamePath(srcDir).size()+1];
strcpy(ctestRoot,cmSystemTools::GetFilenamePath(srcDir).c_str());
}
// now that we have done most of the error checking finally run the // now that we have done most of the error checking finally run the
// dashboard, we may be asked to repeatedly run this dashboard, such as // dashboard, we may be asked to repeatedly run this dashboard, such as
// for a continuous // for a continuous
int returnValue = 0;
if (mf->GetDefinition("CTEST_CONTINUOUS_DURATION")) if (mf->GetDefinition("CTEST_CONTINUOUS_DURATION"))
{ {
// the *60 is becuase the settings are in minutes but GetTime is seconds // the *60 is becuase the settings are in minutes but GetTime is seconds
@ -3613,8 +3628,9 @@ int cmCTest::RunConfigurationScript(const std::string& total_script_arg)
while (cmSystemTools::GetTime() < clock_start + duration) while (cmSystemTools::GetTime() < clock_start + duration)
{ {
double clock_recent_start = cmSystemTools::GetTime(); double clock_recent_start = cmSystemTools::GetTime();
this->RunConfigurationDashboard(mf, srcDir, binDir, backup, returnValue =
cvsCheckOut, ctestCmd); this->RunConfigurationDashboard(mf, srcDir, binDir, ctestRoot,
backup, cvsCheckOut, ctestCmd);
double interval = cmSystemTools::GetTime() - clock_recent_start; double interval = cmSystemTools::GetTime() - clock_recent_start;
if (interval < minimumInterval) if (interval < minimumInterval)
{ {
@ -3635,18 +3651,21 @@ int cmCTest::RunConfigurationScript(const std::string& total_script_arg)
// otherwise just run it once // otherwise just run it once
else else
{ {
return this->RunConfigurationDashboard(mf, srcDir, binDir, returnValue =
this->RunConfigurationDashboard(mf, srcDir, binDir, ctestRoot,
backup, cvsCheckOut, ctestCmd); backup, cvsCheckOut, ctestCmd);
} }
return 0;
delete [] ctestRoot;
return returnValue;
} }
int cmCTest::RunConfigurationDashboard(cmMakefile *mf, int cmCTest::RunConfigurationDashboard(cmMakefile *mf,
const char *srcDir, const char *binDir, const char *srcDir, const char *binDir,
const char *ctestRoot,
bool backup, const char *cvsCheckOut, bool backup, const char *cvsCheckOut,
const char *ctestCmd) const char *ctestCmd)
{ {
const char *ctestRoot = mf->GetDefinition("CTEST_DASHBOARD_ROOT");
const char *cvsCmd = mf->GetDefinition("CTEST_CVS_COMMAND"); const char *cvsCmd = mf->GetDefinition("CTEST_CVS_COMMAND");
// local variables // local variables
@ -3844,8 +3863,13 @@ int cmCTest::RunConfigurationDashboard(cmMakefile *mf,
} }
} }
// run ctest // run cteste may be more than one command in here
command = ctestCmd; std::vector<std::string> ctestCommands;
cmSystemTools::ExpandListArgument(ctestCmd,ctestCommands);
// for each variable/argument do a putenv
for (unsigned i = 0; i < ctestCommands.size(); ++i)
{
command = ctestCommands[i];
output = ""; output = "";
retVal = 0; retVal = 0;
if ( m_Verbose ) if ( m_Verbose )
@ -3875,6 +3899,7 @@ int cmCTest::RunConfigurationDashboard(cmMakefile *mf,
} }
return retVal * 100; return retVal * 100;
} }
}
// if all was succesful, delete the backup dirs to free up disk space // if all was succesful, delete the backup dirs to free up disk space
if (backup) if (backup)

View File

@ -40,6 +40,7 @@ public:
int RunConfigurationScript(const std::string& script); int RunConfigurationScript(const std::string& script);
int RunConfigurationDashboard(cmMakefile *mf, int RunConfigurationDashboard(cmMakefile *mf,
const char *srcDir, const char *binDir, const char *srcDir, const char *binDir,
const char *ctestRoot,
bool backup, const char *cvsCheckOut, bool backup, const char *cvsCheckOut,
const char *ctestCmd); const char *ctestCmd);