Commit a175613a authored by Ken Martin's avatar Ken Martin
Browse files

BUG: better passing of global TIMEOUT to internal ctest invocaitons

parent 80de27ac
......@@ -218,8 +218,8 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
{
this->BuildTargets.push_back("");
}
for ( tarIt = this->BuildTargets.begin(); tarIt != this->BuildTargets.end();
++ tarIt )
for ( tarIt = this->BuildTargets.begin();
tarIt != this->BuildTargets.end(); ++ tarIt )
{
double remainingTime = 0;
if (this->Timeout)
......@@ -332,19 +332,19 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
out << "\n";
// how much time is remaining
double remainingTime = 0;
if (this->Timeout)
double remainingTime = 0;
if (this->Timeout)
{
remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
if (remainingTime <= 0)
{
remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
if (remainingTime <= 0)
if(outstring)
{
if(outstring)
{
*outstring = "--build-and-test timeout exceeded. ";
}
return 1;
*outstring = "--build-and-test timeout exceeded. ";
}
return 1;
}
}
int runTestRes = this->CTest->RunTest(testCommand, &outs, &retval, 0,
remainingTime);
......
......@@ -1083,12 +1083,28 @@ int cmCTest::RunTest(std::vector<const char*> argv,
std::string* output, int *retVal,
std::ostream* log, double testTimeOut)
{
// determine how much time we have
double timeout = this->GetRemainingTimeAllowed() - 120;
if (this->TimeOut && this->TimeOut < timeout)
{
timeout = this->TimeOut;
}
if (testTimeOut && testTimeOut < timeout)
{
timeout = testTimeOut;
}
// always have at least 1 second if we got to here
if (timeout <= 0)
{
timeout = 1;
}
if(cmSystemTools::SameFile(argv[0], this->CTestSelf.c_str()) &&
!this->ForceNewCTestProcess)
{
cmCTest inst;
inst.ConfigType = this->ConfigType;
inst.TimeOut = this->TimeOut;
inst.TimeOut = timeout;
std::vector<std::string> args;
for(unsigned int i =0; i < argv.size(); ++i)
{
......@@ -1101,7 +1117,7 @@ int cmCTest::RunTest(std::vector<const char*> argv,
{
args.push_back("--test-timeout");
cmOStringStream msg;
msg << testTimeOut;
msg << timeout;
args.push_back(msg.str());
}
args.push_back(argv[i]);
......@@ -1139,22 +1155,6 @@ int cmCTest::RunTest(std::vector<const char*> argv,
cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1);
}
// do we have time for
double timeout = this->GetRemainingTimeAllowed() - 120;
if (this->TimeOut && this->TimeOut < timeout)
{
timeout = this->TimeOut;
}
if (testTimeOut && testTimeOut < timeout)
{
timeout = testTimeOut;
}
// always have at least 1 second if we got to here
if (timeout <= 0)
{
timeout = 1;
}
cmsysProcess_SetTimeout(cp, timeout);
cmsysProcess_Execute(cp);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment