3 # Copyright (c) 2008 The NetBSD Foundation, Inc.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
28 atf_test_case concatenated
31 atf_set
"descr" "Checks concatenated gzipped data"
35 echo -n "aaaa" |
gzip > tmp.gz
36 echo -n "bbbb" |
gzip >> tmp.gz
38 atf_check
-o inline
:"aaaabbbb" gzip -d tmp.gz
-c
44 atf_set
"descr" "Checks input from pipe"
48 atf_check
-x "dd if=/dev/zero count=102400 2>/dev/null \
49 | gzip -c | dd bs=1 2>/dev/null | gzip -tc"
52 atf_test_case truncated
55 atf_set
"descr" "Checks that gzip fails on truncated data"
59 cat >truncated.gz.uue
<<EOF
60 begin-base64 644 truncated.gz
61 H4sIAAAAAAAAA0tMSk7hAgCspIpYCg==
64 uudecode -m truncated.gz.uue
66 atf_check
-s ne
:0 -e ignore
gzip -d truncated.gz
69 atf_test_case crcerror
72 atf_set
"descr" "Checks that gzip fails on crc error"
76 cat >crcerror.gz.uue
<<EOF
77 begin-base64 644 crcerror.gz
78 H4sIAAAAAAAAA0tMSk7hAgCspFhYBQAAAA==
81 uudecode -m crcerror.gz.uue
83 atf_check
-s ne
:0 -e ignore
gzip -d crcerror.gz
89 atf_set
"descr" "Checks decompressing correct file"
93 cat >good.gz.uue
<<EOF
94 begin-base64 644 good.gz
95 H4sICC8G8UAAA2FiY2QAS0xKTuECAKykilgFAAAA
98 uudecode -m good.gz.uue
100 atf_check
gzip -d good.gz
103 atf_init_test_cases
()
105 atf_add_test_case concatenated
106 atf_add_test_case pipe
107 atf_add_test_case truncated
108 atf_add_test_case crcerror
109 atf_add_test_case good