diff options
author | Gav Wood <g@ethdev.com> | 2015-03-16 16:46:01 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2015-03-16 16:46:01 +0800 |
commit | 818a8b59af6d7bbf6daedc44a2a1e533e8ec5e6b (patch) | |
tree | b87e5266728ec340e6b66609ed3e8e8a61c01a11 /TestHelper.h | |
parent | d66e8373d524de3ffc41b853efcd88cabfc9f494 (diff) | |
parent | 3782a33e5004df06714648b5462d3d1960ed9de0 (diff) | |
download | dexon-solidity-818a8b59af6d7bbf6daedc44a2a1e533e8ec5e6b.tar dexon-solidity-818a8b59af6d7bbf6daedc44a2a1e533e8ec5e6b.tar.gz dexon-solidity-818a8b59af6d7bbf6daedc44a2a1e533e8ec5e6b.tar.bz2 dexon-solidity-818a8b59af6d7bbf6daedc44a2a1e533e8ec5e6b.tar.lz dexon-solidity-818a8b59af6d7bbf6daedc44a2a1e533e8ec5e6b.tar.xz dexon-solidity-818a8b59af6d7bbf6daedc44a2a1e533e8ec5e6b.tar.zst dexon-solidity-818a8b59af6d7bbf6daedc44a2a1e533e8ec5e6b.zip |
Merge pull request #1312 from imapp-pl/feature/testeth_stats
Stats for testeth + bonus
Diffstat (limited to 'TestHelper.h')
-rw-r--r-- | TestHelper.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/TestHelper.h b/TestHelper.h index 9efed0fa..ade20f5e 100644 --- a/TestHelper.h +++ b/TestHelper.h @@ -162,8 +162,9 @@ class Options public: bool jit = false; ///< Use JIT bool vmtrace = false; ///< Create EVM execution tracer // TODO: Link with log verbosity? - bool showTimes = false; ///< Print test groups execution times bool fillTests = false; ///< Create JSON test files from execution results + bool stats = false; ///< Execution time stats + bool statsFull = false; ///< Output full stats - execution times for every test /// Test selection /// @{ @@ -183,5 +184,32 @@ private: Options(Options const&) = delete; }; +/// Allows observing test execution process. +/// This class also provides methods for registering and notifying the listener +class Listener +{ +public: + virtual ~Listener() = default; + + virtual void testStarted(std::string const& _name) = 0; + virtual void testFinished() = 0; + + static void registerListener(Listener& _listener); + static void notifyTestStarted(std::string const& _name); + static void notifyTestFinished(); + + /// Test started/finished notification RAII helper + class ExecTimeGuard + { + public: + ExecTimeGuard(std::string const& _testName) { notifyTestStarted(_testName); } + ~ExecTimeGuard() { notifyTestFinished(); } + ExecTimeGuard(ExecTimeGuard const&) = delete; + ExecTimeGuard& operator=(ExecTimeGuard) = delete; + }; +}; + + + } } |