aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-12-07 18:28:29 +0800
committerGitHub <noreply@github.com>2016-12-07 18:28:29 +0800
commitfd7561ed609c07ea38b8647982121d73be9224f7 (patch)
tree24c299be195f8acb686609e8901b0a1eec41c4f4
parentb201e148fad222b1a1fe276211126305026e6168 (diff)
parentd1c71b78268e56ad0c98c8c71325c8a7b399b604 (diff)
downloaddexon-solidity-fd7561ed609c07ea38b8647982121d73be9224f7.tar.gz
dexon-solidity-fd7561ed609c07ea38b8647982121d73be9224f7.tar.zst
dexon-solidity-fd7561ed609c07ea38b8647982121d73be9224f7.zip
Merge pull request #1490 from ethereum/debugMessages
Option to show messages in tests.
-rw-r--r--test/ExecutionFramework.cpp14
-rw-r--r--test/ExecutionFramework.h1
-rw-r--r--test/TestHelper.cpp2
-rw-r--r--test/TestHelper.h1
4 files changed, 18 insertions, 0 deletions
diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp
index 0c6e0cff..9e3ecac3 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,16 @@ ExecutionFramework::ExecutionFramework() :
void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256 const& _value)
{
+ if (m_showMessages)
+ {
+ if (_isCreation)
+ cout << "CREATE " << m_sender.hex() << ":" << endl;
+ else
+ 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);
d.from = "0x" + toString(m_sender);
@@ -79,6 +90,9 @@ void ExecutionFramework::sendMessage(bytes const& _data, bool _isCreation, u256
m_output = fromHex(code, WhenError::Throw);
}
+ if (m_showMessages)
+ cout << " out: " << toHex(m_output) << endl;
+
m_gasUsed = u256(receipt.gasUsed);
m_logs.clear();
for (auto const& log: receipt.logEntries)
diff --git a/test/ExecutionFramework.h b/test/ExecutionFramework.h
index f47f2743..733fd56d 100644
--- a/test/ExecutionFramework.h
+++ b/test/ExecutionFramework.h
@@ -281,6 +281,7 @@ protected:
unsigned m_optimizeRuns = 200;
bool m_optimize = false;
+ bool m_showMessages = false;
Address m_sender;
Address m_contractAddress;
u256 const m_gasPrice = 100 * szabo;
diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp
index d670ebff..0c0857c9 100644
--- a/test/TestHelper.cpp
+++ b/test/TestHelper.cpp
@@ -41,6 +41,8 @@ Options::Options()
}
else if (string(suite.argv[i]) == "--optimize")
optimize = true;
+ else if (string(suite.argv[i]) == "--show-messages")
+ showMessages = true;
if (ipcPath.empty())
if (auto path = getenv("ETH_TEST_IPC"))
diff --git a/test/TestHelper.h b/test/TestHelper.h
index afe4a68f..8f05eead 100644
--- a/test/TestHelper.h
+++ b/test/TestHelper.h
@@ -106,6 +106,7 @@ namespace test
struct Options: boost::noncopyable
{
std::string ipcPath;
+ bool showMessages = false;
bool optimize = false;
static Options const& get();