]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: tests: avoid ENOSPC specific handling
authorPádraig Brady <P@draigBrady.com>
Tue, 17 Feb 2026 21:59:16 +0000 (21:59 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 18 Feb 2026 18:31:49 +0000 (18:31 +0000)
* 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.

tests/csplit/csplit-io-err.sh
tests/fold/fold-zero-width.sh
tests/misc/io-errors.sh
tests/misc/write-errors.sh
tests/split/split-io-err.sh
tests/tac/tac-continue.sh

index 783d2b2c9c4504e39d979692bf8da24522442581..6902f11e82879c3bdbef702bcc06aee64817b63b 100755 (executable)
 
 . "${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
index b4787eae0f72c5466afc748d4a0d96315a73958c..402b2b55eee12baea25cecc2523fd66745fa9b6e 100755 (executable)
@@ -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
 }
index aa514f67c365415cb8fef33e18cd19b97e3c1ce9..e1f03f595421bbd81c2352b262dbb8497d8b72e4 100755 (executable)
@@ -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
index 3773dda39f89b3c7f00108d0f2457771e9edd7da..20ba0ab1c35180ad6ad1cf30524fd486b7cb6531 100755 (executable)
@@ -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
index 3eb9dbb93f0b92d032acc5b784443c1db7384c21..2e3b3f632d93d7b09d17e23decb450e746a76214 100755 (executable)
 
 . "${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
index 678c07799807410caeb801254c71ba2ec12d68ec..4123755f292518f9d4425d99950b0b33c6132c59 100755 (executable)
@@ -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