aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2025-01-14 21:14:50 +0000
committerPádraig Brady <P@draigBrady.com>2025-01-15 12:07:52 +0000
commit1555bcec6aae06df01a52d3656e8ca35e7dea938 (patch)
treebb73261028d0129408d28584c521335030e99d89 /tests
parentmaint: avoid syntax-check failure (diff)
downloadcoreutils-1555bcec6aae06df01a52d3656e8ca35e7dea938.tar.gz
coreutils-1555bcec6aae06df01a52d3656e8ca35e7dea938.zip
tests: tail: avoid failure on Solaris 11
* tests/tail/tail-c.sh: On Solaris 11, tail -c 4096 /dev/urandom, will induce an lseek(,-4096,SEEK_END) which returns -4096 without setting errno, and a subsequent read() then gives EINVAL. Since tailing the end of a psuedo device is an edge case, we just verify that we don't spin reading the device forever.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/tail/tail-c.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/tail/tail-c.sh b/tests/tail/tail-c.sh
index b7de1e938..75392df23 100755
--- a/tests/tail/tail-c.sh
+++ b/tests/tail/tail-c.sh
@@ -42,7 +42,14 @@ compare exp out || fail=1
# Any part of /dev/urandom, if it exists, should be valid for tail -c.
if test -r /dev/urandom; then
- timeout --verbose 1 tail -c 4096 /dev/urandom >/dev/null || fail=1
+ # Or at least it should not read it forever
+ timeout --verbose 1 tail -c 4096 /dev/urandom >/dev/null 2>err
+ case $? in
+ 0) ;;
+ # Solaris 11 allows negative seek but then gives EINVAL on read
+ 1) grep 'Invalid argument' err || fail=1;;
+ *) fail=1;;
+ esac
fi
Exit $fail