From 86953ca3e48bc9620e8d34ae965ba1fa65aaf4eb Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 6 Dec 2016 18:38:59 +0100 Subject: Option to show messages in tests. --- test/ExecutionFramework.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/ExecutionFramework.cpp') diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp index 0c6e0cff..9d6d5675 100644 --- a/test/ExecutionFramework.cpp +++ b/test/ExecutionFramework.cpp @@ -46,6 +46,7 @@ string getIPCSocketPath() ExecutionFramework::ExecutionFramework() : m_rpc(RPCSession::instance(getIPCSocketPath())), m_optimize(dev::test::Options::get().optimize), + m_showMessages(dev::test::Options::get().showMessages), m_sender(m_rpc.account(0)) { m_rpc.test_rewindToBlock(0); @@ -53,6 +54,13 @@ ExecutionFramework::ExecutionFramework() : void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 const& _value) { + if (m_showMessages) + { + if (_isCreation) + cout << "CREATE " << toHex(m_sender) << ": " << toHex(_data) << endl; + else + cout << "CALL " << toHex(m_sender) << " -> " << toHex(m_contractAddress) << ": " << toHex(_data) << endl; + } RPCSession::TransactionData d; d.data = "0x" + toHex(_data); d.from = "0x" + toString(m_sender); @@ -79,6 +87,9 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 m_output = fromHex(code, WhenError::Throw); } + if (m_showMessages) + cout << " -> " << toHex(m_output) << endl; + m_gasUsed = u256(receipt.gasUsed); m_logs.clear(); for (auto const& log: receipt.logEntries) -- cgit From d1c71b78268e56ad0c98c8c71325c8a7b399b604 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 6 Dec 2016 23:52:39 +0100 Subject: Also provide value and format slightly differently. --- test/ExecutionFramework.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'test/ExecutionFramework.cpp') diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp index 9d6d5675..9e3ecac3 100644 --- a/test/ExecutionFramework.cpp +++ b/test/ExecutionFramework.cpp @@ -57,9 +57,12 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 if (m_showMessages) { if (_isCreation) - cout << "CREATE " << toHex(m_sender) << ": " << toHex(_data) << endl; + cout << "CREATE " << m_sender.hex() << ":" << endl; else - cout << "CALL " << toHex(m_sender) << " -> " << toHex(m_contractAddress) << ": " << toHex(_data) << endl; + cout << "CALL " << m_sender.hex() << " -> " << m_contractAddress.hex() << ":" << endl; + if (_value > 0) + cout << " value: " << _value << endl; + cout << " in: " << toHex(_data) << endl; } RPCSession::TransactionData d; d.data = "0x" + toHex(_data); @@ -88,7 +91,7 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 } if (m_showMessages) - cout << " -> " << toHex(m_output) << endl; + cout << " out: " << toHex(m_output) << endl; m_gasUsed = u256(receipt.gasUsed); m_logs.clear(); -- cgit