Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/blockchaintest/blockchaintest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ bool collect_tests(std::vector<TestCase>& cases, const fs::path& root,
cases.push_back(
{file.path.string(), [path = file.path, &vm](evmone::test::TestReport& report) {
std::ifstream f{path};
evmone::test::run_blockchain_tests(
evmone::test::load_blockchain_tests(f), vm, report);
for (const auto& test : evmone::test::load_blockchain_tests(f))
evmone::test::run_blockchain_test(test, vm, report);
Comment thread
chfast marked this conversation as resolved.
}});
}
}
Expand Down Expand Up @@ -67,7 +67,7 @@ bool collect_tests(std::vector<TestCase>& cases, const fs::path& root,
{
cases.push_back(
{root.string() + "::" + test.name, [test, &vm](evmone::test::TestReport& report) {
evmone::test::run_blockchain_tests({&test, 1}, vm, report);
evmone::test::run_blockchain_test(test, vm, report);
}});
}
}
Expand Down
12 changes: 12 additions & 0 deletions test/integration/blockchaintest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ set_tests_properties(
PASS_REGULAR_EXPRESSION "SKIPPED [^\n]*unsupported_rlp\\.json - tests with invalidly"
)

# A test which gives up gives up only itself. Collected from a directory the whole file is one
# test, so the test after the one which stopped has to report too.
add_test(
NAME ${PREFIX}/stops_at_one_test
COMMAND evmone-blockchaintest ${TESTS1}
)
set_tests_properties(
${PREFIX}/stops_at_one_test PROPERTIES
PASS_REGULAR_EXPRESSION
"a_stops_early:.*block validity.*b_still_runs:.*post state root"
)

# --collect-only lists what would run instead of running it, and --ignore drops a path from that
# list. Over a directory a test is listed as its file.
add_test(
Expand Down
128 changes: 128 additions & 0 deletions test/integration/blockchaintest/stops_at_one_test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"a_stops_early": {
"network": "Amsterdam",
"genesisBlockHeader": {
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"coinbase": "0x0000000000000000000000000000000000000000",
"stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"receiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x00",
"number": "0x00",
"gasLimit": "0x01000000",
"gasUsed": "0x00",
"timestamp": "0x00",
"extraData": "0x00",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"baseFeePerGas": "0x10",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"blobGasUsed": "0x00",
"excessBlobGas": "0x00",
"parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"slotNumber": "0x00",
"hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"pre": {
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"code": "0x",
"nonce": "0x00",
"balance": "0x02540be400"
}
},
"blocks": [
{
"rlp": "0xf90285f90259a00000000000000000000000000000000000000000000000000000000000000001a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794000000000000000000000000000000000000c014a09906207bb91a552f2c9036ff75ffebd15d6262fe1f1dc40afa6e047158ee25e5a06e1d1e299aa4bca4b32c05a8bd8cf631d97c7d9b54b1401c373860db01a38efea0c220348cfca03fd761c800a2af15752cee5ba04f836e61f798c4c6222c0cab02b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800184010000008265960c80a000000000000000000000000000000000000000000000000000000000000000008800000000000000000ea056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b4218080a00000000000000000000000000000000000000000000000000000000000000000a0e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855e6a502e30180800e830186a094000000000000000000000000000000000000c0de8080c0800101c0c0",
"blockHeader": {
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000001",
"uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"coinbase": "0x000000000000000000000000000000000000c014",
"stateRoot": "0x9906207bb91a552f2c9036ff75ffebd15d6262fe1f1dc40afa6e047158ee25e5",
"transactionsTrie": "0x6e1d1e299aa4bca4b32c05a8bd8cf631d97c7d9b54b1401c373860db01a38efe",
"receiptTrie": "0xc220348cfca03fd761c800a2af15752cee5ba04f836e61f798c4c6222c0cab02",
"bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x00",
"number": "0x01",
"gasLimit": "0x01000000",
"gasUsed": "0x6596",
"timestamp": "0x00",
"extraData": "0x",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"baseFeePerGas": "0x0e",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"blobGasUsed": "0x00",
"excessBlobGas": "0x00",
"parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"slotNumber": "0x00",
"hash": "0x0000000000000000000000000000000000000000000000000000000000000002"
},
"transactions": [],
"withdrawals": [],
"uncleHeaders": []
}
],
"lastblockhash": "0x0000000000000000000000000000000000000000000000000000000000000002",
"postState": {},
"config": {
"network": "Amsterdam",
"chainid": "0x01"
},
"genesisRLP": "0x",
"sealEngine": "NoProof",
"_info": {
"comment": "Its block does not advance the timestamp, so it is invalid where the test says it is valid, and the test stops there."
}
},
"b_still_runs": {
"_info": {
"comment": "Runs only if the test before it stopped by itself rather than taking the rest of the file with it. Its post state is wrong, so reaching it is visible."
},
"network": "Amsterdam",
"genesisBlockHeader": {
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"uncleHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"coinbase": "0x0000000000000000000000000000000000000000",
"stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transactionsTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"receiptTrie": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"bloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"difficulty": "0x00",
"number": "0x00",
"gasLimit": "0x01000000",
"gasUsed": "0x00",
"timestamp": "0x00",
"extraData": "0x00",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"baseFeePerGas": "0x10",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"blobGasUsed": "0x00",
"excessBlobGas": "0x00",
"parentBeaconBlockRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"requestsHash": "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"slotNumber": "0x00",
"hash": "0x0000000000000000000000000000000000000000000000000000000000000001"
},
"pre": {
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"code": "0x",
"nonce": "0x00",
"balance": "0x02540be400"
}
},
"blocks": [],
"lastblockhash": "0x0000000000000000000000000000000000000000000000000000000000000001",
"postState": {},
"config": {
"network": "Amsterdam",
"chainid": "0x01"
},
"genesisRLP": "0x",
"sealEngine": "NoProof"
}
}
2 changes: 1 addition & 1 deletion test/unittests/blockchaintest_runner_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ std::vector<Failure> run(const BlockchainTest& t)
std::vector<Failure> failures;
TestReport report{[&](const Failure& failure) { failures.push_back(failure); }};
evmc::VM vm{evmc_create_evmone()};
run_blockchain_tests({&t, 1}, vm, report);
run_blockchain_test(t, vm, report);
return failures;
}
} // namespace
Expand Down
4 changes: 2 additions & 2 deletions test/utils/blockchaintest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ std::vector<BlockchainTest> load_blockchain_tests(std::istream& input);
/// Builds the test named @p name in a fixture file from its JSON value @p j.
BlockchainTest make_blockchain_test(const std::string& name, const json::json& j);

/// Execute the blockchain @p tests using the @p vm, recording what does not match into @p report.
void run_blockchain_tests(std::span<const BlockchainTest> tests, evmc::VM& vm, TestReport& report);
/// Execute the blockchain @p test using the @p vm, recording what does not match into @p report.
void run_blockchain_test(const BlockchainTest& test, evmc::VM& vm, TestReport& report);
Comment thread
Copilot marked this conversation as resolved.
} // namespace evmone::test
Loading