updated testingoptions for continuous dashboards

This commit is contained in:
Ken Martin 2004-05-07 10:50:11 -04:00
parent 4b74d4c0a9
commit 840339e2ed
2 changed files with 56 additions and 5 deletions

View File

@ -3530,12 +3530,9 @@ int cmCTest::RunConfigurationScript(const std::string& total_script_arg)
const char *srcDir = mf->GetDefinition("CTEST_SOURCE_DIRECTORY"); const char *srcDir = mf->GetDefinition("CTEST_SOURCE_DIRECTORY");
const char *binDir = mf->GetDefinition("CTEST_BINARY_DIRECTORY"); const char *binDir = mf->GetDefinition("CTEST_BINARY_DIRECTORY");
const char *ctestCmd = mf->GetDefinition("CTEST_COMMAND"); const char *ctestCmd = mf->GetDefinition("CTEST_COMMAND");
const char *ctestEnv = mf->GetDefinition("CTEST_ENVIRONMENT");
const char *ctestRoot = mf->GetDefinition("CTEST_DASHBOARD_ROOT");
bool backup = mf->IsOn("CTEST_BACKUP_AND_RESTORE"); bool backup = mf->IsOn("CTEST_BACKUP_AND_RESTORE");
// in order to back we also must have the cvs root // in order to back we also must have the cvs root
const char *cvsCmd = mf->GetDefinition("CTEST_CVS_COMMAND");
const char *cvsCheckOut = mf->GetDefinition("CTEST_CVS_CHECKOUT"); const char *cvsCheckOut = mf->GetDefinition("CTEST_CVS_CHECKOUT");
if (backup && !cvsCheckOut) if (backup && !cvsCheckOut)
{ {
@ -3551,6 +3548,7 @@ int cmCTest::RunConfigurationScript(const std::string& total_script_arg)
} }
// set any environment variables // set any environment variables
const char *ctestEnv = mf->GetDefinition("CTEST_ENVIRONMENT");
if (ctestEnv) if (ctestEnv)
{ {
std::vector<std::string> envArgs; std::vector<std::string> envArgs;
@ -3562,6 +3560,55 @@ int cmCTest::RunConfigurationScript(const std::string& total_script_arg)
} }
} }
// 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
// for a continuous
if (mf->GetDefinition("CTEST_CONTINUOUS_DURATION"))
{
// the *60 is becuase the settings are in minutes but GetTime is seconds
double minimumInterval = 30*60;
if (mf->GetDefinition("CTEST_CONTINUOUS_MINIMUM_INTERVAL"))
{
minimumInterval =
60*atof(mf->GetDefinition("CTEST_CONTINUOUS_MINIMUM_INTERVAL"));
}
double duration = 60.0*atof(mf->GetDefinition("CTEST_CONTINUOUS_DURATION"));
double clock_start = cmSystemTools::GetTime();
while (cmSystemTools::GetTime() < clock_start + duration)
{
double clock_recent_start = cmSystemTools::GetTime();
this->RunConfigurationDashboard(mf, srcDir, binDir, backup,
cvsCheckOut, ctestCmd);
double interval = cmSystemTools::GetTime() - clock_recent_start;
if (interval < minimumInterval)
{
unsigned int secondsToWait =
static_cast<unsigned int>(minimumInterval - interval);
#if defined(_WIN32)
Sleep(1000*secondsToWait);
#else
sleep(secondsToWait);
#endif
}
}
}
// otherwise just run it once
else
{
return this->RunConfigurationDashboard(mf, srcDir, binDir,
backup, cvsCheckOut, ctestCmd);
}
return 0;
}
int cmCTest::RunConfigurationDashboard(cmMakefile *mf,
const char *srcDir, const char *binDir,
bool backup, const char *cvsCheckOut,
const char *ctestCmd)
{
const char *ctestRoot = mf->GetDefinition("CTEST_DASHBOARD_ROOT");
const char *cvsCmd = mf->GetDefinition("CTEST_CVS_COMMAND");
// local variables // local variables
std::string command; std::string command;
std::string output; std::string output;
@ -3598,8 +3645,8 @@ int cmCTest::RunConfigurationScript(const std::string& total_script_arg)
std::cerr << "Run cvs: " << cvsCheckOut << std::endl; std::cerr << "Run cvs: " << cvsCheckOut << std::endl;
} }
res = cmSystemTools::RunSingleCommand(cvsCheckOut, &output, res = cmSystemTools::RunSingleCommand(cvsCheckOut, &output,
&retVal, ctestRoot, &retVal, ctestRoot,
m_Verbose, 0 /*m_TimeOut*/); m_Verbose, 0 /*m_TimeOut*/);
if (!res || retVal != 0) if (!res || retVal != 0)
{ {
cmSystemTools::Error("Unable to perform cvs checkout "); cmSystemTools::Error("Unable to perform cvs checkout ");

View File

@ -38,6 +38,10 @@ public:
*/ */
int RunConfigurationScript(); int RunConfigurationScript();
int RunConfigurationScript(const std::string& script); int RunConfigurationScript(const std::string& script);
int RunConfigurationDashboard(cmMakefile *mf,
const char *srcDir, const char *binDir,
bool backup, const char *cvsCheckOut,
const char *ctestCmd);
/** /**
* Initialize and finalize testing * Initialize and finalize testing