diff options
author | Dimitry <winsvega@mail.ru> | 2016-06-16 21:06:53 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-06-29 05:18:55 +0800 |
commit | 27df4b7e7118795a7d915e2eb88ff578b0ddc814 (patch) | |
tree | 82b2b969b95ccf4e1b75a839bfbf539891f27d73 | |
parent | 763faf7b0e56cde9845772de5226c9b6f1a5d80a (diff) | |
download | dexon-solidity-27df4b7e7118795a7d915e2eb88ff578b0ddc814.tar.gz dexon-solidity-27df4b7e7118795a7d915e2eb88ff578b0ddc814.tar.zst dexon-solidity-27df4b7e7118795a7d915e2eb88ff578b0ddc814.zip |
parse command line arguments
ipcPath
-rw-r--r-- | test/libsolidity/SolidityExecutionFramework.cpp | 28 | ||||
-rw-r--r-- | test/libsolidity/SolidityExecutionFramework.h | 7 |
2 files changed, 32 insertions, 3 deletions
diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index 43d36f38..7ea81888 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -20,6 +20,7 @@ * Framework for executing Solidity contracts and testing them against C++ implementation. */ +#include <boost/test/framework.hpp> #include <test/libsolidity/SolidityExecutionFramework.h> @@ -28,12 +29,33 @@ using namespace dev; using namespace dev::solidity; using namespace dev::solidity::test; +ExecutionFramework::boostArg::boostArg() +{ + size_t argc = boost::unit_test::framework::master_test_suite().argc; + char** argv = boost::unit_test::framework::master_test_suite().argv; + for (size_t i = 0; i < argc; i++) + { + string arg = argv[i]; + if (arg == "--ipc" && i+1 < argc) + { + ipcPath = argv[i+1]; + i++; + } + } + if (ipcPath.empty()) + BOOST_FAIL("ERROR: ipcPath not set! (use --ipc <path>)"); +} + +ExecutionFramework::boostArg const& ExecutionFramework::getArgs() +{ + static boostArg boostArgs; + return boostArgs; +} -ExecutionFramework::ExecutionFramework(): - m_rpc(RPCSession::instance("/home/wins/Ethereum/testnet/ethnode1/geth.ipc")), +ExecutionFramework::ExecutionFramework() : + m_rpc(RPCSession::instance(getArgs().ipcPath)), m_sender(m_rpc.account(0)) { - eth::NoProof::init(); if (g_logVerbosity != -1) g_logVerbosity = 0; diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index 42b22c82..d149cda2 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -255,6 +255,13 @@ protected: bool storageEmpty(Address const& _addr); bool addressHasCode(Address const& _addr); + struct boostArg + { + boostArg(); + std::string ipcPath; + }; + + boostArg const& getArgs(); RPCSession& m_rpc; struct LogEntry |