summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/core/test_longjmp_exc.in28
-rw-r--r--tests/core/test_longjmp_exc.out1
-rw-r--r--tests/test_core.py31
3 files changed, 32 insertions, 28 deletions
diff --git a/tests/core/test_longjmp_exc.in b/tests/core/test_longjmp_exc.in
new file mode 100644
index 00000000..3fc07b85
--- /dev/null
+++ b/tests/core/test_longjmp_exc.in
@@ -0,0 +1,28 @@
+
+ #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;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_longjmp_exc.out b/tests/core/test_longjmp_exc.out
new file mode 100644
index 00000000..b12dbd82
--- /dev/null
+++ b/tests/core/test_longjmp_exc.out
@@ -0,0 +1 @@
+waka_waka \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index 07edda55..17c1dffe 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1131,35 +1131,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
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");
- }
- }
+ test_path = path_from_root('tests', 'core', 'test_longjmp_exc')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main(int argc, char **argv) {
- dostuff(argc);
- exit(1);
- return 1;
- }
- '''
- self.do_run(src, 'waka_waka');
+ self.do_run_from_file(src, output)
def test_setjmp_many(self):
src = r'''