tests: strace: consider splice a "read" syscall

* tests/cksum/cksum-c.sh: Add 'splice' to the injection set.
* tests/misc/read-errors.sh: Likewise.
From https://github.com/coreutils/coreutils/pull/167
This commit is contained in:
Pádraig Brady 2026-01-18 16:56:24 +00:00
parent 71ea30a742
commit 4d03a1e408
2 changed files with 7 additions and 6 deletions

View File

@ -203,18 +203,19 @@ grep 'the --tag option is meaningless when verifying checksums' err || fail=1
cksum -a md5 /dev/null | cksum --untagged --check || fail=1
# Ensure I/O errors handled appropriately
if strace -o /dev/null -P path -e /read -e fault=all:error=EIO true; then
if strace -o /dev/null -P _ -e /read,splice -e fault=all:error=EIO true; then
touch ok eio || framework_failure_
cksum -a md5 eio ok > check.md5 || fail=1
# Test one of the files being checked returns EIO
returns_ 1 strace -o /dev/null -P eio -e /read -e fault=all:error=EIO \
returns_ 1 strace -o /dev/null -P eio -e /read,splice -e fault=all:error=EIO \
cksum --check check.md5 2>err >out || fail=1
printf '%s\n' 'eio: FAILED open or read' 'ok: OK' >exp || framework_failure_
compare exp out || fail=1
# Generate the expected error using cat:
strace -o /dev/null -P eio -e /read -e fault=all:error=EIO cat eio 2> exp.t
strace -o /dev/null -P eio -e /read,splice -e fault=all:error=EIO \
cat eio 2> exp.t
sed 's/cat/cksum/' < exp.t > exp && grep eio: exp && echo \
'cksum: WARNING: 1 listed file could not be read' >>exp || framework_failure_
compare exp err || fail=1

View File

@ -104,9 +104,9 @@ expected_failure_status_sort=2
# Ensure read is called, otherwise it's a layering violation.
# Also ensure a read error is diagnosed appropriately.
if strace -o /dev/null -P /dev/null -e '/read' -e fault=all:error=EIO true; then
if strace -o /dev/null -P _ -e '/read,splice' -e fault=all:error=EIO true; then
# Get EIO error message independently from utils
strace -o /dev/null -P /dev/null -e '/read' -e fault=all:error=EIO \
strace -o /dev/null -P /dev/null -e '/read,splice' -e fault=all:error=EIO \
$SHELL -c 'read < /dev/null' 2>&1 |
sed -e 's/\[/: /' -e 's/\]//' -e 's/.*: //' > io.err
strerror_eio="$(cat io.err)" && test -n "$strerror_eio" || framework_failure_
@ -116,7 +116,7 @@ if strace -o /dev/null -P /dev/null -e '/read' -e fault=all:error=EIO true; then
eval "expected=\$expected_failure_status_$cmd"
test x$expected = x && expected=1
returns_ $expected \
strace -f -o /dev/null -P . -e '/read' -e fault=all:error=EIO \
strace -f -o /dev/null -P . -e '/read,splice' -e fault=all:error=EIO \
$SHELL -c "$reader" 2>err || fail=1
grep -F "$strerror_eio" err >/dev/null || { cat err; fail=1; }
done < built_readers