4 # Copyright 2014-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
22 # Make sure it works on funny files in /proc and /sys.
23 for file in /proc
/version
/sys
/kernel
/profiling
; do
24 if test -r $file; then
26 tail -c -1 copy
> exp || framework_failure_
28 tail -c -1 $file > out || fail
=1
29 compare exp out || fail
=1
33 # Make sure it works for pipes
34 printf '123456' |
tail -c3 > out || fail
=1
35 printf '456' > exp || framework_failure_
36 compare exp out || fail
=1
38 # Any part of /dev/zero should be valid for tail -c.
39 head -c 4096 /dev
/zero
>exp || fail
=1
40 tail -c 4096 /dev
/zero
>out || fail
=1
41 compare exp out || fail
=1
43 # Any part of /dev/urandom, if it exists, should be valid for tail -c.
44 if test -r /dev
/urandom
; then
45 timeout
--verbose 1 tail -c 4096 /dev
/urandom
>/dev
/null || fail
=1