4 # Copyright 2017-2018 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 <http://www.gnu.org/licenses/>.
19 . "${srcdir=.}/init.sh"; path_prepend_ ../src
23 cat <<'EOF' > exp || fail=1
27 a b differ: char 1, line 1
30 cmp: EOF on c which is empty
33 cmp: d: No such file or directory
36 b a differ: char 1, line 1
41 cmp: EOF on c which is empty
44 cmp: d: No such file or directory
47 cmp: EOF on c which is empty
50 cmp: EOF on c which is empty
55 cmp: d: No such file or directory
58 cmp: d: No such file or directory
61 cmp: d: No such file or directory
64 cmp: d: No such file or directory
67 cmp: d: No such file or directory
75 cmp: EOF on c which is empty
78 cmp: d: No such file or directory
86 cmp: EOF on c which is empty
89 cmp: d: No such file or directory
92 cmp: EOF on c which is empty
95 cmp: EOF on c which is empty
100 cmp: d: No such file or directory
103 cmp: d: No such file or directory
106 cmp: d: No such file or directory
109 cmp: d: No such file or directory
112 cmp: d: No such file or directory
153 for option in '' -l -s; do
156 echo cmp $option $i $j
157 cmp $option $i $j >stdout 2>stderr
165 compare exp out || fail=1
167 cat <<'EOF' > exp1 || fail=1
169 cmp: EOF on a0 which is empty
172 cmp: EOF on a1 after byte 2, line 1
175 cmp: EOF on a2 after byte 5, in line 2
178 cmp: EOF on a0 which is empty
181 cmp: EOF on a1 after byte 2
184 cmp: EOF on a2 after byte 5
197 printf '1\nfoolery\n' >a3
199 for option in '' -l -s; do
200 for files in 'a0 a1' 'a1 a2' 'a2 a3'; do
201 echo cmp $option $files
202 cmp $option $files >stdout 2>stderr
209 compare exp1 out1 || fail=1
213 echo LC_ALL=C cmp -b bad bug
214 LC_ALL=C cmp -b bad bug
215 test $? -eq 1 || fail=1
216 case `LC_ALL=C cmp -b bad bug` in
217 'bad bug differ: byte 2, line 1 is '*' a '*' u') ;;
218 *) echo 'expected cmp -b to report a and u'; fail=1;;