diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-04-28 16:59:06 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-04-28 17:04:51 -0700 |
commit | 5ba1a0e94fdb1f230efa34bfe5e2725ff7abef39 (patch) | |
tree | a7997d3d818b28f4908fc9e572df8dd54fc2cf98 /tests/runner.py | |
parent | 1796e1798ec0664d937644308f016d65af7b216a (diff) |
do not swallow exceptions in invoke_* that are not C++ exceptions or longjmp
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index b7a7478f..4092d3de 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -2630,6 +2630,37 @@ back 12 ''') + def test_longjmp_exc(self): + src = r''' + #include <stdlib.h> + #include <stdio.h> + #include <setjmp.h> + #include <emscripten.h> + + jmp_buf abortframe; + + void dostuff(int a) { + printf("pre\n"); + if (a != 42) emscripten_run_script("waka_waka()"); // this should fail, and never reach "never" + printf("never\n"); + + if (a == 100) { + longjmp (abortframe, -1); + } + + if (setjmp(abortframe)) { + printf("got 100"); + } + } + + int main(int argc, char **argv) { + dostuff(argc); + exit(1); + return 1; + } + ''' + self.do_run(src, 'waka_waka'); + def test_setjmp_many(self): src = r''' #include <stdio.h> |