From 53f68a155f071194fd779352d5997c03a6c387ed Mon Sep 17 00:00:00 2001 From: chriseth Date: Sat, 6 Aug 2016 11:55:37 +0200 Subject: Exponential sleep increase on mining failure. --- test/RPCSession.cpp | 8 ++++++-- test/TestHelper.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp index 8ed9e9ac..43ad26e1 100644 --- a/test/RPCSession.cpp +++ b/test/RPCSession.cpp @@ -245,11 +245,15 @@ void RPCSession::test_mineBlocks(int _number) rpcCall("test_mineBlocks", { to_string(_number) }, true); //@TODO do not use polling - but that would probably need a change to the test client - for (size_t polls = 0; polls < 100; ++polls) + unsigned sleepTime = 10; + for (size_t polls = 0; polls < 10; ++polls) { if (fromBigEndian(fromHex(rpcCall("eth_blockNumber").asString())) >= startBlock + _number) return; - std::this_thread::sleep_for(chrono::milliseconds(10)); //it does not work faster then 10 ms + std::this_thread::sleep_for(chrono::milliseconds(sleepTime)); + if (sleepTime > 500) + cout << "Mining timeout, sleeping for " << sleepTime << " ms" << endl; + sleepTime *= 2; } BOOST_FAIL("Error in test_mineBlocks: block mining timeout!"); diff --git a/test/TestHelper.h b/test/TestHelper.h index beb081cd..2cb24fd7 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -107,7 +107,7 @@ struct Options: boost::noncopyable { std::string ipcPath; - Options const& get(); + static Options const& get(); private: Options(); -- cgit