ctest -S support for multiple ctest command arguments
This commit is contained in:
parent
42bc978b5b
commit
27deb152b6
@ -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,20 +3651,23 @@ 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 =
|
||||||
backup, cvsCheckOut, ctestCmd);
|
this->RunConfigurationDashboard(mf, srcDir, binDir, ctestRoot,
|
||||||
|
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
|
||||||
std::string command;
|
std::string command;
|
||||||
std::string output;
|
std::string output;
|
||||||
@ -3844,38 +3863,44 @@ int cmCTest::RunConfigurationDashboard(cmMakefile *mf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// run ctest
|
// run cteste may be more than one command in here
|
||||||
command = ctestCmd;
|
std::vector<std::string> ctestCommands;
|
||||||
output = "";
|
cmSystemTools::ExpandListArgument(ctestCmd,ctestCommands);
|
||||||
retVal = 0;
|
// for each variable/argument do a putenv
|
||||||
if ( m_Verbose )
|
for (unsigned i = 0; i < ctestCommands.size(); ++i)
|
||||||
{
|
{
|
||||||
std::cerr << "Run ctest command: " << command.c_str() << std::endl;
|
command = ctestCommands[i];
|
||||||
}
|
output = "";
|
||||||
res = cmSystemTools::RunSingleCommand(command.c_str(), &output,
|
retVal = 0;
|
||||||
&retVal, binDir,
|
if ( m_Verbose )
|
||||||
m_Verbose, 0 /*m_TimeOut*/);
|
|
||||||
|
|
||||||
// did something critical fail in ctest
|
|
||||||
if (!res || cmakeFailed ||
|
|
||||||
retVal & CTEST_BUILD_ERRORS)
|
|
||||||
{
|
|
||||||
this->RestoreBackupDirectories(backup, srcDir, binDir,
|
|
||||||
backupSrcDir.c_str(),
|
|
||||||
backupBinDir.c_str());
|
|
||||||
if (cmakeFailed)
|
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Unable to run cmake");
|
std::cerr << "Run ctest command: " << command.c_str() << std::endl;
|
||||||
return 10;
|
|
||||||
}
|
}
|
||||||
cmSystemTools::Error("Unable to run ctest");
|
res = cmSystemTools::RunSingleCommand(command.c_str(), &output,
|
||||||
if (!res)
|
&retVal, binDir,
|
||||||
{
|
m_Verbose, 0 /*m_TimeOut*/);
|
||||||
return 11;
|
|
||||||
}
|
|
||||||
return retVal * 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// did something critical fail in ctest
|
||||||
|
if (!res || cmakeFailed ||
|
||||||
|
retVal & CTEST_BUILD_ERRORS)
|
||||||
|
{
|
||||||
|
this->RestoreBackupDirectories(backup, srcDir, binDir,
|
||||||
|
backupSrcDir.c_str(),
|
||||||
|
backupBinDir.c_str());
|
||||||
|
if (cmakeFailed)
|
||||||
|
{
|
||||||
|
cmSystemTools::Error("Unable to run cmake");
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
cmSystemTools::Error("Unable to run ctest");
|
||||||
|
if (!res)
|
||||||
|
{
|
||||||
|
return 11;
|
||||||
|
}
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user