2 # Make sure all of these programs promptly diagnose write errors.
4 # Copyright (C) 2023-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 if ! test -w /dev
/full ||
! test -c /dev
/full
; then
23 skip_
'/dev/full is required'
26 # Writers that may output data indefinitely
27 # First word in command line is checked against built programs
30 comm -z /dev/zero /dev/zero
35 factor --version; yes 1 | factor
37 # TODO: fold -b /dev/zero
38 head -z -n-1 /dev/zero
39 join -a 1 -z /dev/zero /dev/null
40 # TODO: nl --version; yes | nl
41 # TODO: numfmt --version; yes 1 | numfmt
46 tail -n+1 -z /dev/zero
53 sort -k 1b
,1 > all_writers || framework_failure_
55 printf '%s\n' $built_programs |
56 sort -k 1b
,1 > built_programs || framework_failure_
58 join all_writers built_programs
> built_writers || framework_failure_
61 timeout
10 $SHELL -c "$writer > /dev/full"
62 test $?
= 124 && { fail
=1; echo "$writer: failed to exit" >&2; }
64 rm -f pipe.err || framework_failure_
65 timeout
10 $SHELL -c "$writer 2>pipe.err | :"
66 { test $?
= 0 && compare
/dev
/null pipe.err
; } ||
67 { fail
=1; cat pipe.err
; echo "$writer: failed to write to closed pipe" >&2; }