Skip to content

Commit

Permalink
fixes #421, each tests have their own skip table
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko committed Dec 3, 2019
1 parent 05a5c3f commit be27da2
Show file tree
Hide file tree
Showing 12 changed files with 209 additions and 168 deletions.
14 changes: 7 additions & 7 deletions GeneralStateTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
+ CreateMessageRevertedOOGInInit.json OK
+ RevertDepthCreate2OOG.json OK
+ RevertDepthCreateAddressCollision.json OK
RevertInCreateInInitCreate2.json Skip
+ RevertInCreateInInitCreate2.json OK
+ RevertOpcodeCreate.json OK
+ RevertOpcodeInCreateReturnsCreate2.json OK
+ call_outsize_then_create2_successful_then_returndatasize.json OK
Expand All @@ -413,7 +413,7 @@ OK: 3/3 Fail: 0/3 Skip: 0/3
+ returndatacopy_following_successful_create.json OK
+ returndatasize_following_successful_create.json OK
```
OK: 41/44 Fail: 0/44 Skip: 3/44
OK: 42/44 Fail: 0/44 Skip: 2/44
## stCreateTest
```diff
+ CREATE_AcreateB_BSuicide_BStore.json OK
Expand Down Expand Up @@ -1686,7 +1686,7 @@ OK: 38/38 Fail: 0/38 Skip: 0/38
+ RevertDepthCreateAddressCollision.json OK
+ RevertDepthCreateOOG.json OK
+ RevertInCallCode.json OK
RevertInCreateInInit.json Skip
+ RevertInCreateInInit.json OK
+ RevertInDelegateCall.json OK
+ RevertInStaticCall.json OK
+ RevertOnEmptyStack.json OK
Expand Down Expand Up @@ -1722,10 +1722,10 @@ OK: 38/38 Fail: 0/38 Skip: 0/38
+ TouchToEmptyAccountRevert2.json OK
+ TouchToEmptyAccountRevert3.json OK
```
OK: 40/46 Fail: 0/46 Skip: 6/46
OK: 41/46 Fail: 0/46 Skip: 5/46
## stSStoreTest
```diff
InitCollision.json Skip
+ InitCollision.json OK
+ InitCollisionNonZeroNonce.json OK
+ SstoreCallToSelfSubRefundBelowZero.json OK
+ sstore_0to0.json OK
Expand Down Expand Up @@ -1755,7 +1755,7 @@ OK: 40/46 Fail: 0/46 Skip: 6/46
+ sstore_combinations_initial1.json OK
+ sstore_combinations_initial2.json OK
```
OK: 28/29 Fail: 0/29 Skip: 1/29
OK: 29/29 Fail: 0/29 Skip: 0/29
## stShift
```diff
+ sar00.json OK
Expand Down Expand Up @@ -2645,4 +2645,4 @@ OK: 133/133 Fail: 0/133 Skip: 0/133
OK: 130/130 Fail: 0/130 Skip: 0/130

