diff options
author | chriseth <c@ethdev.com> | 2016-06-17 06:19:16 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-06-29 05:18:55 +0800 |
commit | 93c8fc094e601f8d1105a820e64ac6c5fe7298f2 (patch) | |
tree | b4953dd9c9e9c145e30e570623af9ce02320f3aa /test | |
parent | 27df4b7e7118795a7d915e2eb88ff578b0ddc814 (diff) | |
download | dexon-solidity-93c8fc094e601f8d1105a820e64ac6c5fe7298f2.tar.gz dexon-solidity-93c8fc094e601f8d1105a820e64ac6c5fe7298f2.tar.zst dexon-solidity-93c8fc094e601f8d1105a820e64ac6c5fe7298f2.zip |
Parse arguments in free function.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityExecutionFramework.cpp | 21 | ||||
-rw-r--r-- | test/libsolidity/SolidityExecutionFramework.h | 7 |
2 files changed, 10 insertions, 18 deletions
diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index 7ea81888..8c026ffd 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -20,40 +20,39 @@ * Framework for executing Solidity contracts and testing them against C++ implementation. */ +#include <cstdlib> #include <boost/test/framework.hpp> #include <test/libsolidity/SolidityExecutionFramework.h> - using namespace std; using namespace dev; using namespace dev::solidity; using namespace dev::solidity::test; -ExecutionFramework::boostArg::boostArg() +string getIPCSocketPath() { + string ipcPath; + 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) + if (arg == "--ipc" && i + 1 < argc) { - ipcPath = argv[i+1]; + ipcPath = argv[i + 1]; i++; } } if (ipcPath.empty()) + ipcPath = getenv("ETH_TEST_IPC"); + if (ipcPath.empty()) BOOST_FAIL("ERROR: ipcPath not set! (use --ipc <path>)"); -} - -ExecutionFramework::boostArg const& ExecutionFramework::getArgs() -{ - static boostArg boostArgs; - return boostArgs; + return ipcPath; } ExecutionFramework::ExecutionFramework() : - m_rpc(RPCSession::instance(getArgs().ipcPath)), + m_rpc(RPCSession::instance(getIPCSocketPath())), m_sender(m_rpc.account(0)) { if (g_logVerbosity != -1) diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index d149cda2..42b22c82 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -255,13 +255,6 @@ 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 |