summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-08-30 16:51:09 -0700
committerGitHub <noreply@github.com>2019-08-30 16:51:09 -0700
commitb61f67c33daa45bab1fff1941c42ea41ee8e36a8 (patch)
treecd7ea831bba3f01b61cc8a0f4c6373b0ca0e43b0 /test
parenta537db2a966b1fc959754c3838e3eab04ee7cc77 (diff)
downloadbinaryen-b61f67c33daa45bab1fff1941c42ea41ee8e36a8.tar.gz
binaryen-b61f67c33daa45bab1fff1941c42ea41ee8e36a8.tar.bz2
binaryen-b61f67c33daa45bab1fff1941c42ea41ee8e36a8.zip
Support response files, and use that in Asyncify (#2319)
See emscripten-core/emscripten#9206, the asyncify names can need complex escaping, so this provides an escape hatch.
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_asyncify.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/test_asyncify.py b/test/unit/test_asyncify.py
index a8161cc1d..e2fe82af9 100644
--- a/test/unit/test_asyncify.py
+++ b/test/unit/test_asyncify.py
@@ -1,5 +1,6 @@
import os
import subprocess
+import tempfile
from scripts.test.shared import WASM_OPT, WASM_DIS, WASM_SHELL, NODEJS, run_process
from .utils import BinaryenTestCase
@@ -50,3 +51,16 @@ class AsyncifyTest(BinaryenTestCase):
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)
+
+ 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
+
+ normal = test(['--pass-arg=asyncify-imports@env.sleep'])
+ temp = tempfile.NamedTemporaryFile().name
+ with open(temp, 'w') as f:
+ f.write('env.sleep')
+ response = test(['--pass-arg=asyncify-imports@@%s' % temp])
+ self.assertEqual(normal, response)
+ without = test(['--pass-arg=asyncify-imports@without.anything'])
+ self.assertNotEqual(normal, without)