1#!/bin/sh
2# Make sure all of these programs diagnose read 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
20
21! cat . >/dev/null 2>&1 || skip_ "Need unreadable directories"
22
23echo "\
24basenc --base32 .
25basenc -d --base64 .
26cat .
27cksum -a blake2b .
28cksum -a bsd .
29cksum -a crc .
30cksum -a md5 .
31cksum -a sha1 .
32cksum -a sha224 .
33cksum -a sha256 .
34cksum -a sha384 .
35cksum -a sha512 .
36cksum -a sm3 .
37cksum -a sysv .
38comm . .
39csplit . 1
40cut -c1 .
41cut -f1 .
42date -f .
43dd if=.
44dircolors .
45expand .
46factor < .
47fmt .
48fold .
49head -n1 .
50head -n-1 .
51head -c1 .
52head -c-1 .
53join . .
54nl .
55numfmt < .
56od .
57paste .
58pr .
59ptx .
60shuf -r .
61shuf -n1 .
62sort .
63split -l1 .
64split -b1 .
65split -C1 .
66split -n1 .
67split -nl/1 .
68split -nr/1 .
69tac .
70tail -n1 .
71tail -c1 .
72tail -n+1 .
73tail -c+1 .
74tee < .
75tr 1 1 < .
76tsort .
77unexpand .
78uniq .
79uniq -c .
80wc .
81wc -c .
82wc -l .
83" |
84sort -k 1b,1 > all_readers || framework_failure_
85
86printf '%s\n' $built_programs |
87sort -k 1b,1 > built_programs || framework_failure_
88
89join all_readers built_programs > built_readers || framework_failure_
90
91while read reader; do
92  eval $reader >/dev/null && { fail=1; echo "$reader: exited with 0" >&2; }
93done < built_readers
94
95Exit $fail
96