diff options
Diffstat (limited to 'test/unit/test_asyncify.py')
-rw-r--r-- | test/unit/test_asyncify.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/test/unit/test_asyncify.py b/test/unit/test_asyncify.py index 052dedb0e..800f86ed7 100644 --- a/test/unit/test_asyncify.py +++ b/test/unit/test_asyncify.py @@ -2,19 +2,19 @@ import os import subprocess import tempfile -from scripts.test.shared import WASM_OPT, WASM_DIS, WASM_SHELL, NODEJS, run_process -from .utils import BinaryenTestCase +from scripts.test import shared +from . import utils -class AsyncifyTest(BinaryenTestCase): +class AsyncifyTest(utils.BinaryenTestCase): def test_asyncify_js(self): def test(args): print(args) - run_process(WASM_OPT + args + [self.input_path('asyncify-sleep.wast'), '--asyncify', '-o', 'a.wasm']) - run_process(WASM_OPT + args + [self.input_path('asyncify-coroutine.wast'), '--asyncify', '-o', 'b.wasm']) - run_process(WASM_OPT + args + [self.input_path('asyncify-stackOverflow.wast'), '--asyncify', '-o', 'c.wasm']) + shared.run_process(shared.WASM_OPT + args + [self.input_path('asyncify-sleep.wast'), '--asyncify', '-o', 'a.wasm']) + shared.run_process(shared.WASM_OPT + args + [self.input_path('asyncify-coroutine.wast'), '--asyncify', '-o', 'b.wasm']) + shared.run_process(shared.WASM_OPT + args + [self.input_path('asyncify-stackOverflow.wast'), '--asyncify', '-o', 'c.wasm']) print(' file size: %d' % os.path.getsize('a.wasm')) - run_process([NODEJS, self.input_path('asyncify.js')]) + shared.run_process([shared.NODEJS, self.input_path('asyncify.js')]) test(['-g']) test([]) @@ -24,9 +24,9 @@ class AsyncifyTest(BinaryenTestCase): test(['-Os', '-g']) def test_asyncify_pure_wasm(self): - run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '--asyncify', '-o', 'a.wasm']) - run_process(WASM_DIS + ['a.wasm', '-o', 'a.wast']) - output = run_process(WASM_SHELL + ['a.wast'], capture_output=True).stdout + shared.run_process(shared.WASM_OPT + [self.input_path('asyncify-pure.wast'), '--asyncify', '-o', 'a.wasm']) + shared.run_process(shared.WASM_DIS + ['a.wasm', '-o', 'a.wast']) + output = shared.run_process(shared.WASM_SHELL + ['a.wast'], capture_output=True).stdout with open(self.input_path('asyncify-pure.txt'), 'r') as f: self.assertEqual(f.read(), output) @@ -45,7 +45,7 @@ class AsyncifyTest(BinaryenTestCase): ('--pass-arg=asyncify-whitelist@DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)', None), ]: print(arg, warning) - err = run_process(WASM_OPT + ['-q', self.input_path('asyncify-pure.wast'), '--asyncify', arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE).stderr.strip() + err = shared.run_process(shared.WASM_OPT + ['-q', self.input_path('asyncify-pure.wast'), '--asyncify', arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE).stderr.strip() if warning: self.assertIn('warning', err) self.assertIn(warning, err) @@ -53,13 +53,13 @@ class AsyncifyTest(BinaryenTestCase): self.assertNotIn('warning', err) def test_asyncify_blacklist_and_whitelist(self): - proc = run_process(WASM_OPT + [self.input_path('asyncify-pure.wast'), '--asyncify', '--pass-arg=asyncify-whitelist@main', '--pass-arg=asyncify-blacklist@main'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False) + proc = shared.run_process(shared.WASM_OPT + [self.input_path('asyncify-pure.wast'), '--asyncify', '--pass-arg=asyncify-whitelist@main', '--pass-arg=asyncify-blacklist@main'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False) self.assertNotEqual(proc.returncode, 0, 'must error on using both lists at once') self.assertIn('It makes no sense to use both a blacklist and a whitelist with asyncify', proc.stdout) def test_asyncify_imports(self): def test(args): - return run_process(WASM_OPT + [self.input_path('asyncify-sleep.wast'), '--asyncify', '--print'] + args, stdout=subprocess.PIPE).stdout + return shared.run_process(shared.WASM_OPT + [self.input_path('asyncify-sleep.wast'), '--asyncify', '--print'] + args, stdout=subprocess.PIPE).stdout normal = test(['--pass-arg=asyncify-imports@env.sleep']) temp = tempfile.NamedTemporaryFile().name |