Home | History | Annotate | Line # | Download | only in gzip
      1  1.1  christos #!/bin/sh
      2  1.1  christos # Exercise zdiff with two compressed inputs.
      3  1.1  christos # Before gzip-1.4, this would fail.
      4  1.1  christos 
      5  1.1  christos # Copyright (C) 2009-2016 Free Software Foundation, Inc.
      6  1.1  christos 
      7  1.1  christos # This program is free software: you can redistribute it and/or modify
      8  1.1  christos # it under the terms of the GNU General Public License as published by
      9  1.1  christos # the Free Software Foundation, either version 3 of the License, or
     10  1.1  christos # (at your option) any later version.
     11  1.1  christos 
     12  1.1  christos # This program is distributed in the hope that it will be useful,
     13  1.1  christos # but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  1.1  christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  1.1  christos # GNU General Public License for more details.
     16  1.1  christos 
     17  1.1  christos # You should have received a copy of the GNU General Public License
     18  1.1  christos # along with this program.  If not, see <https://www.gnu.org/licenses/>.
     19  1.1  christos # limit so don't run it by default.
     20  1.1  christos 
     21  1.1  christos . "${srcdir=.}/init.sh"; path_prepend_ .
     22  1.1  christos 
     23  1.1  christos echo a > a || framework_failure_
     24  1.1  christos echo b > b || framework_failure_
     25  1.1  christos gzip a b || framework_failure_
     26  1.1  christos 
     27  1.1  christos cat <<EOF > exp
     28  1.1  christos 1c1
     29  1.1  christos < a
     30  1.1  christos ---
     31  1.1  christos > b
     32  1.1  christos EOF
     33  1.1  christos 
     34  1.1  christos fail=0
     35  1.1  christos zdiff a.gz b.gz > out 2>&1
     36  1.1  christos test $? = 1 || fail=1
     37  1.1  christos 
     38  1.1  christos compare exp out || fail=1
     39  1.1  christos 
     40  1.1  christos rm -f out
     41  1.1  christos # expect success, for equal files
     42  1.1  christos zdiff a.gz a.gz > out 2> err || fail=1
     43  1.1  christos # expect no output
     44  1.1  christos test -s out && fail=1
     45  1.1  christos # expect no stderr
     46  1.1  christos test -s err && fail=1
     47  1.1  christos 
     48  1.1  christos Exit $fail
     49