diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-28 15:25:42 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-28 15:25:42 -0800 |
commit | 2d43e52b3ae1589d0f3127373e92a689e651ed33 (patch) | |
tree | 8e95d970284840b040143c4f26877954539b7412 /check.py | |
parent | b4a8d4f3e58426e3807f7f4f5d1e983ee2737c03 (diff) | |
download | binaryen-2d43e52b3ae1589d0f3127373e92a689e651ed33.tar.gz binaryen-2d43e52b3ae1589d0f3127373e92a689e651ed33.tar.bz2 binaryen-2d43e52b3ae1589d0f3127373e92a689e651ed33.zip |
prepare to test s-parsing in wasm.js
Diffstat (limited to 'check.py')
-rwxr-xr-x | check.py | 41 |
1 files changed, 22 insertions, 19 deletions
@@ -168,25 +168,28 @@ for c in tests: extra = json.loads(open(emcc).read()) if os.path.exists('a.normal.js'): os.unlink('a.normal.js') for opts in [[], ['-O1'], ['-O2'], ['-O3'], ['-Oz']]: - command = ['emcc', '-o', 'a.wasm.js', '-s', 'BINARYEN="' + os.getcwd() + '"', os.path.join('test', c)] + opts + extra - subprocess.check_call(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - print '....' + ' '.join(command) - if post: - open('a.wasm.js', 'a').write(post) - else: - print ' (no post)' - for which in ['wasm']: - print '......', which - try: - args = json.loads(open(os.path.join('test', base + '.args')).read()) - except: - args = [] - print ' (no args)' - proc = subprocess.Popen(['nodejs', 'a.' + which + '.js'] + args, stdout=subprocess.PIPE) - out, err = proc.communicate() - assert proc.returncode == 0 - if out.strip() != expected.strip(): - fail(out, expected) + for method in [None, 'asm2wasm']:#, 'wasm-s-parser']: + command = ['emcc', '-o', 'a.wasm.js', '-s', 'BINARYEN="' + os.getcwd() + '"', os.path.join('test', c)] + opts + extra + if method: + command += ['-s', 'BINARYEN_METHOD="' + method + '"'] + subprocess.check_call(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + print '....' + ' '.join(command) + if post: + open('a.wasm.js', 'a').write(post) + else: + print ' (no post)' + for which in ['wasm']: + print '......', which + try: + args = json.loads(open(os.path.join('test', base + '.args')).read()) + except: + args = [] + print ' (no args)' + proc = subprocess.Popen(['nodejs', 'a.' + which + '.js'] + args, stdout=subprocess.PIPE) + out, err = proc.communicate() + assert proc.returncode == 0 + if out.strip() != expected.strip(): + fail(out, expected) print '\n[ success! ]' |