diff options
author | Wouter Klouwen <wouter.klouwen@youview.com> | 2017-11-20 20:55:13 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-12-04 15:43:14 (GMT) |
commit | 66419bc04620c5748df77e2b563d65b0e97b623a (patch) | |
tree | 0c6e38ba923c4eb95c3d5d829c83a849d58eb52a /Source/cmCTest.h | |
parent | 923b8fadd5fe6af56197cf3916a3292b60c0e8db (diff) | |
download | CMake-66419bc04620c5748df77e2b563d65b0e97b623a.zip CMake-66419bc04620c5748df77e2b563d65b0e97b623a.tar.gz CMake-66419bc04620c5748df77e2b563d65b0e97b623a.tar.bz2 |
CTest: convert timeouts to std::chrono::duration
This commit continues the refactoring of CTest to adopt std::chrono.
After the last sets of changes that introduced std::chrono::steady_clock
and std::chrono::system_clock respectively, it makes sense to have all
the timeouts be stored as std::chrono::duration.
No functional change intended.
Diffstat (limited to 'Source/cmCTest.h')
-rw-r--r-- | Source/cmCTest.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/Source/cmCTest.h b/Source/cmCTest.h index a2d6fc3..ba94866 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -7,6 +7,7 @@ #include "cmProcessOutput.h" #include "cmsys/String.hxx" +#include <chrono> #include <map> #include <set> #include <sstream> @@ -139,10 +140,13 @@ public: /** what is the configuraiton type, e.g. Debug, Release etc. */ std::string const& GetConfigType(); - double GetTimeOut() { return this->TimeOut; } - void SetTimeOut(double t) { this->TimeOut = t; } + std::chrono::duration<double> GetTimeOut() { return this->TimeOut; } + void SetTimeOut(std::chrono::duration<double> t) { this->TimeOut = t; } - double GetGlobalTimeout() { return this->GlobalTimeout; } + std::chrono::duration<double> GetGlobalTimeout() + { + return this->GlobalTimeout; + } /** how many test to run at the same time */ int GetParallelLevel() { return this->ParallelLevel; } @@ -200,9 +204,9 @@ public: /** * Return the time remaining that the script is allowed to run in * seconds if the user has set the variable CTEST_TIME_LIMIT. If that has - * not been set it returns 1e7 seconds + * not been set it returns a very large duration. */ - double GetRemainingTimeAllowed(); + std::chrono::duration<double> GetRemainingTimeAllowed(); /** * Open file in the output directory and set the stream @@ -248,7 +252,9 @@ public: */ bool RunCommand(std::vector<std::string> const& args, std::string* stdOut, std::string* stdErr, int* retVal = nullptr, - const char* dir = nullptr, double timeout = 0.0, + const char* dir = nullptr, + std::chrono::duration<double> timeout = + std::chrono::duration<double>::zero(), Encoding encoding = cmProcessOutput::Auto); /** @@ -268,7 +274,8 @@ public: * and retVal is return value or exception. */ int RunMakeCommand(const char* command, std::string& output, int* retVal, - const char* dir, int timeout, std::ostream& ofs, + const char* dir, std::chrono::duration<double> timeout, + std::ostream& ofs, Encoding encoding = cmProcessOutput::Auto); /** Return the current tag */ @@ -315,7 +322,7 @@ public: * environment variables are restored to their previous values. */ int RunTest(std::vector<const char*> args, std::string* output, int* retVal, - std::ostream* logfile, double testTimeOut, + std::ostream* logfile, std::chrono::duration<double> testTimeOut, std::vector<std::string>* environment, Encoding encoding = cmProcessOutput::Auto); @@ -503,11 +510,11 @@ private: int TestModel; std::string SpecificTrack; - double TimeOut; + std::chrono::duration<double> TimeOut; - double GlobalTimeout; + std::chrono::duration<double> GlobalTimeout; - int LastStopTimeout; + std::chrono::duration<double> LastStopTimeout; int MaxTestNameWidth; |