forked from emscripten-core/emscripten
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse -s changes using the json parser where possible, allowing human…
…-readable C++ names in -s lists, which is important for Asyncify (emscripten-core#9132) We have nice syntax for lists, -s LIST=[foo,bar] which works well in many cases. But sometimes the list contains items that contain ",", for example -s LIST=["foo(x, y)", "bar"]. To handle that properly, try to parse things that look like json using the json parser; if it fails go back to the old code. Together with WebAssembly/binaryen#2275 this fixes emscripten-core#9128 where the lists there actually do have ","s in them. Add testing for Asyncify lists with such names, and also added extra warnings for when escaping is confusing, and a test for that as well.
- Loading branch information
Showing
4 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8833,6 +8833,23 @@ def test_emcc_parsing(self): | |
self.assertNotEqual(proc.returncode, 0) | ||
self.assertContained(expected, proc.stderr) | ||
|
||
@no_fastcomp('uses new ASYNCIFY') | ||
def test_asyncify_escaping(self): | ||
proc = run_process([PYTHON, EMCC, path_from_root('tests', 'hello_world.c'), '-s', 'ASYNCIFY=1', '-s', "ASYNCIFY_WHITELIST=[DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)]"], stdout=PIPE, stderr=PIPE) | ||
self.assertContained('emcc: ASYNCIFY list contains an item without balanced parentheses', proc.stderr) | ||
self.assertContained(' DOS_ReadFile(unsigned short', proc.stderr) | ||
self.assertContained('Try to quote the entire argument', proc.stderr) | ||
|
||
@no_fastcomp('uses new ASYNCIFY') | ||
def test_asyncify_response_file(self): | ||
create_test_file('a.txt', r'''[ | ||
"DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)" | ||
] | ||
''') | ||
proc = run_process([PYTHON, EMCC, path_from_root('tests', 'hello_world.c'), '-s', 'ASYNCIFY=1', '-s', "[email protected]"], stdout=PIPE, stderr=PIPE) | ||
# we should parse the response file properly, and then issue a proper warning for the missing function | ||
self.assertContained('Asyncify whitelist contained a non-existing function name: DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)', proc.stderr) | ||
|
||
# Sockets and networking | ||
|
||
def test_inet(self): | ||
|