diff options
Diffstat (limited to 'test/unit/test_asyncify.py')
-rw-r--r-- | test/unit/test_asyncify.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/test_asyncify.py b/test/unit/test_asyncify.py index 479d24cab..40ee160d2 100644 --- a/test/unit/test_asyncify.py +++ b/test/unit/test_asyncify.py @@ -1,4 +1,5 @@ import os +import subprocess from scripts.test.shared import WASM_OPT, WASM_DIS, WASM_SHELL, NODEJS, run_process from utils import BinaryenTestCase @@ -27,3 +28,23 @@ class AsyncifyTest(BinaryenTestCase): output = run_process(WASM_SHELL + ['a.wast'], capture_output=True).stdout with open(self.input_path('asyncify-pure.txt')) as f: self.assertEqual(f.read(), output) + + def test_asyncify_list_bad(self): + for arg, warning in [ + ('--pass-arg=asyncify-blacklist@nonexistent', 'nonexistent'), + ('--pass-arg=asyncify-whitelist@nonexistent', 'nonexistent'), + ('--pass-arg=asyncify-blacklist@main', None), + ('--pass-arg=asyncify-whitelist@main', None), + ]: + print(arg, warning) + err = run_process(WASM_OPT + [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) + else: + 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) + 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) |