Skip to content

Commit eb43281

Browse files
committed
Properly skip the slowest tests
1 parent fb69f0d commit eb43281

File tree

1 file changed

+67
-53
lines changed

1 file changed

+67
-53
lines changed

tests/json-fixtures/test_blockchain.py

Lines changed: 67 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
genesis_params_from_fixture,
2626
load_fixture,
2727
new_chain_from_fixture,
28+
should_run_slow_tests,
2829
verify_account_db,
2930
)
3031

@@ -38,56 +39,56 @@
3839
# These are the slowest 50 tests from the full statetest run. This list should
3940
# be regenerated occasionally using `--durations 50`.
4041
SLOWEST_TESTS = {
41-
('stStaticCall/static_Call50000_sha256.json', 'static_Call50000_sha256'),
42-
('stStaticCall/static_Call50000_rip160.json', 'static_Call50000_rip160'),
43-
('stStaticCall/static_Call50000_sha256.json', 'static_Call50000_sha256'),
44-
('stStaticCall/static_Call50000.json', 'static_Call50000'),
45-
('stStaticCall/static_Call50000_ecrec.json', 'static_Call50000_ecrec'),
46-
('stStaticCall/static_Call50000_rip160.json', 'static_Call50000_rip160'),
47-
('stStaticCall/static_LoopCallsThenRevert.json', 'static_LoopCallsThenRevert'),
48-
('stStaticCall/static_Call50000_identity2.json', 'static_Call50000_identity2'),
49-
('stStaticCall/static_Call50000_identity.json', 'static_Call50000_identity'),
50-
('stStaticCall/static_Return50000_2.json', 'static_Return50000_2'),
51-
('stCallCreateCallCodeTest/Call1024PreCalls.json', 'Call1024PreCalls'),
52-
('stChangedEIP150/Call1024PreCalls.json', 'Call1024PreCalls'),
53-
('stDelegatecallTestHomestead/Call1024PreCalls.json', 'Call1024PreCalls'),
54-
('stStaticCall/static_Call50000.json', 'static_Call50000'),
55-
('stStaticCall/static_Call50000_ecrec.json', 'static_Call50000_ecrec'),
56-
('stStaticCall/static_Call1024PreCalls2.json', 'static_Call1024PreCalls2'),
57-
('stStaticCall/static_Call50000_identity.json', 'static_Call50000_identity'),
58-
('stStaticCall/static_Call50000_identity2.json', 'static_Call50000_identity2'),
59-
('stStaticCall/static_LoopCallsThenRevert.json', 'static_LoopCallsThenRevert'),
60-
('stCallCreateCallCodeTest/Call1024BalanceTooLow.json', 'Call1024BalanceTooLow'), # noqa: E501
61-
('stChangedEIP150/Call1024BalanceTooLow.json', 'Call1024BalanceTooLow'),
62-
('stCallCreateCallCodeTest/Callcode1024BalanceTooLow.json', 'Callcode1024BalanceTooLow'), # noqa: E501
63-
('stChangedEIP150/Callcode1024BalanceTooLow.json', 'Callcode1024BalanceTooLow'), # noqa: E501
64-
('stSystemOperationsTest/CallRecursiveBomb0_OOG_atMaxCallDepth.json', 'CallRecursiveBomb0_OOG_atMaxCallDepth'), # noqa: E501
65-
('stRevertTest/LoopCallsDepthThenRevert2.json', 'LoopCallsDepthThenRevert2'),
66-
('stRevertTest/LoopCallsDepthThenRevert3.json', 'LoopCallsDepthThenRevert3'),
67-
('stDelegatecallTestHomestead/CallRecursiveBombPreCall.json', 'CallRecursiveBombPreCall'), # noqa: E501
68-
('stRevertTest/LoopCallsThenRevert.json', 'LoopCallsThenRevert'),
69-
('stCallCreateCallCodeTest/CallRecursiveBombPreCall.json', 'CallRecursiveBombPreCall'), # noqa: E501
70-
('stStaticCall/static_Call50000bytesContract50_1.json', 'static_Call50000bytesContract50_1'), # noqa: E501
71-
('stStaticCall/static_Call1024PreCalls.json', 'static_Call1024PreCalls'),
72-
('stDelegatecallTestHomestead/Call1024BalanceTooLow.json', 'Call1024BalanceTooLow'), # noqa: E501
73-
('stDelegatecallTestHomestead/Delegatecall1024.json', 'Delegatecall1024'),
74-
('stRevertTest/LoopCallsThenRevert.json', 'LoopCallsThenRevert'),
75-
('stStaticCall/static_Call50000bytesContract50_2.json', 'static_Call50000bytesContract50_2'), # noqa: E501
76-
('stStaticCall/static_Call1024PreCalls2.json', 'static_Call1024PreCalls2'),
77-
('stRandom/randomStatetest636.json', 'randomStatetest636'),
78-
('stStaticCall/static_Call1024PreCalls3.json', 'static_Call1024PreCalls3'),
79-
('stRandom/randomStatetest467.json', 'randomStatetest467'),
80-
('stRandom/randomStatetest458.json', 'randomStatetest458'),
81-
('stRandom/randomStatetest150.json', 'randomStatetest150'),
82-
('stRandom/randomStatetest639.json', 'randomStatetest639'),
83-
('stStaticCall/static_LoopCallsDepthThenRevert2.json', 'static_LoopCallsDepthThenRevert2'), # noqa: E501
84-
('stRandom/randomStatetest154.json', 'randomStatetest154'),
85-
('stRecursiveCreate/recursiveCreateReturnValue.json', 'recursiveCreateReturnValue'), # noqa: E501
86-
('stStaticCall/static_LoopCallsDepthThenRevert3.json', 'static_LoopCallsDepthThenRevert3'), # noqa: E501
87-
('stSystemOperationsTest/ABAcalls1.json', 'ABAcalls1'),
88-
('stSpecialTest/failed_tx_xcf416c53.json', 'failed_tx_xcf416c53'),
89-
('stRandom/randomStatetest159.json', 'randomStatetest159'),
90-
('stRandom/randomStatetest554.json', 'randomStatetest554'),
42+
('GeneralStateTests/stStaticCall/static_Call50000_sha256', 'static_Call50000_sha256'),
43+
('GeneralStateTests/stStaticCall/static_Call50000_rip160', 'static_Call50000_rip160'),
44+
('GeneralStateTests/stStaticCall/static_Call50000_sha256', 'static_Call50000_sha256'),
45+
('GeneralStateTests/stStaticCall/static_Call50000', 'static_Call50000'),
46+
('GeneralStateTests/stStaticCall/static_Call50000_ecrec', 'static_Call50000_ecrec'),
47+
('GeneralStateTests/stStaticCall/static_Call50000_rip160', 'static_Call50000_rip160'),
48+
('GeneralStateTests/stStaticCall/static_LoopCallsThenRevert', 'static_LoopCallsThenRevert'),
49+
('GeneralStateTests/stStaticCall/static_Call50000_identity2', 'static_Call50000_identity2'),
50+
('GeneralStateTests/stStaticCall/static_Call50000_identity', 'static_Call50000_identity'),
51+
('GeneralStateTests/stStaticCall/static_Return50000_2', 'static_Return50000_2'),
52+
('GeneralStateTests/stCallCreateCallCodeTest/Call1024PreCalls', 'Call1024PreCalls'),
53+
('GeneralStateTests/stChangedEIP150/Call1024PreCalls', 'Call1024PreCalls'),
54+
('GeneralStateTests/stDelegatecallTestHomestead/Call1024PreCalls', 'Call1024PreCalls'),
55+
('GeneralStateTests/stStaticCall/static_Call50000', 'static_Call50000'),
56+
('GeneralStateTests/stStaticCall/static_Call50000_ecrec', 'static_Call50000_ecrec'),
57+
('GeneralStateTests/stStaticCall/static_Call1024PreCalls2', 'static_Call1024PreCalls2'),
58+
('GeneralStateTests/stStaticCall/static_Call50000_identity', 'static_Call50000_identity'),
59+
('GeneralStateTests/stStaticCall/static_Call50000_identity2', 'static_Call50000_identity2'),
60+
('GeneralStateTests/stStaticCall/static_LoopCallsThenRevert', 'static_LoopCallsThenRevert'),
61+
('GeneralStateTests/stCallCreateCallCodeTest/Call1024BalanceTooLow', 'Call1024BalanceTooLow'), # noqa: E501
62+
('GeneralStateTests/stChangedEIP150/Call1024BalanceTooLow', 'Call1024BalanceTooLow'),
63+
('GeneralStateTests/stCallCreateCallCodeTest/Callcode1024BalanceTooLow', 'Callcode1024BalanceTooLow'), # noqa: E501
64+
('GeneralStateTests/stChangedEIP150/Callcode1024BalanceTooLow', 'Callcode1024BalanceTooLow'), # noqa: E501
65+
('GeneralStateTests/stSystemOperationsTest/CallRecursiveBomb0_OOG_atMaxCallDepth', 'CallRecursiveBomb0_OOG_atMaxCallDepth'), # noqa: E501
66+
('GeneralStateTests/stRevertTest/LoopCallsDepthThenRevert2', 'LoopCallsDepthThenRevert2'),
67+
('GeneralStateTests/stRevertTest/LoopCallsDepthThenRevert3', 'LoopCallsDepthThenRevert3'),
68+
('GeneralStateTests/stDelegatecallTestHomestead/CallRecursiveBombPreCall', 'CallRecursiveBombPreCall'), # noqa: E501
69+
('GeneralStateTests/stRevertTest/LoopCallsThenRevert', 'LoopCallsThenRevert'),
70+
('GeneralStateTests/stCallCreateCallCodeTest/CallRecursiveBombPreCall', 'CallRecursiveBombPreCall'), # noqa: E501
71+
('GeneralStateTests/stStaticCall/static_Call50000bytesContract50_1', 'static_Call50000bytesContract50_1'), # noqa: E501
72+
('GeneralStateTests/stStaticCall/static_Call1024PreCalls', 'static_Call1024PreCalls'),
73+
('GeneralStateTests/stDelegatecallTestHomestead/Call1024BalanceTooLow', 'Call1024BalanceTooLow'), # noqa: E501
74+
('GeneralStateTests/stDelegatecallTestHomestead/Delegatecall1024', 'Delegatecall1024'),
75+
('GeneralStateTests/stRevertTest/LoopCallsThenRevert', 'LoopCallsThenRevert'),
76+
('GeneralStateTests/stStaticCall/static_Call50000bytesContract50_2', 'static_Call50000bytesContract50_2'), # noqa: E501
77+
('GeneralStateTests/stStaticCall/static_Call1024PreCalls2', 'static_Call1024PreCalls2'),
78+
('GeneralStateTests/stRandom/randomStatetest636', 'randomStatetest636'),
79+
('GeneralStateTests/stStaticCall/static_Call1024PreCalls3', 'static_Call1024PreCalls3'),
80+
('GeneralStateTests/stRandom/randomStatetest467', 'randomStatetest467'),
81+
('GeneralStateTests/stRandom/randomStatetest458', 'randomStatetest458'),
82+
('GeneralStateTests/stRandom/randomStatetest150', 'randomStatetest150'),
83+
('GeneralStateTests/stRandom/randomStatetest639', 'randomStatetest639'),
84+
('GeneralStateTests/stStaticCall/static_LoopCallsDepthThenRevert2', 'static_LoopCallsDepthThenRevert2'), # noqa: E501
85+
('GeneralStateTests/stRandom/randomStatetest154', 'randomStatetest154'),
86+
('GeneralStateTests/stRecursiveCreate/recursiveCreateReturnValue', 'recursiveCreateReturnValue'), # noqa: E501
87+
('GeneralStateTests/stStaticCall/static_LoopCallsDepthThenRevert3', 'static_LoopCallsDepthThenRevert3'), # noqa: E501
88+
('GeneralStateTests/stSystemOperationsTest/ABAcalls1', 'ABAcalls1'),
89+
('GeneralStateTests/stSpecialTest/failed_tx_xcf416c53', 'failed_tx_xcf416c53'),
90+
('GeneralStateTests/stRandom/randomStatetest159', 'randomStatetest159'),
91+
('GeneralStateTests/stRandom/randomStatetest554', 'randomStatetest554'),
9192
}
9293

