|
19 | 19 | import subprocess |
20 | 20 | import sys |
21 | 21 | import unittest |
| 22 | +from collections import OrderedDict |
22 | 23 |
|
23 | 24 | from scripts.test.support import run_command, split_wast, write_wast |
24 | 25 | from scripts.test.shared import ( |
@@ -254,6 +255,10 @@ def run_wasm_metadce_tests(): |
254 | 255 |
|
255 | 256 |
|
256 | 257 | def run_wasm_reduce_tests(): |
| 258 | + if not has_shell_timeout(): |
| 259 | + print('\n[ skipping wasm-reduce testcases]\n') |
| 260 | + return |
| 261 | + |
257 | 262 | print('\n[ checking wasm-reduce testcases]\n') |
258 | 263 |
|
259 | 264 | # fixed testcases |
@@ -285,13 +290,13 @@ def run_wasm_reduce_tests(): |
285 | 290 | def run_spec_tests(): |
286 | 291 | print('\n[ checking wasm-shell spec testcases... ]\n') |
287 | 292 |
|
288 | | - if len(requested) == 0: |
| 293 | + if not options.spec_tests: |
289 | 294 | # FIXME we support old and new memory formats, for now, until 0xc, and so can't pass this old-style test. |
290 | 295 | BLACKLIST = ['binary.wast'] |
291 | 296 | # FIXME to update the spec to 0xd, we need to implement (register "name") for import.wast |
292 | 297 | spec_tests = [os.path.join('spec', t) for t in sorted(os.listdir(os.path.join(options.binaryen_test, 'spec'))) if t not in BLACKLIST] |
293 | 298 | else: |
294 | | - spec_tests = requested[:] |
| 299 | + spec_tests = options.spec_tests[:] |
295 | 300 |
|
296 | 301 | for t in spec_tests: |
297 | 302 | if t.startswith('spec') and t.endswith('.wast'): |
@@ -412,6 +417,10 @@ def run_validator_tests(): |
412 | 417 |
|
413 | 418 |
|
414 | 419 | def run_vanilla_tests(): |
| 420 | + if not (has_vanilla_emcc and has_vanilla_llvm and 0): |
| 421 | + print('\n[ skipping emcc WASM_BACKEND testcases...]\n') |
| 422 | + return |
| 423 | + |
415 | 424 | print('\n[ checking emcc WASM_BACKEND testcases...]\n') |
416 | 425 |
|
417 | 426 | try: |
@@ -522,30 +531,37 @@ def run_unittest(): |
522 | 531 | raise Exception("unittest failed") |
523 | 532 |
|
524 | 533 |
|
| 534 | +TEST_SUITES = OrderedDict([ |
| 535 | + ('help-messages', run_help_tests), |
| 536 | + ('wasm-opt', run_wasm_opt_tests), |
| 537 | + ('asm2wasm', asm2wasm.test_asm2wasm), |
| 538 | + ('asm2wasm-binary', asm2wasm.test_asm2wasm_binary), |
| 539 | + ('wasm-dis', run_wasm_dis_tests), |
| 540 | + ('crash', run_crash_tests), |
| 541 | + ('dylink', run_dylink_tests), |
| 542 | + ('ctor-eval', run_ctor_eval_tests), |
| 543 | + ('wasm-metadce', run_wasm_metadce_tests), |
| 544 | + ('wasm-reduce', run_wasm_reduce_tests), |
| 545 | + ('spec', run_spec_tests), |
| 546 | + ('binaryenjs', binaryenjs.test_binaryen_js), |
| 547 | + ('lld', lld.test_wasm_emscripten_finalize), |
| 548 | + ('wasm2js', wasm2js.test_wasm2js), |
| 549 | + ('validator', run_validator_tests), |
| 550 | + ('vanilla', run_vanilla_tests), |
| 551 | + ('gcc', run_gcc_tests), |
| 552 | + ('unit', run_unittest), |
| 553 | +]) |
| 554 | + |
| 555 | + |
525 | 556 | # Run all the tests |
526 | 557 | def main(): |
527 | | - run_help_tests() |
528 | | - run_wasm_opt_tests() |
529 | | - asm2wasm.test_asm2wasm() |
530 | | - asm2wasm.test_asm2wasm_binary() |
531 | | - run_wasm_dis_tests() |
532 | | - run_crash_tests() |
533 | | - run_dylink_tests() |
534 | | - run_ctor_eval_tests() |
535 | | - run_wasm_metadce_tests() |
536 | | - if has_shell_timeout(): |
537 | | - run_wasm_reduce_tests() |
538 | | - run_spec_tests() |
539 | | - binaryenjs.test_binaryen_js() |
540 | | - lld.test_wasm_emscripten_finalize() |
541 | | - wasm2js.test_wasm2js() |
542 | | - run_validator_tests() |
543 | | - if has_vanilla_emcc and has_vanilla_llvm and 0: |
544 | | - run_vanilla_tests() |
545 | | - print('\n[ checking example testcases... ]\n') |
546 | | - if options.run_gcc_tests: |
547 | | - run_gcc_tests() |
548 | | - run_unittest() |
| 558 | + if options.list_suites: |
| 559 | + for suite in TEST_SUITES.keys(): |
| 560 | + print(suite) |
| 561 | + return 0 |
| 562 | + |
| 563 | + for test in requested or TEST_SUITES.keys(): |
| 564 | + TEST_SUITES[test]() |
549 | 565 |
|
550 | 566 | # Check/display the results |
551 | 567 | if shared.num_failures == 0: |
|
0 commit comments