mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge branch 'develop' of github.com:ethereum/cpp-ethereum into develop
This commit is contained in:
commit
684aafdbd1
@ -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;
|
||||
@ -431,6 +432,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
|
||||
@ -462,6 +466,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)
|
||||
@ -535,10 +540,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")
|
||||
@ -586,6 +593,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)
|
||||
|
@ -164,7 +164,7 @@ public:
|
||||
bool vmtrace = false; ///< Create EVM execution tracer // TODO: Link with log verbosity?
|
||||
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
|
||||
std::string statsOutFile; ///< Stats output file. "out" for standard output
|
||||
|
||||
/// Test selection
|
||||
/// @{
|
||||
@ -191,10 +191,12 @@ class Listener
|
||||
public:
|
||||
virtual ~Listener() = default;
|
||||
|
||||
virtual void suiteStarted(std::string const&) {}
|
||||
virtual void testStarted(std::string const& _name) = 0;
|
||||
virtual void testFinished() = 0;
|
||||
|
||||
static void registerListener(Listener& _listener);
|
||||
static void notifySuiteStarted(std::string const& _name);
|
||||
static void notifyTestStarted(std::string const& _name);
|
||||
static void notifyTestFinished();
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <libethereum/Defaults.h>
|
||||
#include <libevm/VM.h>
|
||||
#include "TestHelper.h"
|
||||
#include "Stats.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
@ -42,9 +41,6 @@ namespace dev { namespace test {
|
||||
|
||||
void doStateTests(json_spirit::mValue& v, bool _fillin)
|
||||
{
|
||||
if (Options::get().stats)
|
||||
Listener::registerListener(Stats::get());
|
||||
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
std::cout << " " << i.first << "\n";
|
||||
@ -254,6 +250,7 @@ BOOST_AUTO_TEST_CASE(stRandom)
|
||||
string s = asString(dev::contents(path.string()));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + path.string() + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?");
|
||||
json_spirit::read_string(s, v);
|
||||
test::Listener::notifySuiteStarted(path.filename().string());
|
||||
dev::test::doStateTests(v, false);
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
|
5
vm.cpp
5
vm.cpp
@ -25,7 +25,6 @@
|
||||
#include <libethereum/Executive.h>
|
||||
#include <libevm/VMFactory.h>
|
||||
#include "vm.h"
|
||||
#include "Stats.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace json_spirit;
|
||||
@ -311,9 +310,6 @@ namespace dev { namespace test {
|
||||
|
||||
void doVMTests(json_spirit::mValue& v, bool _fillin)
|
||||
{
|
||||
if (Options::get().stats)
|
||||
Listener::registerListener(Stats::get());
|
||||
|
||||
for (auto& i: v.get_obj())
|
||||
{
|
||||
std::cout << " " << i.first << "\n";
|
||||
@ -549,6 +545,7 @@ BOOST_AUTO_TEST_CASE(vmRandom)
|
||||
string s = asString(dev::contents(path.string()));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content of " + path.string() + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?");
|
||||
json_spirit::read_string(s, v);
|
||||
test::Listener::notifySuiteStarted(path.filename().string());
|
||||
doVMTests(v, false);
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
|
@ -62,6 +62,16 @@ class WebThreeStubClient : public jsonrpc::Client
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_protocolVersion() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
p = Json::nullValue;
|
||||
Json::Value result = this->CallMethod("eth_protocolVersion",p);
|
||||
if (result.isString())
|
||||
return result.asString();
|
||||
else
|
||||
throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString());
|
||||
}
|
||||
std::string eth_coinbase() throw (jsonrpc::JsonRpcException)
|
||||
{
|
||||
Json::Value p;
|
||||
|
Loading…
Reference in New Issue
Block a user