9394

@@ -106,17 +107,30 @@
106107

107108

108109
def blockchain_fixture_mark_fn(fixture_path, fixture_name, fixture_fork):
109-
fixture_id = (fixture_path, fixture_name)
110+
111+
# XXX Very ugly, not mergable
112+
def strip_path(path):
113+
'''
114+
>>> strip_path('static_Call50000_d0g0v0.json')
115+
'static_Call50000'
116+
'''
117+
assert path.endswith('.json')
118+
stripped_path = path[:-5]
119+
return '_'.join(stripped_path.split('_')[:-1])
120+
121+
stripped_path = strip_path(fixture_path)
122+
stripped_name = '_'.join(fixture_name.split('_')[:-2])
123+
# XXX End very ugly part
110124

111125
if fixture_path.startswith('bcExploitTest'):
112126
return pytest.mark.skip("Exploit tests are slow")
113127
elif fixture_path == 'bcWalletTest/walletReorganizeOwners.json':
114128
return pytest.mark.skip("Wallet owner reorganization tests are slow")
115-
elif fixture_id in INCORRECT_UPSTREAM_TESTS:
129+
elif (fixture_path, fixture_name) in INCORRECT_UPSTREAM_TESTS:
116130
return pytest.mark.xfail(reason="Listed in INCORRECT_UPSTREAM_TESTS.")
117131
elif 'stTransactionTest/zeroSigTransa' in fixture_path:
118132
return pytest.mark.skip("EIP-86 not supported.")
119-
elif fixture_id in SLOWEST_TESTS:
133+
elif (stripped_path, stripped_name) in SLOWEST_TESTS:
120134
if should_run_slow_tests():
121135
return
122136
else:

0 commit comments

Comments
 (0)