BUG: better passing of global TIMEOUT to internal ctest invocaitons

This commit is contained in:
Ken Martin 2007-06-06 11:02:24 -04:00
parent 80de27ace5
commit a175613a56
2 changed files with 29 additions and 29 deletions

View File

@ -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);

View File

@ -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);