summaryrefslogtreecommitdiffstats
path: root/Source/cmCTest.cxx
diff options
context:
space:
mode:
authorZach Mullen <zach.mullen@kitware.com>2010-03-16 19:33:55 (GMT)
committerZach Mullen <zach.mullen@kitware.com>2010-03-17 15:04:13 (GMT)
commit0ba9d041174f593509c44f84e0e70fafc6c0edc0 (patch)
treee14112a165cafec052faf1846d97a47acdb612b9 /Source/cmCTest.cxx
parentbd0b37ea3d5733d087b1498a20e2b87d7f537a9f (diff)
downloadCMake-0ba9d041174f593509c44f84e0e70fafc6c0edc0.zip
CMake-0ba9d041174f593509c44f84e0e70fafc6c0edc0.tar.gz
CMake-0ba9d041174f593509c44f84e0e70fafc6c0edc0.tar.bz2
Add the --stop-time argument
Unit test and script hook for STOP_TIME
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r--Source/cmCTest.cxx42
1 files changed, 42 insertions, 0 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index e417e1b..c6a3849 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -314,6 +314,8 @@ cmCTest::cmCTest()
this->CompressXMLFiles = false;
this->CTestConfigFile = "";
this->ScheduleType = "";
+ this->StopTime = "";
+ this->NextDayStopTime = false;
this->OutputLogFile = 0;
this->OutputLogFileLastTag = -1;
this->SuppressUpdatingCTestConfiguration = false;
@@ -1881,6 +1883,12 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
double timeout = (double)atof(args[i].c_str());
this->GlobalTimeout = timeout;
}
+
+ if(this->CheckArgument(arg, "--stop-time") && i < args.size() - 1)
+ {
+ i++;
+ this->SetStopTime(args[i]);
+ }
if(this->CheckArgument(arg, "-C", "--build-config") &&
i < args.size() - 1)
@@ -2335,6 +2343,13 @@ void cmCTest::SetNotesFiles(const char* notes)
}
//----------------------------------------------------------------------
+void cmCTest::SetStopTime(std::string time)
+{
+ this->StopTime = time;
+ this->DetermineNextDayStop();
+}
+
+//----------------------------------------------------------------------
int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf)
{
bool found = false;
@@ -2536,6 +2551,33 @@ void cmCTest::EmptyCTestConfiguration()
}
//----------------------------------------------------------------------
+void cmCTest::DetermineNextDayStop()
+{
+ struct tm* lctime;
+ time_t current_time = time(0);
+ lctime = gmtime(&current_time);
+ int gm_hour = lctime->tm_hour;
+ lctime = localtime(&current_time);
+ int local_hour = lctime->tm_hour;
+
+ int timezone = (local_hour - gm_hour) * 100;
+ char buf[1024];
+ sprintf(buf, "%d%02d%02d %s %+05i",
+ lctime->tm_year + 1900,
+ lctime->tm_mon + 1,
+ lctime->tm_mday,
+ this->StopTime.c_str(),
+ timezone);
+
+ time_t stop_time = curl_getdate(buf, &current_time);
+
+ if(stop_time < current_time)
+ {
+ this->NextDayStopTime = true;
+ }
+}
+
+//----------------------------------------------------------------------
void cmCTest::SetCTestConfiguration(const char *name, const char* value)
{
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "SetCTestConfiguration:"