| 51 | } |
| 52 | |
| 53 | bytes ImportTest::executeTest() |
| 54 | { |
| 55 | if (m_testType == testType::StateTests) |
| 56 | { |
| 57 | eth::Network network = eth::Network::MainNetwork; |
| 58 | std::pair<eth::State, ImportTest::execOutput> out = executeTransaction(network, m_envInfo, m_statePre, m_transaction); |
| 59 | m_statePost = out.first; |
| 60 | m_logs = out.second.second.log(); |
| 61 | return out.second.first.output; |
| 62 | } |
| 63 | else if (m_testType == testType::GeneralStateTest) |
| 64 | { |
| 65 | vector<eth::Network> networks; |
| 66 | if (!Options::get().singleTestNet.empty()) |
| 67 | { |
| 68 | networks.push_back(stringToNetId(Options::get().singleTestNet)); |
| 69 | } |
| 70 | else |
| 71 | { |
| 72 | networks.push_back(eth::Network::FrontierTest); |
| 73 | networks.push_back(eth::Network::HomesteadTest); |
| 74 | networks.push_back(eth::Network::EIP150Test); |
| 75 | networks.push_back(eth::Network::EIP158Test); |
| 76 | networks.push_back(eth::Network::MetropolisTest); |
| 77 | } |
| 78 | |
| 79 | json_spirit::mObject json; |
| 80 | vector<transactionToExecute> transactionResults; |
| 81 | for (size_t j = 0; j < networks.size(); j++) |
| 82 | { |
| 83 | for (size_t i = 0; i < m_transactions.size(); i++) |
| 84 | { |
| 85 | eth::Network network = networks[j]; |
| 86 | std::pair<eth::State, ImportTest::execOutput> out = executeTransaction(network, m_envInfo, m_statePre, m_transactions[i].transaction); |
| 87 | m_transactions[i].postState = out.first; |
| 88 | m_transactions[i].netId = network; |
| 89 | transactionResults.push_back(m_transactions[i]); |
| 90 | |
| 91 | if (Options::get().fillchain) |
| 92 | { |
| 93 | json_spirit::mObject testObj; |
| 94 | testObj["network"] = netIdToString(networks[j]); |
| 95 | string postfix = "_d" + toString(m_transactions[i].dataInd); |
| 96 | postfix += "g" + toString(m_transactions[i].gasInd); |
| 97 | postfix += "v" + toString(m_transactions[i].valInd); |
| 98 | postfix += "_" + netIdToString(networks[j]); |
| 99 | string testname = TestOutputHelper::testName() + postfix; |
| 100 | |
| 101 | json_spirit::mObject genesisObj = TestBlockChain::defaultGenesisBlockJson(); |
| 102 | genesisObj["coinbase"] = toString(m_envInfo.author()); |
| 103 | genesisObj["gasLimit"] = toCompactHex(m_envInfo.gasLimit(), HexPrefix::Add); |
| 104 | genesisObj["timestamp"] = toCompactHex(m_envInfo.timestamp() - 50, HexPrefix::Add); |
| 105 | testObj["genesisBlockHeader"] = genesisObj; |
| 106 | testObj["pre"] = fillJsonWithState(m_statePre); |
| 107 | |
| 108 | State s = State (0, OverlayDB(), eth::BaseState::Empty); |
| 109 | AccountMaskMap m = std::unordered_map<Address, AccountMask>(); |
| 110 | StateAndMap smap {s, m}; |
no test coverage detected