Skip to content

Commit 7f5f62a

Browse files
holimankaralabe
authored andcommitted
tests: update test suite for istanbul (ethereum#20082)
* update tests for istanbul * tests: updated blockchaintests, see ethereum/tests#637 * tests: update again, hopefully fixed this time * tests: skip time consuming, run legacy tests * tests: update again * build: disable long-running tests on travis * tests: fix formatting nits * tests: I hate github's editor
1 parent b2f696e commit 7f5f62a

File tree

5 files changed

+34
-14
lines changed

5 files changed

+34
-14
lines changed

build/ci.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func doTest(cmdline []string) {
315315
// Test a single package at a time. CI builders are slow
316316
// and some tests run into timeouts under load.
317317
gotest := goTool("test", buildFlags(env)...)
318-
gotest.Args = append(gotest.Args, "-p", "1", "-timeout", "5m")
318+
gotest.Args = append(gotest.Args, "-p", "1", "-timeout", "5m", "--short")
319319
if *coverage {
320320
gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover")
321321
}

tests/block_test.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,9 @@ func TestBlockchain(t *testing.T) {
2525

2626
bt := new(testMatcher)
2727
// General state tests are 'exported' as blockchain tests, but we can run them natively.
28-
bt.skipLoad(`^ValidBlocks/bcStateTests/`)
29-
// Skip random failures due to selfish mining test.
28+
bt.skipLoad(`^GeneralStateTests/`)
29+
// Skip random failures due to selfish mining test
3030
bt.skipLoad(`.*bcForgedTest/bcForkUncle\.json`)
31-
bt.skipLoad(`.*bcMultiChainTest/(ChainAtoChainB_blockorder|CallContractFromNotBestBlock)`)
32-
bt.skipLoad(`.*bcTotalDifficultyTest/(lotsOfLeafs|lotsOfBranches|sideChainWithMoreTransactions)`)
33-
34-
// These are not formatted like the rest -- due to the large postState, the postState
35-
// was replaced by a hash, instead of a genesisAlloc map
36-
// See https://github.com/ethereum/tests/pull/616
37-
bt.skipLoad(`.*bcExploitTest/ShanghaiLove.json`)
38-
bt.skipLoad(`.*bcExploitTest/SuicideIssue.json`)
3931

4032
// Slow tests
4133
bt.slow(`.*bcExploitTest/DelegateCallSpam.json`)
@@ -45,9 +37,20 @@ func TestBlockchain(t *testing.T) {
4537
bt.slow(`.*/bcGasPricerTest/RPC_API_Test.json`)
4638
bt.slow(`.*/bcWalletTest/`)
4739

40+
// Very slow test
41+
bt.skipLoad(`.*/stTimeConsuming/.*`)
42+
43+
// test takes a lot for time and goes easily OOM because of sha3 calculation on a huge range,
44+
// using 4.6 TGas
45+
bt.skipLoad(`.*randomStatetest94.json.*`)
46+
4847
bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) {
4948
if err := bt.checkFailure(t, name, test.Run()); err != nil {
5049
t.Error(err)
5150
}
5251
})
52+
53+
// There is also a LegacyTests folder, containing blockchain tests generated
54+
// prior to Istanbul. However, they are all derived from GeneralStateTests,
55+
// which run natively, so there's no reason to run them here.
5356
}

tests/init_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ var (
4949
baseDir = filepath.Join(".", "testdata")
5050
blockTestDir = filepath.Join(baseDir, "BlockchainTests")
5151
stateTestDir = filepath.Join(baseDir, "GeneralStateTests")
52+
legacyStateTestDir = filepath.Join(baseDir, "LegacyTests", "Constantinople", "GeneralStateTests")
5253
transactionTestDir = filepath.Join(baseDir, "TransactionTests")
5354
vmTestDir = filepath.Join(baseDir, "VMTests")
5455
rlpTestDir = filepath.Join(baseDir, "RLPTests")

tests/state_test.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ func TestState(t *testing.T) {
4040
st.slow(`^stStaticCall/static_Call1MB`)
4141
st.slow(`^stSystemOperationsTest/CallRecursiveBomb`)
4242
st.slow(`^stTransactionTest/Opcodes_TransactionInit`)
43+
44+
// Very time consuming
45+
st.skipLoad(`^stTimeConsuming/`)
46+
4347
// Broken tests:
44-
st.skipLoad(`^stTransactionTest/OverflowGasRequire\.json`) // gasLimit > 256 bits
45-
st.skipLoad(`^stTransactionTest/zeroSigTransa[^/]*\.json`) // EIP-86 is not supported yet
4648
// Expected failures:
4749
//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/0`, "bug in test")
4850
//st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/3`, "bug in test")
@@ -64,6 +66,20 @@ func TestState(t *testing.T) {
6466
})
6567
}
6668
})
69+
// For Istanbul, older tests were moved into LegacyTests
70+
st.walk(t, legacyStateTestDir, func(t *testing.T, name string, test *StateTest) {
71+
for _, subtest := range test.Subtests() {
72+
subtest := subtest
73+
key := fmt.Sprintf("%s/%d", subtest.Fork, subtest.Index)
74+
name := name + "/" + key
75+
t.Run(key, func(t *testing.T) {
76+
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
77+
_, err := test.Run(subtest, vmconfig)
78+
return st.checkFailure(t, name, err)
79+
})
80+
})
81+
}
82+
})
6783
}
6884

6985
// Transactions with gasLimit above this value will not get a VM trace on failure.

tests/testdata

Submodule testdata updated 7840 files

0 commit comments

Comments
 (0)