From fe8d32c4ece574dec5fd3959635f3caaa41ae56c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 28 Jan 2019 19:41:38 -0800 Subject: [PATCH 1/2] fix --- tests/test_core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 239aa57e58205..c80e8a31a7c04 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1404,7 +1404,7 @@ def test_stack_varargs(self): self.do_run_in_out_file_test('tests', 'core', 'test_stack_varargs') def test_stack_varargs2(self): - self.set_setting('TOTAL_STACK', 4096) + self.set_setting('TOTAL_STACK', 8 * 1024) src = r''' #include #include @@ -1412,7 +1412,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 +1429,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 +1465,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); From bf888e512f9a04890eb8b780a240113054d2623d Mon Sep 17 00:00:00 2001 From: "Alon Zakai (kripken)" Date: Tue, 29 Jan 2019 05:49:17 -0800 Subject: [PATCH 2/2] fix another test + add comment --- tests/core/test_stack_varargs.c | 2 +- tests/test_core.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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 c80e8a31a7c04..0fd6bccab1276 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1398,12 +1398,20 @@ 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): + # 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