From: Pádraig Brady
Date: Tue, 17 Feb 2026 21:59:16 +0000 (+0000) Subject: maint: tests: avoid ENOSPC specific handling X-Git-Tag: v9.11~262 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=448a7dc072072a56eddb770491504a813a31486f;p=thirdparty%2Fcoreutils.git maint: tests: avoid ENOSPC specific handling * tests/csplit/csplit-io-err.sh: Adjust determination of ENOSPC. * tests/csplit/split-io-err.sh: Likewise. * tests/fold/fold-zero-width.sh: Verify full ENOSPC message. * tests/tac/tac-continue.sh: Likewise. * tests/misc/io-errors.sh: Likewise. * tests/misc/write-errors.sh: Likewise. --- diff --git a/tests/csplit/csplit-io-err.sh b/tests/csplit/csplit-io-err.sh index 783d2b2c9c..6902f11e82 100755 --- a/tests/csplit/csplit-io-err.sh +++ b/tests/csplit/csplit-io-err.sh @@ -18,15 +18,12 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ csplit +getlimits_ cp -sf /dev/full xx01 || skip_ '/dev/full is required' -# Get the wording of the OS-dependent ENOSPC message -returns_ 1 seq 1 >/dev/full 2>msgt || framework_failure_ -sed 's/seq: write error: //' msgt > msg || framework_failure_ - # Create the expected error message -{ printf "%s" "csplit: xx01: " ; cat msg ; } > exp || framework_failure_ +printf '%s\n' "csplit: xx01: $ENOSPC" > exp || framework_failure_ # the 'csplit' command should fail with exit code 1 seq 2 | returns_ 1 csplit - 1 2> err || fail=1 diff --git a/tests/fold/fold-zero-width.sh b/tests/fold/fold-zero-width.sh index b4787eae0f..402b2b55ee 100755 --- a/tests/fold/fold-zero-width.sh +++ b/tests/fold/fold-zero-width.sh @@ -33,8 +33,11 @@ test $(wc -l < out) -eq $(($IO_BUFSIZE_TIMES2 / 80)) || fail=1 test "$LOCALE_FR_UTF8" != none || skip_ "French UTF-8 locale not available" -LC_ALL=$LOCALE_FR_UTF8 -export LC_ALL +# Only set LC_CTYPE so messages are not translated +# as we're verifying $ENOSPC below +unset LC_ALL +LC_CTYPE=$LOCALE_FR_UTF8 +export LC_CTYPE test $(env printf '\u200B' | wc -L) -eq 0 || skip_ "character width mismatch" @@ -58,7 +61,7 @@ vm=$(get_min_ulimit_v_ fold /dev/null) && { "(ulimit -v $(($vm+12000)) && fold 2>err >/dev/full)" ret=$? test -f err || skip_ 'shell ulimit failure' - { test $ret = 124 || ! grep 'space' err >/dev/null; } && + { test $ret = 124 || ! grep "$ENOSPC" err >/dev/null; } && { fail=1; cat err; echo "fold didn't diagnose ENOSPC" >&2; } done } diff --git a/tests/misc/io-errors.sh b/tests/misc/io-errors.sh index aa514f67c3..e1f03f5954 100755 --- a/tests/misc/io-errors.sh +++ b/tests/misc/io-errors.sh @@ -18,6 +18,7 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ env +getlimits_ if ! test -w /dev/full || ! test -c /dev/full; then skip_ '/dev/full is required' @@ -80,7 +81,7 @@ while read writer; do rm -f full.err || framework_failure_ timeout 10 env --default-signal=PIPE $SHELL -c \ "(env $writer 2>full.err >/dev/full)" - { test $? = 124 || ! grep -E 'write error|space' full.err >/dev/null; } && + { test $? = 124 || ! grep -E "write error|$ENOSPC" full.err >/dev/null; } && { fail=1; cat full.err; echo "$writer: failed to exit" >&2; } # Check closed pipe handling diff --git a/tests/misc/write-errors.sh b/tests/misc/write-errors.sh index 3773dda39f..20ba0ab1c3 100755 --- a/tests/misc/write-errors.sh +++ b/tests/misc/write-errors.sh @@ -82,7 +82,7 @@ while read writer; do rm -f full.err || framework_failure_ timeout 10 env --default-signal=PIPE $SHELL -c \ "($ulimit && $writer 2>full.err >/dev/full)" - { test $? = 124 || ! grep 'space' full.err >/dev/null; } && + { test $? = 124 || ! grep "$ENOSPC" full.err >/dev/null; } && { fail=1; cat full.err; echo "$writer: failed to exit" >&2; } # Check closed pipe handling diff --git a/tests/split/split-io-err.sh b/tests/split/split-io-err.sh index 3eb9dbb93f..2e3b3f632d 100755 --- a/tests/split/split-io-err.sh +++ b/tests/split/split-io-err.sh @@ -18,15 +18,12 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ split +getlimits_ cp -sf /dev/full xaa || skip_ '/dev/full is required' -# Get the wording of the OS-dependent ENOSPC message -returns_ 1 seq 1 >/dev/full 2>msgt || framework_failure_ -sed 's/seq: write error: //' msgt > msg || framework_failure_ - # Create the expected error message -{ printf "%s" "split: xaa: " ; cat msg ; } > exp || framework_failure_ +printf '%s\n' "split: xaa: $ENOSPC" > exp || framework_failure_ # the 'split' command should fail with exit code 1 seq 2 | returns_ 1 split -b 1 2> err || fail=1 diff --git a/tests/tac/tac-continue.sh b/tests/tac/tac-continue.sh index 678c077998..4123755f29 100755 --- a/tests/tac/tac-continue.sh +++ b/tests/tac/tac-continue.sh @@ -21,6 +21,7 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ tac require_root_ +getlimits_ cwd=$(pwd) cleanup_() { cd /; umount "$cwd/full_tmp"; } @@ -37,7 +38,7 @@ seq 5 > five && seq 5 -1 1 > exp || framework_failure_ # Make sure we diagnose the failure but continue to subsequent files yes | TMPDIR=$cwd/full_tmp timeout 10 tac - five >out 2>err && fail=1 -{ test $? = 124 || ! grep 'space' err >/dev/null; } && fail=1 +{ test $? = 124 || ! grep "$ENOSPC" err >/dev/null; } && fail=1 compare exp out || fail=1 Exit $fail