ENH: Add support for future tags

This commit is contained in:
Andy Cedilnik 2004-03-14 12:28:37 -05:00
parent 824b231f42
commit 97360ff4c6
2 changed files with 21 additions and 4 deletions

View File

@ -44,7 +44,7 @@
#define CTEST_TEST_ERRORS 0x08 #define CTEST_TEST_ERRORS 0x08
#define CTEST_MEMORY_ERRORS 0x10 #define CTEST_MEMORY_ERRORS 0x10
static struct tm* GetNightlyTime(std::string str) static struct tm* GetNightlyTime(std::string str, bool tomorrowtag)
{ {
struct tm* lctime; struct tm* lctime;
time_t tctime = time(0); time_t tctime = time(0);
@ -68,6 +68,11 @@ static struct tm* GetNightlyTime(std::string str)
//std::cout << "Pick yesterday" << std::endl; //std::cout << "Pick yesterday" << std::endl;
} }
//std::cout << "nightlySeconds: " << ntime << std::endl; //std::cout << "nightlySeconds: " << ntime << std::endl;
if ( tomorrowtag )
{
std::cout << "Add a day" << std::endl;
ntime += ( 24 * 60 * 60 );
}
lctime = gmtime(&ntime); lctime = gmtime(&ntime);
return lctime; return lctime;
} }
@ -307,6 +312,7 @@ bool TryExecutable(const char *dir, const char *file,
cmCTest::cmCTest() cmCTest::cmCTest()
{ {
m_TomorrowTag = false;
m_BuildNoCMake = false; m_BuildNoCMake = false;
m_BuildNoClean = false; m_BuildNoClean = false;
m_BuildTwoConfig = false; m_BuildTwoConfig = false;
@ -361,6 +367,10 @@ int cmCTest::Initialize()
std::ifstream tfin(tagfile.c_str()); std::ifstream tfin(tagfile.c_str());
std::string tag; std::string tag;
time_t tctime = time(0); time_t tctime = time(0);
if ( m_TomorrowTag )
{
tctime += ( 24 * 60 * 60 );
}
struct tm *lctime = gmtime(&tctime); struct tm *lctime = gmtime(&tctime);
if ( tfin && cmSystemTools::GetLineFromStream(tfin, tag) ) if ( tfin && cmSystemTools::GetLineFromStream(tfin, tag) )
{ {
@ -393,7 +403,8 @@ int cmCTest::Initialize()
//std::cout << "TestModel: " << m_TestModel << std::endl; //std::cout << "TestModel: " << m_TestModel << std::endl;
if ( m_TestModel == cmCTest::NIGHTLY ) if ( m_TestModel == cmCTest::NIGHTLY )
{ {
lctime = ::GetNightlyTime(m_DartConfiguration["NightlyStartTime"]); lctime = ::GetNightlyTime(m_DartConfiguration["NightlyStartTime"],
m_TomorrowTag);
} }
char datestring[100]; char datestring[100];
sprintf(datestring, "%04d%02d%02d-%02d%02d", sprintf(datestring, "%04d%02d%02d-%02d%02d",
@ -618,7 +629,8 @@ int cmCTest::UpdateDirectory()
std::string extra_update_opts; std::string extra_update_opts;
if ( m_TestModel == cmCTest::NIGHTLY ) if ( m_TestModel == cmCTest::NIGHTLY )
{ {
struct tm* t = ::GetNightlyTime(m_DartConfiguration["NightlyStartTime"]); struct tm* t = ::GetNightlyTime(m_DartConfiguration["NightlyStartTime"],
m_TomorrowTag);
char current_time[1024]; char current_time[1024];
sprintf(current_time, "%04d-%02d-%02d %02d:%02d:%02d UTC", sprintf(current_time, "%04d-%02d-%02d %02d:%02d:%02d UTC",
t->tm_year + 1900, t->tm_year + 1900,
@ -3779,6 +3791,10 @@ int cmCTest::Run(std::vector<std::string>const& args, std::string* output)
this->m_ConfigurationScripts.push_back(args[i]); this->m_ConfigurationScripts.push_back(args[i]);
} }
if( arg.find("--tomorrow-tag",0) == 0 )
{
m_TomorrowTag = true;
}
if( arg.find("-D",0) == 0 && i < args.size() - 1 ) if( arg.find("-D",0) == 0 && i < args.size() - 1 )
{ {
this->m_DartMode = true; this->m_DartMode = true;

View File

@ -290,6 +290,7 @@ private:
int m_Tests[LAST_TEST]; int m_Tests[LAST_TEST];
std::string m_CurrentTag; std::string m_CurrentTag;
bool m_TomorrowTag;
std::string m_StartBuild; std::string m_StartBuild;
std::string m_EndBuild; std::string m_EndBuild;