Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/core/test_stack_varargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
18 changes: 13 additions & 5 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,21 +1398,29 @@ 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 <stdio.h>
#include <stdlib.h>

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);
}
Expand All @@ -1429,7 +1437,7 @@ def test_stack_varargs2(self):
#include <stdlib.h>

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);
Expand Down Expand Up @@ -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);
Expand Down