Do not exit if stoptime is passed.

This commit is contained in:
Zach Mullen 2010-06-15 10:29:35 -04:00
parent d714b18ac5
commit 960dc2b10f
5 changed files with 32 additions and 6 deletions

View File

@ -23,6 +23,7 @@ cmCTestMultiProcessHandler::cmCTestMultiProcessHandler()
this->ParallelLevel = 1;
this->Completed = 0;
this->RunningCount = 0;
this->StopTimePassed = false;
}
cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler()
@ -69,6 +70,10 @@ void cmCTestMultiProcessHandler::RunTests()
this->StartNextTests();
while(this->Tests.size() != 0)
{
if(this->StopTimePassed)
{
return;
}
this->CheckOutput();
this->StartNextTests();
}
@ -102,6 +107,12 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
{
this->RunningTests.insert(testRun);
}
else if(testRun->IsStopTimePassed())
{
this->StopTimePassed = true;
delete testRun;
return;
}
else
{
this->UnlockResources(test);
@ -251,6 +262,10 @@ void cmCTestMultiProcessHandler::StartNextTests()
}
if(this->StartTest(*test))
{
if(this->StopTimePassed)
{
return;
}
numToStart -= processors;
this->RunningCount += processors;
}

View File

@ -94,6 +94,7 @@ protected:
//Number of tests that are complete
size_t Completed;
size_t RunningCount;
bool StopTimePassed;
//list of test properties (indices concurrent to the test map)
PropertiesMap Properties;
std::map<int, bool> TestRunningMap;

View File

@ -32,6 +32,7 @@ cmCTestRunTest::cmCTestRunTest(cmCTestTestHandler* handler)
this->ProcessOutput = "";
this->CompressedOutput = "";
this->CompressionRatio = 2;
this->StopTimePassed = false;
}
cmCTestRunTest::~cmCTestRunTest()
@ -436,8 +437,13 @@ bool cmCTestRunTest::StartTest(size_t total)
}
this->StartTime = this->CTest->CurrentTime();
return this->ForkProcess(this->ResolveTimeout(),
&this->TestProperties->Environment);
double timeout = this->ResolveTimeout();
if(this->StopTimePassed)
{
return false;
}
return this->ForkProcess(timeout, &this->TestProperties->Environment);
}
//----------------------------------------------------------------------
@ -569,8 +575,9 @@ double cmCTestRunTest::ResolveTimeout()
if(stop_timeout <= 0 || stop_timeout > this->CTest->LastStopTimeout)
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "The stop time has been passed. "
"Exiting ctest." << std::endl);
exit(-1);
"Stopping all tests." << std::endl);
this->StopTimePassed = true;
return 0;
}
return timeout == 0 ? stop_timeout :
(timeout < stop_timeout ? timeout : stop_timeout);

View File

@ -39,6 +39,8 @@ public:
std::string GetProcessOutput() { return this->ProcessOutput; }
bool IsStopTimePassed() { return this->StopTimePassed; }
cmCTestTestHandler::cmCTestTestResult GetTestResults()
{ return this->TestResult; }
@ -90,6 +92,7 @@ private:
std::string TestCommand;
std::string ActualCommand;
std::vector<std::string> Arguments;
bool StopTimePassed;
};
inline int getNumWidth(size_t n)

View File

@ -1036,9 +1036,9 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
bool randomSchedule = this->CTest->GetScheduleType() == "Random";
if(randomSchedule)
{
{
srand((unsigned)time(0));
}
}
for (ListOfTests::iterator it = this->TestList.begin();
it != this->TestList.end(); ++it)