From 74cccdfe9ec1bbfb0dad17f8f74fa5a96b653655 Mon Sep 17 00:00:00 2001 From: jangko Date: Wed, 6 Jan 2021 17:02:19 +0700 Subject: [PATCH] fixes test codes to deal with eth_tests submodule --- tests/test_allowed_to_fail.nim | 17 +++++++++++++++-- tests/test_blockchain_json.nim | 10 +++++++--- tests/test_generalstate_json.nim | 10 +++++++--- tests/test_helpers.nim | 6 ++++-- tests/test_transaction_json.nim | 2 +- tests/test_vm_json.nim | 2 +- 6 files changed, 35 insertions(+), 12 deletions(-) diff --git a/tests/test_allowed_to_fail.nim b/tests/test_allowed_to_fail.nim index 9392b097d..a1828dd3a 100644 --- a/tests/test_allowed_to_fail.nim +++ b/tests/test_allowed_to_fail.nim @@ -91,7 +91,14 @@ func slowGSTTests(folder: string, name: string): bool = func skipGSTTests*(folder: string, name: string): bool = # we skip tests that are slow or expected to fail for now - slowGSTTests(folder, name) + if slowGSTTests(folder, name): + return true + + # bugs related to ethereum/tests/b1248cd40809d219197ff01eb547170bfaaf1bf1 + name in @[ + "RevertPrecompiledTouch.json", + "RevertPrecompiledTouch_storage.json" + ] func skipNewGSTTests*(folder: string, name: string): bool = # share the same slow and failing tests @@ -108,7 +115,13 @@ func skipBCTests*(folder: string, name: string): bool = # BC huge memory consumption "randomStatetest94.json", - "DelegateCallSpam.json" + "DelegateCallSpam.json", + + # bugs related to ethereum/tests/b1248cd40809d219197ff01eb547170bfaaf1bf1 + "RevertPrecompiledTouch_d0g0v0.json", + "RevertPrecompiledTouch_d3g0v0.json", + "RevertPrecompiledTouch_storage_d0g0v0.json", + "RevertPrecompiledTouch_storage_d3g0v0.json" ] func skipNewBCTests*(folder: string, name: string): bool = diff --git a/tests/test_blockchain_json.nim b/tests/test_blockchain_json.nim index c8f03c0f6..890e4ea94 100644 --- a/tests/test_blockchain_json.nim +++ b/tests/test_blockchain_json.nim @@ -755,12 +755,16 @@ proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus, debugMode = fal echo "Maximum subtest available: ", node.len proc blockchainJsonMain*(debugMode = false) = + const + legacyFolder = "eth_tests" / "LegacyTests" / "Constantinople" / "BlockchainTests" + newFolder = "eth_tests" / "BlockChainTests" + if paramCount() == 0 or not debugMode: # run all test fixtures suite "block chain json tests": - jsonTest("BlockchainTests", testFixture, skipBCTests) + jsonTest(legacyFolder, "BlockchainTests", testFixture, skipBCTests) suite "new block chain json tests": - jsonTest("newBlockChainTests", testFixture, skipNewBCTests) + jsonTest(newFolder, "newBlockChainTests", testFixture, skipNewBCTests) else: # execute single test in debug mode let config = test_config.getConfiguration() @@ -768,7 +772,7 @@ proc blockchainJsonMain*(debugMode = false) = echo "missing test subject" quit(QuitFailure) - let folder = if config.legacy: "BlockchainTests" else: "newBlockChainTests" + let folder = if config.legacy: legacyFolder else: newFolder let path = "tests" / "fixtures" / folder let n = json.parseFile(path / config.testSubject) var testStatusIMPL: TestStatus diff --git a/tests/test_generalstate_json.nim b/tests/test_generalstate_json.nim index 041f9f683..b23392a81 100644 --- a/tests/test_generalstate_json.nim +++ b/tests/test_generalstate_json.nim @@ -193,12 +193,16 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus, echo fork proc generalStateJsonMain*(debugMode = false) = + const + legacyFolder = "eth_tests" / "LegacyTests" / "Constantinople" / "GeneralStateTests" + newFolder = "eth_tests" / "GeneralStateTests" + if paramCount() == 0 or not debugMode: # run all test fixtures suite "generalstate json tests": - jsonTest("GeneralStateTests", testFixture, skipGSTTests) + jsonTest(legacyFolder , "GeneralStateTests", testFixture, skipGSTTests) suite "new generalstate json tests": - jsonTest("newGeneralStateTests", testFixture, skipNewGSTTests) + jsonTest(newFolder, "newGeneralStateTests", testFixture, skipNewGSTTests) else: # execute single test in debug mode let config = getConfiguration() @@ -206,7 +210,7 @@ proc generalStateJsonMain*(debugMode = false) = echo "missing test subject" quit(QuitFailure) - let folder = if config.legacy: "GeneralStateTests" else: "newGeneralStateTests" + let folder = if config.legacy: legacyFolder else: newFolder let path = "tests" / "fixtures" / folder let n = json.parseFile(path / config.testSubject) var testStatusIMPL: TestStatus diff --git a/tests/test_helpers.nim b/tests/test_helpers.nim index 4ea0bf138..bbe07be48 100644 --- a/tests/test_helpers.nim +++ b/tests/test_helpers.nim @@ -29,7 +29,8 @@ const FkByzantium: "Byzantium", FkConstantinople: "Constantinople", FkPetersburg: "ConstantinopleFix", - FkIstanbul: "Istanbul" + FkIstanbul: "Istanbul", + FkBerlin: "Berlin" }.toTable supportedForks* = { @@ -40,7 +41,8 @@ const FkByzantium, FkConstantinople, FkPetersburg, - FkIstanbul} + FkIstanbul, + FkBerlin} nameToFork* = revmap(forkNames) diff --git a/tests/test_transaction_json.nim b/tests/test_transaction_json.nim index 4c813f301..e88fd3c10 100644 --- a/tests/test_transaction_json.nim +++ b/tests/test_transaction_json.nim @@ -11,7 +11,7 @@ proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus) proc transactionJsonMain*() = suite "Transactions tests": - jsonTest("TransactionTests", testFixture) + jsonTest("eth_tests" / "TransactionTests", "TransactionTests", testFixture) when isMainModule: transactionJsonMain() diff --git a/tests/test_vm_json.nim b/tests/test_vm_json.nim index 26850a797..d46779587 100644 --- a/tests/test_vm_json.nim +++ b/tests/test_vm_json.nim @@ -20,7 +20,7 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) proc vmJsonMain*() = suite "vm json tests": - jsonTest("VMTests", testFixture, skipVMTests) + jsonTest("eth_tests" / "VMTests", "VMTests", testFixture, skipVMTests) proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) = var fixture: JsonNode