From cbc7e868d85a81e1a2f802b633d3cf323a14338f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 21 Jun 2019 14:48:06 -0700 Subject: 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. --- test/unit/test_bysyncify.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'test/unit/test_bysyncify.py') 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) -- cgit v1.2.3