From: Pádraig Brady
Date: Sun, 18 Jan 2026 16:56:24 +0000 (+0000) Subject: tests: strace: consider splice a "read" syscall X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d03a1e408dddfc52c805acee58c0cf3c968b79e;p=thirdparty%2Fcoreutils.git 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 --- diff --git a/tests/cksum/cksum-c.sh b/tests/cksum/cksum-c.sh index cfb29f1378..49d6a84d3b 100755 --- a/tests/cksum/cksum-c.sh +++ b/tests/cksum/cksum-c.sh @@ -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 diff --git a/tests/misc/read-errors.sh b/tests/misc/read-errors.sh index 796573a170..c05516505b 100755 --- a/tests/misc/read-errors.sh +++ b/tests/misc/read-errors.sh @@ -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