From bb7ca7a6b44ff776b86e42dc262f3b3293a6ba4f Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 19 May 2015 16:46:00 +0200 Subject: [PATCH] handle output larger than 4069 bytes in test --- test/TestHelper.cpp | 9 +++++++-- .../StateTestsFiller/stMemoryStressTestFiller.json | 6 +++--- test/libevm/vm.cpp | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index aada83041..476d1ecf9 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -327,7 +327,8 @@ void ImportTest::checkExpectedState(State const& _stateExpect, State const& _sta void ImportTest::exportTest(bytes const& _output, State const& _statePost) { // export output - m_TestObject["out"] = toHex(_output, 2, HexPrefix::Add); + + m_TestObject["out"] = _output.size() > 4096 ? "#" + toString(_output.size()) : toHex(_output, 2, HexPrefix::Add); // export logs m_TestObject["logs"] = exportLog(_statePost.pending().size() ? _statePost.log(0) : LogEntries()); @@ -489,7 +490,11 @@ LogEntries importLog(json_spirit::mArray& _a) void checkOutput(bytes const& _output, json_spirit::mObject& _o) { int j = 0; - if (_o["out"].type() == json_spirit::array_type) + + if (_o["out"].get_str().find("#") == 0) + BOOST_CHECK((u256)_output.size() == toInt(_o["out"].get_str().substr(1))); + + else if (_o["out"].type() == json_spirit::array_type) for (auto const& d: _o["out"].get_array()) { BOOST_CHECK_MESSAGE(_output[j] == toInt(d), "Output byte [" << j << "] different!"); diff --git a/test/libethereum/StateTestsFiller/stMemoryStressTestFiller.json b/test/libethereum/StateTestsFiller/stMemoryStressTestFiller.json index 3893223eb..b5a531520 100644 --- a/test/libethereum/StateTestsFiller/stMemoryStressTestFiller.json +++ b/test/libethereum/StateTestsFiller/stMemoryStressTestFiller.json @@ -58,7 +58,7 @@ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "balance" : "1000000000000000000", "nonce" : "0", - "code" : "{ (RETURN 0 4294967297) } ", + "code" : "{ (RETURN 0 4294967295) } ", "storage": {} }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { @@ -77,7 +77,7 @@ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", "data" : "" } - }, + }, "mload32bitBound_return2": { "env" : { @@ -98,7 +98,7 @@ "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { "balance" : "1000000000000000000", "nonce" : "0", - "code" : "{[ 0 ] 1 (RETURN 0 4294967296) } ", + "code" : "{[ 0 ] 1 (RETURN 0 4294967295) } ", "storage": {} }, "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { diff --git a/test/libevm/vm.cpp b/test/libevm/vm.cpp index 10670bfe3..18153f2bf 100644 --- a/test/libevm/vm.cpp +++ b/test/libevm/vm.cpp @@ -393,7 +393,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin) } o["callcreates"] = fev.exportCallCreates(); - o["out"] = toHex(output, 2, HexPrefix::Add); + o["out"] = output.size() > 4096 ? "#" + toString(output.size()) : toHex(output, 2, HexPrefix::Add); o["gas"] = toCompactHex(gas, HexPrefix::Add, 1); o["logs"] = exportLog(fev.sub.logs); }