fixes test codes to deal with eth_tests submodule

This commit is contained in:
jangko 2021-01-06 17:02:19 +07:00
parent c0db998947
commit 74cccdfe9e
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
6 changed files with 35 additions and 12 deletions

View File

@ -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 =

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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()

View File

@ -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