diff options
| author | Pádraig Brady <P@draigBrady.com> | 2025-08-25 11:38:42 +0100 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2025-08-26 16:48:31 +0100 |
| commit | 17be45b952f0284df6f8e6eecf87a69880712c42 (patch) | |
| tree | 33bedf9636f9962ef03f0ce9b60060cf4e9dfee3 /tests | |
| parent | fold: use fread instead of getline (diff) | |
| download | coreutils-17be45b952f0284df6f8e6eecf87a69880712c42.tar.gz coreutils-17be45b952f0284df6f8e6eecf87a69880712c42.zip | |
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.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/fold/fold-characters.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/fold/fold-characters.sh b/tests/fold/fold-characters.sh index 0b22aad6b..a6cc39b73 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 |
