diff options
author | chriseth <c@ethdev.com> | 2016-05-30 21:01:37 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-06-29 05:18:54 +0800 |
commit | 5aca97af0d7719dea36f4c33df35966e5e83be11 (patch) | |
tree | f4d44cc26b15b6c0962f9478dd37faabb58f82bf /test | |
parent | 2ccfea8b54699d7ecc4e790aa962d0eed58ed3fc (diff) | |
download | dexon-solidity-5aca97af0d7719dea36f4c33df35966e5e83be11.tar.gz dexon-solidity-5aca97af0d7719dea36f4c33df35966e5e83be11.tar.zst dexon-solidity-5aca97af0d7719dea36f4c33df35966e5e83be11.zip |
Initial poc to test via ipc.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/solidityExecutionFramework.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/libsolidity/solidityExecutionFramework.h b/test/libsolidity/solidityExecutionFramework.h index 3fcbfaed..a2c6d907 100644 --- a/test/libsolidity/solidityExecutionFramework.h +++ b/test/libsolidity/solidityExecutionFramework.h @@ -24,6 +24,7 @@ #include <string> #include <tuple> +#include <fstream> #include "../TestHelper.h" #include <libethcore/ABI.h> #include <libethcore/SealEngine.h> @@ -54,6 +55,33 @@ public: if (g_logVerbosity != -1) g_logVerbosity = 0; //m_state.resetCurrent(); + m_ipcSocket.open("/home/christian/.ethereum/geth.ipc"); + rpcCall("personal_createAccount", {}); + } + + void rpcCall(std::string const& _methodName, std::vector<std::string> const& _args) + { + if (!m_ipcSocket) + BOOST_FAIL("Ethereum node unavailable."); + m_ipcSocket << + "{\"jsonrpc\": \"2.0\", \"method\": \"" << + _methodName << + "\" \"params\": ["; + for (size_t i = 0; i < _args.size(); ++i) + { + m_ipcSocket << "\"" << _args[i] << "\""; + if (i + 1 != _args.size()) + m_ipcSocket << ", "; + } + m_ipcSocket << "], \"id\": \"" << m_rpcSequence << "\"}" << std::endl; + ++m_rpcSequence; + + if (!m_ipcSocket) + BOOST_FAIL("Ethereum node unavailable."); + + std::string reply; + std::getline(m_ipcSocket, reply); + std::cout << "Reply: " << reply << std::endl; } bytes const& compileAndRunWithoutCheck( @@ -292,6 +320,9 @@ protected: m_logs = executive.logs(); } + std::fstream m_ipcSocket; + size_t m_rpcSequence = 1; + std::unique_ptr<eth::SealEngineFace> m_sealEngine; size_t m_optimizeRuns = 200; bool m_optimize = false; |