From a52c0118d454ea9ec93a05be8be552d587467813 Mon Sep 17 00:00:00 2001 From: Zach Mullen Date: Mon, 30 Nov 2009 16:08:11 -0500 Subject: 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. --- Source/CTest/cmCTestTestHandler.cxx | 5 +++++ Source/cmCTest.cxx | 9 ++++++++- Source/cmCTest.h | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index f6dede8..4437c56 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1052,6 +1052,11 @@ void cmCTestTestHandler::ProcessDirectory(std::vector &passed, p.Cost = rand(); } + if(p.Timeout == 0 && this->CTest->GetGlobalTimeout() != 0) + { + p.Timeout = this->CTest->GetGlobalTimeout(); + } + if(p.Depends.size()) { for(std::vector::iterator i = p.Depends.begin(); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 59003be..ee249b2 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -224,6 +224,7 @@ cmCTest::cmCTest() this->MaxTestNameWidth = 30; this->InteractiveDebugMode = true; this->TimeOut = 0; + this->GlobalTimeout = 0; this->CompressXMLFiles = false; this->CTestConfigFile = ""; this->ScheduleType = ""; @@ -1702,6 +1703,13 @@ void cmCTest::HandleCommandLineArguments(size_t &i, int plevel = atoi(arg.substr(2).c_str()); 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") && i < args.size() - 1) @@ -2760,4 +2768,3 @@ void cmCTest::OutputTestErrors(std::vector const &process_output) } cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush); } - diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 210a61b..299dbc8 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -129,6 +129,9 @@ public: std::string const& GetConfigType(); double GetTimeOut() { return this->TimeOut; } void SetTimeOut(double t) { this->TimeOut = t; } + + double GetGlobalTimeout() { return this->GlobalTimeout; } + // how many test to run at the same time int GetParallelLevel() { return this->ParallelLevel; } void SetParallelLevel(int); @@ -419,6 +422,8 @@ private: double TimeOut; + double GlobalTimeout; + int MaxTestNameWidth; int ParallelLevel; -- cgit v0.12