summaryrefslogtreecommitdiff
path: root/tests/test_core.py
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 11:09:29 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:53 +0200
commitbbd1757a00344ca8a309d88ea550502078236cc3 (patch)
tree98e4d27c2518581b05c129a5c18f7213c1269aeb /tests/test_core.py
parent313a23e64c357260c660166f67d32d64601f164a (diff)
Use do_run_from_file() for test_longjmp2
Diffstat (limited to 'tests/test_core.py')
-rw-r--r--tests/test_core.py46
1 files changed, 3 insertions, 43 deletions
diff --git a/tests/test_core.py b/tests/test_core.py
index 9646f09b..0d5e3c36 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1092,50 +1092,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
self.do_run_from_file(src, output)
def test_longjmp2(self):
- src = r'''
- #include <setjmp.h>
- #include <stdio.h>
-
- typedef struct {
- jmp_buf* jmp;
- } jmp_state;
-
- void stack_manipulate_func(jmp_state* s, int level) {
- jmp_buf buf;
-
- printf("Entering stack_manipulate_func, level: %d\n", level);
-
- if (level == 0) {
- s->jmp = &buf;
- if (setjmp(*(s->jmp)) == 0) {
- printf("Setjmp normal execution path, level: %d\n", level);
- stack_manipulate_func(s, level + 1);
- } else {
- printf("Setjmp error execution path, level: %d\n", level);
- }
- } else {
- printf("Perform longjmp at level %d\n", level);
- longjmp(*(s->jmp), 1);
- }
-
- printf("Exiting stack_manipulate_func, level: %d\n", level);
- }
-
- int main(int argc, char *argv[]) {
- jmp_state s;
- s.jmp = NULL;
- stack_manipulate_func(&s, 0);
+ test_path = path_from_root('tests', 'core', 'test_longjmp2')
+ src, output = (test_path + s for s in ('.in', '.out'))
- return 0;
- }
- '''
- self.do_run(src, '''Entering stack_manipulate_func, level: 0
-Setjmp normal execution path, level: 0
-Entering stack_manipulate_func, level: 1
-Perform longjmp at level 1
-Setjmp error execution path, level: 0
-Exiting stack_manipulate_func, level: 0
-''')
+ self.do_run_from_file(src, output)
def test_longjmp3(self):
src = r'''