diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 11:22:32 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:53 +0200 |
commit | c5b55a9f04b6d0ee5506de9631a62bd351350799 (patch) | |
tree | d57b3541b337812047f7ad6a672505b3c27d817d /tests | |
parent | 9635141fdd8aaa73657f7a6644d9dc200ea05332 (diff) |
Use do_run_from_file() for test_longjmp_repeat
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test_longjmp_repeat.in | 15 | ||||
-rw-r--r-- | tests/core/test_longjmp_repeat.out | 8 | ||||
-rw-r--r-- | tests/test_core.py | 26 |
3 files changed, 26 insertions, 23 deletions
diff --git a/tests/core/test_longjmp_repeat.in b/tests/core/test_longjmp_repeat.in new file mode 100644 index 00000000..4476f8dd --- /dev/null +++ b/tests/core/test_longjmp_repeat.in @@ -0,0 +1,15 @@ + + #include <stdio.h> + #include <setjmp.h> + + static jmp_buf buf; + + int main() { + volatile int x = 0; + printf("setjmp:%d\n", setjmp(buf)); + x++; + printf("x:%d\n", x); + if (x < 4) longjmp(buf, x*2); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_longjmp_repeat.out b/tests/core/test_longjmp_repeat.out new file mode 100644 index 00000000..8f4183b9 --- /dev/null +++ b/tests/core/test_longjmp_repeat.out @@ -0,0 +1,8 @@ +setjmp:0 +x:1 +setjmp:2 +x:2 +setjmp:4 +x:3 +setjmp:6 +x:4 diff --git a/tests/test_core.py b/tests/test_core.py index d16e02d3..136016e5 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1118,30 +1118,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co def test_longjmp_repeat(self): Settings.MAX_SETJMPS = 1 - src = r''' - #include <stdio.h> - #include <setjmp.h> - - static jmp_buf buf; + test_path = path_from_root('tests', 'core', 'test_longjmp_repeat') + src, output = (test_path + s for s in ('.in', '.out')) - int main() { - volatile int x = 0; - printf("setjmp:%d\n", setjmp(buf)); - x++; - printf("x:%d\n", x); - if (x < 4) longjmp(buf, x*2); - return 0; - } - ''' - self.do_run(src, '''setjmp:0 -x:1 -setjmp:2 -x:2 -setjmp:4 -x:3 -setjmp:6 -x:4 -''') + self.do_run_from_file(src, output) def test_longjmp_stacked(self): src = r''' |