1#!/bin/sh 2# Make sure all of these programs promptly diagnose write errors. 3 4# Copyright (C) 2023 Free Software Foundation, Inc. 5 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. 10 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. 15 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/>. 18 19. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src 20print_ver_ timeout 21 22if ! test -w /dev/full || ! test -c /dev/full; then 23 skip_ '/dev/full is required' 24fi 25 26# Writers that may output data indefinitely 27# First word in command line is checked against built programs 28echo "\ 29cat /dev/zero 30comm -z /dev/zero /dev/zero 31cut -z -c1- /dev/zero 32cut -z -f1- /dev/zero 33dd if=/dev/zero 34expand /dev/zero 35factor --version; yes 1 | factor 36# TODO: fmt /dev/zero 37# TODO: fold -b /dev/zero 38head -z -n-1 /dev/zero 39join -a 1 -z /dev/zero /dev/null 40# TODO: nl --version; yes | nl 41# TODO: numfmt --version; yes 1 | numfmt 42od -v /dev/zero 43paste /dev/zero 44# TODO: pr /dev/zero 45seq inf 46tail -n+1 -z /dev/zero 47tee < /dev/zero 48tr . . < /dev/zero 49unexpand /dev/zero 50uniq -z -D /dev/zero 51yes 52" | 53sort -k 1b,1 > all_writers || framework_failure_ 54 55printf '%s\n' $built_programs | 56sort -k 1b,1 > built_programs || framework_failure_ 57 58join all_writers built_programs > built_writers || framework_failure_ 59 60while read writer; do 61 timeout 10 $SHELL -c "$writer > /dev/full" 62 test $? = 124 && { fail=1; echo "$writer: failed to exit" >&2; } 63done < built_writers 64 65Exit $fail 66