---TOTAL---
OK: 2340/2447 Fail: 0/2447 Skip: 107/2447
OK: 2343/2447 Fail: 0/2447 Skip: 104/2447
6 changes: 3 additions & 3 deletions PrecompileTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ PrecompileTests
+ bn256mul.json OK
+ ecrecover.json OK
+ identity.json OK
modexp.json Skip
+ modexp.json OK
+ pairing.json OK
+ ripemd160.json OK
+ sha256.json OK
```
OK: 7/8 Fail: 0/8 Skip: 1/8
OK: 8/8 Fail: 0/8 Skip: 0/8

---TOTAL---
OK: 7/8 Fail: 0/8 Skip: 1/8
OK: 8/8 Fail: 0/8 Skip: 0/8
176 changes: 176 additions & 0 deletions tests/test_allowed_to_fail.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Nimbus
# Copyright (c) 2018 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http:https://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http:https://opensource.org/licenses/MIT)
# at your option. This file may not be copied, modified, or distributed except according to those terms.

# XXX: when all but a relative few dozen, say, GeneralStateTests run, remove this,
# but for now, this enables some CI use before that to prevent regressions. In the
# separate file here because it would otherwise just distract. Could use all sorts
# of O(1) or O(log n) lookup structures, or be more careful to only initialize the
# table once, but notion's that it should shrink reasonable quickly and disappear,
# being mostly used for short-term regression prevention.

import strutils

func slowGSTTests(folder: string, name: string): bool =
result = folder == "stQuadraticComplexityTest" or
name in @["randomStatetest352.json", "randomStatetest1.json",
"randomStatetest32.json", "randomStatetest347.json",
"randomStatetest393.json", "randomStatetest626.json",
"CALLCODE_Bounds.json", "DELEGATECALL_Bounds3.json",
"CALLCODE_Bounds4.json", "CALL_Bounds.json",
"DELEGATECALL_Bounds2.json", "CALL_Bounds3.json",
"CALLCODE_Bounds2.json", "CALLCODE_Bounds3.json",
"DELEGATECALL_Bounds.json", "CALL_Bounds2a.json",
"CALL_Bounds2.json",
"CallToNameRegistratorMemOOGAndInsufficientBalance.json",
"CallToNameRegistratorTooMuchMemory0.json",

# all these tests below actually pass
# but they are very slow

# constantinople slow tests
"Create2Recursive.json",

# byzantium slow tests
"LoopCallsDepthThenRevert3.json",
"LoopCallsDepthThenRevert2.json",
"LoopCallsDepthThenRevert.json",
"static_Call50000.json",
"static_Call50000_ecrec.json",
"static_Call50000_identity.json",
"static_Call50000_identity2.json",
"static_Call50000_rip160.json",
"static_Call50000_sha256.json",
"LoopCallsThenRevert.json",
"LoopDelegateCallsDepthThenRevert.json",
"recursiveCreateReturnValue.json",
"static_Call1024PreCalls2.json",
"Callcode1024BalanceTooLow.json",
"static_Call1024BalanceTooLow.json",
"static_Call1024BalanceTooLow2.json",
"static_Call1024OOG.json",
"static_Call1024PreCalls3.json",
"static_Call1024PreCalls.json",
"static_Call1MB1024Calldepth.json",

# Homestead recursives
"ContractCreationSpam.json",
"Call1024OOG.json",
"Call1024PreCalls.json",
"CallRecursiveBombPreCall.json",
"Delegatecall1024.json",
"Delegatecall1024OOG.json",
"JUMPDEST_Attack.json",
"JUMPDEST_AttackwithJump.json",
"ABAcalls1.json",
"ABAcalls2.json",
"CallRecursiveBomb0.json",
"CallRecursiveBomb0_OOG_atMaxCallDepth.json",
"CallRecursiveBomb1.json",
"CallRecursiveBomb2.json",
"CallRecursiveBombLog.json",
"CallRecursiveBombLog2.json",
"Call1024BalanceTooLow.json",

# Frontier recursives
"Callcode1024OOG.json",
"callcallcodecall_ABCB_RECURSIVE.json",
"callcallcodecallcode_ABCB_RECURSIVE.json",
"callcodecallcall_ABCB_RECURSIVE.json",
"callcodecallcallcode_ABCB_RECURSIVE.json",
"callcodecallcodecall_ABCB_RECURSIVE.json",
"callcodecallcodecallcode_ABCB_RECURSIVE.json",
"callcallcallcode_ABCB_RECURSIVE.json"
]

func failIn32Bits(folder, name: string): bool =
return name in @[
# crash with OOM
"static_Return50000_2.json",
"randomStatetest185.json",
"randomStatetest159.json",
"randomStatetest48.json",

# OOM in AppVeyor, not on my machine
"randomStatetest36.json"
]

func allowedFailingGeneralStateTest(folder, name: string): bool =
let allowedFailingGeneralStateTests = @[
# conflicts between native int and big int.
# gasFee calculation in modexp precompiled
# contracts
"modexp.json",
# perhaps a design flaw with create/create2 opcode.
# a conflict between balance checker and
# static call context checker
"create2noCash.json"
]
result = name in allowedFailingGeneralStateTests

func allowedFailInCurrentBuild(folder, name: string): bool =
when sizeof(int) == 4:
if failIn32Bits(folder, name):
return true
return allowedFailingGeneralStateTest(folder, name)

func skipGSTTests*(folder: string, name: string): bool =
# we skip tests that are slow or expected to fail for now
if slowGSTTests(folder, name):
return true
result = allowedFailInCurrentBuild(folder, name)

func skipNewGSTTests*(folder: string, name: string): bool =
# share the same slow and failing tests
if skipGSTTests(folder, name):
return true

result = name in @[
# skip slow tests
"CALLBlake2f_MaxRounds.json",

# py-evm claims these tests are incorrect
# nimbus also agree
"RevertInCreateInInit.json",
"RevertInCreateInInitCreate2.json",
"InitCollision.json"
]

func skipVMTests*(folder: string, name: string): bool =
when sizeof(int) == 4:
if name == "sha3_bigSize.json":
return true
result = (folder == "vmPerformance" and "loop" in name)

func skipBCTests*(folder: string, name: string): bool =
let allowedFailingBCTests = @[
# BlockChain slow tests
"SuicideIssue.json",

# Failed tests
"SuicidesMixingCoinbase.json",
]

result = name in allowedFailingBCTests

func skipNewBCTests*(folder: string, name: string): bool =
let allowedFailingBCTests = @[
# Istanbul bc tests
# py-evm claims these tests are incorrect
# nimbus also agree
"RevertInCreateInInit.json",
"RevertInCreateInInitCreate2.json",
"InitCollision.json"
]

result = name in allowedFailingBCTests

func skipTxTests*(folder: string, name: string): bool =
# from test_transaction_json
when sizeof(int) == 4:
result = name == "RLPHeaderSizeOverflowInt32.json"
else:
false
7 changes: 4 additions & 3 deletions tests/test_blockchain_json.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import
options,
eth/[common, rlp, bloom], eth/trie/[db, trie_defs],
ethash, stew/endians2, nimcrypto,
./test_helpers, ../premix/parser, test_config,
./test_helpers, , ./test_allowed_to_fail,
../premix/parser, test_config,
../nimbus/vm/interpreter/vm_forks,
../nimbus/[vm_state, utils, vm_types, errors, transaction, constants],
../nimbus/db/[db_chain, state_db],
Expand Down Expand Up @@ -668,9 +669,9 @@ proc main() =
if paramCount() == 0:
# run all test fixtures
suite "block chain json tests":
jsonTest("BlockchainTests", testFixture)
jsonTest("BlockchainTests", testFixture, skipBCTests)
suite "new block chain json tests":
jsonTest("newBlockchainTests", testFixture)
jsonTest("newBlockchainTests", testFixture, skipNewBCTests)
else:
# execute single test in debug mode
let config = getConfiguration()
Expand Down
32 changes: 0 additions & 32 deletions tests/test_generalstate_failing.nim

This file was deleted.

9 changes: 5 additions & 4 deletions tests/test_generalstate_json.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import
unittest2, strformat, strutils, tables, json, times, os,
stew/ranges/typedranges, nimcrypto, options,
eth/[rlp, common], eth/trie/[db, trie_defs], chronicles,
./test_helpers, ../nimbus/p2p/executor, test_config,
./test_helpers, ./test_allowed_to_fail,
../nimbus/p2p/executor, test_config,
../nimbus/transaction,
../nimbus/[vm_state, vm_types, vm_state_transactions, utils],
../nimbus/vm/interpreter,
Expand Down Expand Up @@ -178,10 +179,10 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus,
proc generalStateJsonMain*(debugMode = false) =
if paramCount() == 0 or not debugMode:
# run all test fixtures
suite "generalstate json tests":
jsonTest("GeneralStateTests", testFixture)
#suite "generalstate json tests":
#jsonTest("GeneralStateTests", testFixture, skipGSTTests)
suite "new generalstate json tests":
jsonTest("newGeneralStateTests", testFixture)
jsonTest("newGeneralStateTests", testFixture, skipNewGSTTests)
else:
# execute single test in debug mode
let config = getConfiguration()
Expand Down

0 comments on commit be27da2

Please sign in to comment.