Skip to content

Commit b66518f

Browse files
Update auto_update_tests.py for trap-mode flags (#1225)
1 parent dfe92af commit b66518f

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

auto_update_tests.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,29 @@
4949
cmd += ['--source-map', os.path.join('test', wasm + '.map'), '-o', 'a.wasm']
5050
run_command(cmd)
5151

52+
extension_arg_map = {
53+
'.wast': [],
54+
'.clamp.wast': ['--trap-mode=clamp'],
55+
'.js.wast': ['--trap-mode=js'],
56+
}
5257
for dot_s_dir in ['dot_s', 'llvm_autogenerated']:
5358
for s in sorted(os.listdir(os.path.join('test', dot_s_dir))):
5459
if not s.endswith('.s'): continue
5560
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)
6675

6776
for t in sorted(os.listdir(os.path.join('test', 'print'))):
6877
if t.endswith('.wast'):

0 commit comments

Comments
 (0)