diff options
author | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-25 19:13:44 +0800 |
---|---|---|
committer | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-03-25 19:13:44 +0800 |
commit | f07089ffa390c02a81c1dd057329cd34797d5eec (patch) | |
tree | ddb3ddf0b2c97f6254d3ca9e2495493963697658 /TestHelper.cpp | |
parent | 0b476774a2710169b1956a2a4c85aaf191b22f5c (diff) | |
download | dexon-solidity-f07089ffa390c02a81c1dd057329cd34797d5eec.tar.gz dexon-solidity-f07089ffa390c02a81c1dd057329cd34797d5eec.tar.zst dexon-solidity-f07089ffa390c02a81c1dd057329cd34797d5eec.zip |
Test execution stats improvements
--stats can have optional values:
--stats=out prints all test timings to standard output,
--stats=<filename> prints all test timings to a file in tab-separated format.
Stats are now kept in vector to allow duplicated values.
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r-- | TestHelper.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index b29c5dc3..b3e64f47 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -29,6 +29,7 @@ #include <libethereum/Client.h> #include <liblll/Compiler.h> #include <libevm/VMFactory.h> +#include "Stats.h" using namespace std; using namespace dev::eth; @@ -447,6 +448,9 @@ void executeTests(const string& _name, const string& _testPathAppendix, std::fun string testPath = getTestPath(); testPath += _testPathAppendix; + if (Options::get().stats) + Listener::registerListener(Stats::get()); + if (Options::get().fillTests) { try @@ -478,6 +482,7 @@ void executeTests(const string& _name, const string& _testPathAppendix, std::fun string s = asString(dev::contents(testPath + "/" + _name + ".json")); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + testPath + "/" + _name + ".json is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?"); json_spirit::read_string(s, v); + Listener::notifySuiteStarted(_name); doTests(v, false); } catch (Exception const& _e) @@ -551,10 +556,12 @@ Options::Options() vmtrace = true; else if (arg == "--filltests") fillTests = true; - else if (arg == "--stats") + else if (arg.compare(0, 7, "--stats") == 0) + { stats = true; - else if (arg == "--stats=full") - stats = statsFull = true; + if (arg.size() > 7) + statsOutFile = arg.substr(8); // skip '=' char + } else if (arg == "--performance") performance = true; else if (arg == "--quadratic") @@ -602,6 +609,12 @@ void Listener::registerListener(Listener& _listener) g_listener = &_listener; } +void Listener::notifySuiteStarted(std::string const& _name) +{ + if (g_listener) + g_listener->suiteStarted(_name); +} + void Listener::notifyTestStarted(std::string const& _name) { if (g_listener) |