allow user to select legacy or new test suite for GST and BCT
This commit is contained in:
parent
2fbabd25a4
commit
ed5710fa17
|
@ -672,6 +672,8 @@ proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus, debugMode = fal
|
|||
|
||||
if not fixtureTested:
|
||||
echo getConfiguration().testSubject, " not tested at all, wrong index?"
|
||||
if specifyIndex <= 0 or specifyIndex > node.len:
|
||||
echo "Maximum subtest available: ", node.len
|
||||
|
||||
proc blockchainJsonMain*(debugMode = false) =
|
||||
if paramCount() == 0 or not debugMode:
|
||||
|
@ -687,7 +689,8 @@ proc blockchainJsonMain*(debugMode = false) =
|
|||
echo "missing test subject"
|
||||
quit(QuitFailure)
|
||||
|
||||
let path = "tests" / "fixtures" / "newBlockChainTests"
|
||||
let folder = if config.legacy: "BlockchainTests" else: "newBlockChainTests"
|
||||
let path = "tests" / "fixtures" / folder
|
||||
let n = json.parseFile(path / config.testSubject)
|
||||
var testStatusIMPL: TestStatus
|
||||
testFixture(n, testStatusIMPL, debugMode = true, config.trace)
|
||||
|
|
|
@ -17,6 +17,7 @@ type
|
|||
fork*: Fork
|
||||
index*: int
|
||||
trace*: bool
|
||||
legacy*: bool
|
||||
|
||||
var testConfig {.threadvar.}: Configuration
|
||||
|
||||
|
@ -46,6 +47,7 @@ proc processArguments*(msg: var string): ConfigStatus =
|
|||
of "fork": config.fork = parseEnum[Fork](strip(value))
|
||||
of "index": config.index = parseInt(value)
|
||||
of "trace": config.trace = parseBool(value)
|
||||
of "legacy": config.legacy = parseBool(value)
|
||||
else:
|
||||
msg = "Unknown option " & key
|
||||
if value.len > 0: msg = msg & " : " & value
|
||||
|
|
|
@ -153,8 +153,10 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus,
|
|||
tester.debugMode = debugMode
|
||||
let ftrans = fixture["transaction"]
|
||||
var testedInFork = false
|
||||
var numIndex = -1
|
||||
for fork in supportedForks:
|
||||
if fixture["post"].hasKey(forkNames[fork]):
|
||||
numIndex = fixture["post"][forkNames[fork]].len
|
||||
for expectation in fixture["post"][forkNames[fork]]:
|
||||
inc tester.index
|
||||
if specifyIndex > 0 and tester.index != specifyIndex:
|
||||
|
@ -173,7 +175,14 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus,
|
|||
testFixtureIndexes(tester, testStatusIMPL)
|
||||
|
||||
if not testedInFork:
|
||||
echo "test subject '", tester.name, "' not tested in any forks"
|
||||
echo "test subject '", tester.name, "' not tested in any forks/subtests"
|
||||
if specifyIndex <= 0 or specifyIndex > numIndex:
|
||||
echo "Maximum subtest available: ", numIndex
|
||||
else:
|
||||
echo "available forks in this test:"
|
||||
for fork in test_helpers.supportedForks:
|
||||
if fixture["post"].hasKey(forkNames[fork]):
|
||||
echo fork
|
||||
|
||||
proc generalStateJsonMain*(debugMode = false) =
|
||||
if paramCount() == 0 or not debugMode:
|
||||
|
@ -189,7 +198,8 @@ proc generalStateJsonMain*(debugMode = false) =
|
|||
echo "missing test subject"
|
||||
quit(QuitFailure)
|
||||
|
||||
let path = "tests" / "fixtures" / "newGeneralStateTests"
|
||||
let folder = if config.legacy: "GeneralStateTests" else: "newGeneralStateTests"
|
||||
let path = "tests" / "fixtures" / folder
|
||||
let n = json.parseFile(path / config.testSubject)
|
||||
var testStatusIMPL: TestStatus
|
||||
var forks: set[Fork] = {}
|
||||
|
|
Loading…
Reference in New Issue