|
49 | 49 | cmd += ['--source-map', os.path.join('test', wasm + '.map'), '-o', 'a.wasm'] |
50 | 50 | run_command(cmd) |
51 | 51 |
|
| 52 | +extension_arg_map = { |
| 53 | + '.wast': [], |
| 54 | + '.clamp.wast': ['--trap-mode=clamp'], |
| 55 | + '.js.wast': ['--trap-mode=js'], |
| 56 | +} |
52 | 57 | for dot_s_dir in ['dot_s', 'llvm_autogenerated']: |
53 | 58 | for s in sorted(os.listdir(os.path.join('test', dot_s_dir))): |
54 | 59 | if not s.endswith('.s'): continue |
55 | 60 | print '..', s |
56 | | - wasm = s.replace('.s', '.wast') |
57 | | - full = os.path.join('test', dot_s_dir, s) |
58 | | - stack_alloc = ['--allocate-stack=1024'] if dot_s_dir == 'llvm_autogenerated' else [] |
59 | | - cmd = S2WASM + [full, '--emscripten-glue'] + stack_alloc |
60 | | - if s.startswith('start_'): |
61 | | - cmd.append('--start') |
62 | | - actual = run_command(cmd, stderr=subprocess.PIPE, expected_err='') |
63 | | - |
64 | | - expected_file = os.path.join('test', dot_s_dir, wasm) |
65 | | - with open(expected_file, 'w') as o: o.write(actual) |
| 61 | + for ext, ext_args in extension_arg_map.iteritems(): |
| 62 | + wasm = s.replace('.s', ext) |
| 63 | + expected_file = os.path.join('test', dot_s_dir, wasm) |
| 64 | + if ext != '.wast' and not os.path.exists(expected_file): |
| 65 | + continue |
| 66 | + |
| 67 | + full = os.path.join('test', dot_s_dir, s) |
| 68 | + stack_alloc = ['--allocate-stack=1024'] if dot_s_dir == 'llvm_autogenerated' else [] |
| 69 | + cmd = S2WASM + [full, '--emscripten-glue'] + stack_alloc + ext_args |
| 70 | + if s.startswith('start_'): |
| 71 | + cmd.append('--start') |
| 72 | + actual = run_command(cmd, stderr=subprocess.PIPE, expected_err='') |
| 73 | + |
| 74 | + with open(expected_file, 'w') as o: o.write(actual) |
66 | 75 |
|
67 | 76 | for t in sorted(os.listdir(os.path.join('test', 'print'))): |
68 | 77 | if t.endswith('.wast'): |
|
0 commit comments