diff --git a/tests/core/test_stack_varargs.c b/tests/core/test_stack_varargs.c index 00f0706787635..0fcf7a5979518 100644 --- a/tests/core/test_stack_varargs.c +++ b/tests/core/test_stack_varargs.c @@ -17,7 +17,7 @@ void func(int i) { i, i, i, i, i, i, i, i, i, i, i, i, i, i); } int main() { - for (int i = 0; i < 2048; i++) func(i); + for (int i = 0; i < 4 * 1024; i++) func(i); printf("ok!\n"); return 0; } diff --git a/tests/test_core.py b/tests/test_core.py index 239aa57e58205..0fd6bccab1276 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1398,13 +1398,21 @@ def test_stack_byval(self): self.do_run_in_out_file_test('tests', 'core', 'test_stack_byval') def test_stack_varargs(self): + # in node.js we allocate argv[0] on the stack, which means the length + # of the program directory influences how much stack we need, and so + # long random temp dir names can lead to random failures. The stack + # size was increased here to avoid that. self.set_setting('INLINING_LIMIT', 50) - self.set_setting('TOTAL_STACK', 4096) + self.set_setting('TOTAL_STACK', 8 * 1024) self.do_run_in_out_file_test('tests', 'core', 'test_stack_varargs') def test_stack_varargs2(self): - self.set_setting('TOTAL_STACK', 4096) + # in node.js we allocate argv[0] on the stack, which means the length + # of the program directory influences how much stack we need, and so + # long random temp dir names can lead to random failures. The stack + # size was increased here to avoid that. + self.set_setting('TOTAL_STACK', 8 * 1024) src = r''' #include #include @@ -1412,7 +1420,7 @@ def test_stack_varargs2(self): void func(int i) { } int main() { - for (int i = 0; i < 3072; i++) { + for (int i = 0; i < 7000; 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); } @@ -1429,7 +1437,7 @@ def test_stack_varargs2(self): #include int main() { - for (int i = 0; i < 3072; i++) { + for (int i = 0; i < 7000; i++) { int j = 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", 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); printf(" (%d)\n", j); @@ -1465,7 +1473,7 @@ def test_stack_varargs2(self): } int main() { - for (int i = 0; i < 3072; i++) { + for (int i = 0; i < 7000; i++) { int j = 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", 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); printf(" (%d)\n", j);