1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-10 17:31:56 +02:00

tests: determine errno string more efficiently

* tests/misc/read-errors.sh: Use getlimits_ determined EIO error string,
rather than inferring the string from bash's output.
See https://bugs.gnu.org/80353
This commit is contained in:
Pádraig Brady
2026-02-08 19:41:41 +00:00
parent 8732e7e95e
commit 3d35e82b9b

View File

@@ -17,8 +17,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
require_bash_as_SHELL_
uses_strace_
getlimits_
! cat . >/dev/null 2>&1 || skip_ "Need unreadable directories"
@@ -106,12 +106,6 @@ 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 _ -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,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_
while read reader; do
cmd=$(printf '%s\n' "$reader" | cut -d ' ' -f1) || framework_failure_
eval "expected=\$expected_failure_status_$cmd"
@@ -119,7 +113,7 @@ if strace -o /dev/null -P _ -e '/read,splice' -e fault=all:error=EIO true; then
returns_ $expected \
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; }
grep -F "$EIO" err >/dev/null || { cat err; fail=1; }
done < built_readers
fi