summaryrefslogtreecommitdiff
path: root/test/unit/test_bysyncify.py
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-06-21 14:48:06 -0700
committerGitHub <noreply@github.com>2019-06-21 14:48:06 -0700
commitcbc7e868d85a81e1a2f802b633d3cf323a14338f (patch)
treed59a65d99f4d10b281da4ffe6612ea25b8f6e820 /test/unit/test_bysyncify.py
parent3f797c82e49bb2a5e5f6bcd2393e369ef618a49b (diff)
downloadbinaryen-cbc7e868d85a81e1a2f802b633d3cf323a14338f.tar.gz
binaryen-cbc7e868d85a81e1a2f802b633d3cf323a14338f.tar.bz2
binaryen-cbc7e868d85a81e1a2f802b633d3cf323a14338f.zip
Bysyncify: Don't instrument functions that call bysyncify_* directly (#2179)
Those functions are assumed to be part of the runtime. Instrumenting them would mean nothing can work. With this fix, bysyncify is useful with pure wasm, and not just through imports.
Diffstat (limited to 'test/unit/test_bysyncify.py')
-rw-r--r--test/unit/test_bysyncify.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/unit/test_bysyncify.py b/test/unit/test_bysyncify.py
index 29a8ae7cb..8d5a780e8 100644
--- a/test/unit/test_bysyncify.py
+++ b/test/unit/test_bysyncify.py
@@ -1,11 +1,11 @@
import os
-from scripts.test.shared import WASM_OPT, NODEJS, run_process
+from scripts.test.shared import WASM_OPT, WASM_DIS, WASM_SHELL, NODEJS, run_process
from utils import BinaryenTestCase
class BysyncifyTest(BinaryenTestCase):
- def test_bysyncify(self):
+ def test_bysyncify_js(self):
def test(args):
print(args)
run_process(WASM_OPT + args + [self.input_path('bysyncify-sleep.wast'), '--bysyncify', '-o', 'a.wasm'])
@@ -19,3 +19,10 @@ class BysyncifyTest(BinaryenTestCase):
test(['--optimize-level=1'])
test(['-O3'])
test(['-Os', '-g'])
+
+ def test_bysyncify_pure_wasm(self):
+ run_process(WASM_OPT + [self.input_path('bysyncify-pure.wast'), '--bysyncify', '-o', 'a.wasm'])
+ run_process(WASM_DIS + ['a.wasm', '-o', 'a.wast'])
+ output = run_process(WASM_SHELL + ['a.wast'], capture_output=True).stdout
+ with open(self.input_path('bysyncify-pure.txt')) as f:
+ self.assertEqual(f.read(), output)