diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 12:12:45 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:35:55 +0200 |
commit | 63bc2652b446c651829cff8bae069646803db870 (patch) | |
tree | aa4b88ae0cf5b49b9d2fb28221ff817422a1e16d | |
parent | 691d17950f6e5cf9210542447ae05f3952a295c2 (diff) |
Use do_run_from_file() for test_stack_varargs
-rw-r--r-- | tests/core/test_stack_varargs.in | 16 | ||||
-rw-r--r-- | tests/core/test_stack_varargs.out | 1 | ||||
-rw-r--r-- | tests/test_core.py | 21 |
3 files changed, 21 insertions, 17 deletions
diff --git a/tests/core/test_stack_varargs.in b/tests/core/test_stack_varargs.in new file mode 100644 index 00000000..74b600bd --- /dev/null +++ b/tests/core/test_stack_varargs.in @@ -0,0 +1,16 @@ + +// We should not blow up the stack with numerous varargs + #include <stdio.h> + #include <stdlib.h> + + void func(int i) { + printf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", + i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i); + } + int main() { + for (int i = 0; i < 1024; i++) + func(i); + printf("ok!\n"); + return 0; + } + diff --git a/tests/core/test_stack_varargs.out b/tests/core/test_stack_varargs.out new file mode 100644 index 00000000..e036282a --- /dev/null +++ b/tests/core/test_stack_varargs.out @@ -0,0 +1 @@ +ok!
\ No newline at end of file diff --git a/tests/test_core.py b/tests/test_core.py index 5e38034e..817fc5be 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1581,25 +1581,12 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co if self.emcc_args is None: return # too slow in other modes Settings.INLINING_LIMIT = 50 + Settings.TOTAL_STACK = 1024 - # We should not blow up the stack with numerous varargs - src = r''' - #include <stdio.h> - #include <stdlib.h> + test_path = path_from_root('tests', 'core', 'test_stack_varargs') + src, output = (test_path + s for s in ('.in', '.out')) - void func(int i) { - printf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n", - i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, i); - } - int main() { - for (int i = 0; i < 1024; i++) - func(i); - printf("ok!\n"); - return 0; - } - ''' - Settings.TOTAL_STACK = 1024 - self.do_run(src, 'ok!') + self.do_run_from_file(src, output) def test_stack_varargs2(self): if self.emcc_args is None: return # too slow in other modes |