Skip to content

Commit c6750b1

Browse files
committed
ensure proper stack limit use + raise in debug mode
1 parent ab0c604 commit c6750b1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

test/run_tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test_fail() {
3131
}
3232

3333
# if tester segfaults, it's most likely due to a stack overflow
34-
# check the max stack size in tester.d in that case
34+
# check the maxStackSize variable in tester.d in that case
3535
# (increasing it should be avoided if it's possible to implement tail recursion or other stack saving techniques)
3636

3737
for i in $PASS_FILES; do
@@ -116,9 +116,9 @@ fi
116116
echo
117117
find . -name "*.lst" -exec rm -f {} \;
118118
echo -en "Generating coverage reports... "
119-
${DMD} tester.d -cov -unittest $SOURCE_FILES $IMPORT_PATHS
119+
${DMD} tester.d -debug -cov -unittest $SOURCE_FILES $IMPORT_PATHS
120120
# if tester segfaults, it's most likely due to a stack overflow
121-
# check the max stack size in tester.d in that case
121+
# check the maxStackSize variable in tester.d in that case
122122
# (increasing it should be avoided if it's possible to implement tail recursion or other stack saving techniques)
123123
./tester --ast --DRT-testmode=run-main $PASS_FILES $FAIL_FILES ast_checks/*.d &> /dev/null || true
124124
rm -rf coverage/

test/tester.d

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,13 @@ int main(string[] args)
307307
printer.output = stdout;
308308
bool done;
309309

310+
// increase stack size in case of segfault:
311+
// stack usage in debug / non-optimized mode is _much_ higher
310312
version (D_Coverage)
311-
enum maxStackSize = 128 * 4096;
313+
enum maxStackSize = 256 * 4096;
312314
else debug
313-
enum maxStackSize = 128 * 4096;
314-
else // increase stack size in case of segfault:
315+
enum maxStackSize = 256 * 4096;
316+
else
315317
enum maxStackSize = 40 * 4096;
316318

317319
// use a fiber to limit stack size

0 commit comments

Comments
 (0)