Added the --timeout option to ctest command line. This sets a global timeout on all tests if no more specific timeout is set on them.

This commit is contained in:
Zach Mullen 2009-11-30 16:08:11 -05:00
parent b21f1eaeae
commit a52c0118d4
3 changed files with 18 additions and 1 deletions

View File

@ -1052,6 +1052,11 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
p.Cost = rand(); p.Cost = rand();
} }
if(p.Timeout == 0 && this->CTest->GetGlobalTimeout() != 0)
{
p.Timeout = this->CTest->GetGlobalTimeout();
}
if(p.Depends.size()) if(p.Depends.size())
{ {
for(std::vector<std::string>::iterator i = p.Depends.begin(); for(std::vector<std::string>::iterator i = p.Depends.begin();

View File

@ -224,6 +224,7 @@ cmCTest::cmCTest()
this->MaxTestNameWidth = 30; this->MaxTestNameWidth = 30;
this->InteractiveDebugMode = true; this->InteractiveDebugMode = true;
this->TimeOut = 0; this->TimeOut = 0;
this->GlobalTimeout = 0;
this->CompressXMLFiles = false; this->CompressXMLFiles = false;
this->CTestConfigFile = ""; this->CTestConfigFile = "";
this->ScheduleType = ""; this->ScheduleType = "";
@ -1702,6 +1703,13 @@ void cmCTest::HandleCommandLineArguments(size_t &i,
int plevel = atoi(arg.substr(2).c_str()); int plevel = atoi(arg.substr(2).c_str());
this->SetParallelLevel(plevel); this->SetParallelLevel(plevel);
} }
if(this->CheckArgument(arg, "--timeout") && i < args.size() - 1)
{
i++;
double timeout = (double)atof(args[i].c_str());
this->GlobalTimeout = timeout;
}
if(this->CheckArgument(arg, "-C", "--build-config") && if(this->CheckArgument(arg, "-C", "--build-config") &&
i < args.size() - 1) i < args.size() - 1)
@ -2760,4 +2768,3 @@ void cmCTest::OutputTestErrors(std::vector<char> const &process_output)
} }
cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush); cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush);
} }

View File

@ -129,6 +129,9 @@ public:
std::string const& GetConfigType(); std::string const& GetConfigType();
double GetTimeOut() { return this->TimeOut; } double GetTimeOut() { return this->TimeOut; }
void SetTimeOut(double t) { this->TimeOut = t; } void SetTimeOut(double t) { this->TimeOut = t; }
double GetGlobalTimeout() { return this->GlobalTimeout; }
// how many test to run at the same time // how many test to run at the same time
int GetParallelLevel() { return this->ParallelLevel; } int GetParallelLevel() { return this->ParallelLevel; }
void SetParallelLevel(int); void SetParallelLevel(int);
@ -419,6 +422,8 @@ private:
double TimeOut; double TimeOut;
double GlobalTimeout;
int MaxTestNameWidth; int MaxTestNameWidth;
int ParallelLevel; int ParallelLevel;