summaryrefslogtreecommitdiff
path: root/check.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-28 15:25:42 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-28 15:25:42 -0800
commit2d43e52b3ae1589d0f3127373e92a689e651ed33 (patch)
tree8e95d970284840b040143c4f26877954539b7412 /check.py
parentb4a8d4f3e58426e3807f7f4f5d1e983ee2737c03 (diff)
downloadbinaryen-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-xcheck.py41
1 files changed, 22 insertions, 19 deletions
diff --git a/check.py b/check.py
index e7428eb3c..ea3b05dc5 100755
--- a/check.py
+++ b/check.py
@@ -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! ]'