Option to show messages in tests.

This commit is contained in:
chriseth committed 2016-12-06 22:31:20 +01:00
1 parent b201e148fa
commit 86953ca3e4
4 files changed
+15

No files matched your search

+11
View File
@@ -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)