Skip to content

Commit 6243853

Browse files
committed
[test] Remove OrderedDict usage
Builtin dicts are guaranteed ordered as of 3.7 and we require 3.10 these days.
1 parent 5ee10ed commit 6243853

File tree

6 files changed

+50
-49
lines changed

6 files changed

+50
-49
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -875,16 +875,20 @@ Non-lit tests can also be automatically updated in most cases. See
875875

876876
### Setting up dependencies
877877

878+
The Binaryen test suite is written in Python and requires Python >= 3.10.
879+
880+
Additional dependencies (such as the `lit` test runner) are specifed in
881+
`requirements-dev.txt`. Run `pip3 install -r requirements-dev.txt` to install
882+
these. Note that you need to have the location `pip` installs to in your `$PATH`
883+
(on linux, `~/.local/bin`).
884+
878885
```bash
879886
./third_party/setup.py [mozjs|v8|wabt|all]
880887
```
881888

882-
(or `python third_party/setup.py`) installs required dependencies like the SpiderMonkey JS shell, the V8 JS shell
883-
and WABT in `third_party/`. Other scripts automatically pick these up when installed.
884-
885-
Run `pip3 install -r requirements-dev.txt` to get the requirements for the `lit`
886-
tests. Note that you need to have the location `pip` installs to in your `$PATH`
887-
(on linux, `~/.local/bin`).
889+
(or `python third_party/setup.py`) installs required dependencies like the
890+
SpiderMonkey JS shell, the V8 JS shell and WABT in `third_party/`. Other scripts
891+
automatically pick these up when installed.
888892

889893
### Fuzzing
890894

check.py

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import subprocess
2121
import sys
2222
import unittest
23-
from collections import OrderedDict
2423
from contextlib import contextmanager
2524
from multiprocessing.pool import ThreadPool
2625
from pathlib import Path
@@ -422,25 +421,25 @@ def run():
422421
shared.with_pass_debug(run)
423422

424423

425-
TEST_SUITES = OrderedDict([
426-
('version', run_version_tests),
427-
('wasm-opt', wasm_opt.test_wasm_opt),
428-
('wasm-dis', run_wasm_dis_tests),
429-
('crash', run_crash_tests),
430-
('dylink', run_dylink_tests),
431-
('ctor-eval', run_ctor_eval_tests),
432-
('wasm-metadce', run_wasm_metadce_tests),
433-
('wasm-reduce', run_wasm_reduce_tests),
434-
('spec', run_spec_tests),
435-
('lld', lld.test_wasm_emscripten_finalize),
436-
('wasm2js', wasm2js.test_wasm2js),
437-
('validator', run_validator_tests),
438-
('example', run_example_tests),
439-
('unit', run_unittest),
440-
('binaryenjs', binaryenjs.test_binaryen_js),
441-
('lit', run_lit),
442-
('gtest', run_gtest),
443-
])
424+
TEST_SUITES = {
425+
'version': run_version_tests,
426+
'wasm-opt': wasm_opt.test_wasm_opt,
427+
'wasm-dis': run_wasm_dis_tests,
428+
'crash': run_crash_tests,
429+
'dylink': run_dylink_tests,
430+
'ctor-eval': run_ctor_eval_tests,
431+
'wasm-metadce': run_wasm_metadce_tests,
432+
'wasm-reduce': run_wasm_reduce_tests,
433+
'spec': run_spec_tests,
434+
'lld': lld.test_wasm_emscripten_finalize,
435+
'wasm2js': wasm2js.test_wasm2js,
436+
'validator': run_validator_tests,
437+
'example': run_example_tests,
438+
'unit': run_unittest,
439+
'binaryenjs': binaryenjs.test_binaryen_js,
440+
'lit': run_lit,
441+
'gtest': run_gtest,
442+
}
444443

445444

446445
# Run all the tests

scripts/auto_update_tests.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import os
1818
import subprocess
1919
import sys
20-
from collections import OrderedDict
2120

2221
from test import binaryenjs, lld, shared, support, wasm2js, wasm_opt
2322

@@ -159,19 +158,19 @@ def update_lit_tests():
159158
'--binaryen-bin=' + shared.options.binaryen_bin])
160159

161160

162-
TEST_SUITES = OrderedDict([
163-
('wasm-opt', wasm_opt.update_wasm_opt_tests),
164-
('wasm-dis', update_wasm_dis_tests),
165-
('example', update_example_tests),
166-
('ctor-eval', update_ctor_eval_tests),
167-
('wasm-metadce', update_metadce_tests),
168-
('wasm-reduce', update_reduce_tests),
169-
('spec', update_spec_tests),
170-
('lld', lld.update_lld_tests),
171-
('wasm2js', wasm2js.update_wasm2js_tests),
172-
('binaryenjs', binaryenjs.update_binaryen_js_tests),
173-
('lit', update_lit_tests),
174-
])
161+
TEST_SUITES = {
162+
'wasm-opt': wasm_opt.update_wasm_opt_tests,
163+
'wasm-dis': update_wasm_dis_tests,
164+
'example': update_example_tests,
165+
'ctor-eval': update_ctor_eval_tests,
166+
'wasm-metadce': update_metadce_tests,
167+
'wasm-reduce': update_reduce_tests,
168+
'spec': update_spec_tests,
169+
'lld': lld.update_lld_tests,
170+
'wasm2js': wasm2js.update_wasm2js_tests,
171+
'binaryenjs': binaryenjs.update_binaryen_js_tests,
172+
'lit': update_lit_tests,
173+
}
175174

176175

177176
def main():

scripts/gen-s-parser.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616

1717
import sys
1818

19-
if sys.version_info < (3, 10): # noqa: UP036
20-
print("python 3.10 required")
21-
sys.exit(1)
22-
19+
assert sys.version_info >= (3, 10), 'requires Python 3.10'
2320

2421
instructions = [
2522
("unreachable", "makeUnreachable()"),

scripts/test/shared.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import sys
2525
from pathlib import Path
2626

27+
assert sys.version_info >= (3, 10), 'requires Python 3.10'
28+
2729
# The C++ standard whose features are required to build Binaryen.
2830
# Keep in sync with CMakeLists.txt CXX_STANDARD
2931
cxx_standard = 17

third_party/setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ def wabt_main():
215215
print('* Something went wrong :(')
216216

217217

218-
TOOLS = collections.OrderedDict([
219-
('mozjs', mozjs_main),
220-
('v8', v8_main),
221-
('wabt', wabt_main),
222-
])
218+
TOOLS = {
219+
'mozjs': mozjs_main,
220+
'v8': v8_main,
221+
'wabt': wabt_main,
222+
}
223223

224224
if __name__ == '__main__':
225225
if len(sys.argv) < 2 or sys.argv[1] == '--help':

0 commit comments

Comments
 (0)