mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-20 18:56:39 +02:00
tests: use system ENOSPC message
* tests/head/head-write-error.sh: Verify ENOSPC is output. * tests/misc/yes.sh: Likewise.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
print_ver_ head
|
||||
getlimits_
|
||||
|
||||
if ! test -w /dev/full || ! test -c /dev/full; then
|
||||
skip_ '/dev/full is required'
|
||||
@@ -29,21 +30,18 @@ fi
|
||||
yes | head -c10M > bigseek || framework_failure_
|
||||
|
||||
# This is the single output diagnostic expected,
|
||||
# (without the possibly varying :strerror(ENOSPC) suffix).
|
||||
printf '%s\n' "head: error writing 'standard output'" > exp
|
||||
printf '%s\n' "head: error writing 'standard output': $ENOSPC" > exp
|
||||
|
||||
# Memory is bounded in these cases
|
||||
for item in lines bytes; do
|
||||
for N in 0 1; do
|
||||
# pipe case
|
||||
yes | returns_ 1 timeout 10s head --$item=-$N > /dev/full 2> errt || fail=1
|
||||
sed 's/\(head:.*\):.*/\1/' errt > err
|
||||
yes | returns_ 1 timeout 10s head --$item=-$N > /dev/full 2> err || fail=1
|
||||
compare exp err || fail=1
|
||||
|
||||
# seekable case
|
||||
returns_ 1 timeout 10s head --$item=-$N bigseek > /dev/full 2> errt \
|
||||
returns_ 1 timeout 10s head --$item=-$N bigseek > /dev/full 2> err \
|
||||
|| fail=1
|
||||
sed 's/\(head:.*\):.*/\1/' errt > err
|
||||
compare exp err || fail=1
|
||||
done
|
||||
done
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
|
||||
print_ver_ yes
|
||||
getlimits_
|
||||
|
||||
# Check basic operation
|
||||
test "$(yes | head -n1)" = 'y' || fail=1
|
||||
@@ -47,11 +48,10 @@ fi
|
||||
if test -w /dev/full && test -c /dev/full; then
|
||||
# The single output diagnostic expected,
|
||||
# (without the possibly varying :strerror(ENOSPC) suffix).
|
||||
printf '%s\n' "yes: standard output" > exp
|
||||
printf '%s\n' "yes: standard output: $ENOSPC" > exp
|
||||
|
||||
for size in 1 16384; do
|
||||
returns_ 1 yes "$(printf %${size}s '')" >/dev/full 2>errt || fail=1
|
||||
sed 's/\(yes:.*\):.*/\1/' errt > err
|
||||
returns_ 1 yes "$(printf %${size}s '')" >/dev/full 2>err || fail=1
|
||||
compare exp err || fail=1
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user