From: Pádraig Brady Date: Mon, 25 Aug 2025 10:38:42 +0000 (+0100) Subject: tests: fold: add a memory constraint test X-Git-Tag: v9.8~93 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=17be45b952f0284df6f8e6eecf87a69880712c42;p=thirdparty%2Fcoreutils.git tests: fold: add a memory constraint test Enforcing this interface behavior is worthwhile irrespective of our current implementation, to ensure future or other implementations conform. * tests/fold/fold-characters.sh: Ensure the fold implementation uses bounded memory. --- diff --git a/tests/fold/fold-characters.sh b/tests/fold/fold-characters.sh index 0b22aad6be..a6cc39b73c 100755 --- a/tests/fold/fold-characters.sh +++ b/tests/fold/fold-characters.sh @@ -58,4 +58,10 @@ compare column-exp2 column-out2 || fail=1 fold --characters -w 10 input2 > character-out2 || fail=1 compare character-exp2 character-out2 || fail=1 +# Ensure bounded memory operation +vm=$(get_min_ulimit_v_ fold /dev/null) && { + yes | tr -d '\n' | (ulimit -v $(($vm+8000)) && fold 2>err) | head -n10 || fail=1 + compare /dev/null err || fail=1 +} + Exit $fail