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