Skip to content

Commit 0903b0a

Browse files
authored
Merge pull request #14671 from NixOS/fix-asan-stack-overload-repl-doc
tests/functional: Work around stack overflows under ASAN in doc-funct…
2 parents 048a58d + a2acb6d commit 0903b0a

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

tests/functional/repl.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,9 @@ runRepl () {
350350
local testDirNoUnderscores
351351
testDirNoUnderscores="${testDir//_/}"
352352

353-
# TODO: pass arguments to nix repl; see lang.sh
354353
_NIX_TEST_RAW_MARKDOWN=1 \
355354
_NIX_TEST_REPL_ECHO=1 \
356-
nix repl 2>&1 \
355+
nix repl "$@" 2>&1 \
357356
| stripColors \
358357
| tr -d '\0' \
359358
| stripEmptyLinesBeforePrompt \
@@ -373,7 +372,12 @@ for test in $(cd "$testDir/repl"; echo *.in); do
373372
in="$testDir/repl/$test.in"
374373
actual="$TEST_ROOT/$test.actual"
375374
expected="$testDir/repl/$test.expected"
376-
(cd "$testDir/repl"; set +x; runRepl 2>&1) < "$in" > "$actual" || {
375+
declare -a flags=()
376+
if test -e "$testDir/repl/$test.flags"; then
377+
read -r -a flags < "$testDir/repl/$test.flags"
378+
fi
379+
380+
(cd "$testDir/repl"; set +x; runRepl "${flags[@]}" 2>&1) < "$in" > "$actual" || {
377381
echo "FAIL: $test (exit code $?)" >&2
378382
badExitCode=1
379383
}

tests/functional/repl/doc-functor.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ error:
4343
| ^
4444
91| };
4545

46-
(19999 duplicate frames omitted)
46+
(199 duplicate frames omitted)
4747

4848
error: stack overflow; max-call-depth exceeded
4949
at /path/to/tests/functional/repl/doc-functor.nix:90:23:
@@ -56,7 +56,7 @@ nix-repl> :doc diverging
5656
error:
5757
… while partially calling '__functor' to retrieve documentation
5858

59-
(10000 duplicate frames omitted)
59+
(100 duplicate frames omitted)
6060

6161
… while calling '__functor'
6262
at /path/to/tests/functional/repl/doc-functor.nix:103:21:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--max-call-depth 100

0 commit comments

Comments
 (0)