blob: 073843e566ad85f6e94306cef517c441398978f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
#! /bin/sh
# check script for Zutils - Utilities dealing with compressed files
# Copyright (C) 2009, 2010 Antonio Diaz Diaz.
#
# This script is free software: you have unlimited permission
# to copy, distribute and modify it.
LC_ALL=C
export LC_ALL
objdir=`pwd`
testdir=`cd "$1" ; pwd`
ZCAT="${objdir}"/zcat
ZCMP="${objdir}"/zcmp
ZDIFF="${objdir}"/zdiff
ZGREP="${objdir}"/zgrep
ZEGREP="${objdir}"/zegrep
ZFGREP="${objdir}"/zfgrep
ZTEST="${objdir}"/ztest
compressors="bzip2 gzip lzip"
extensions="bz2 gz lz"
framework_failure() { echo "failure in testing framework" ; exit 1 ; }
compressor_needed() { echo "${compressors} are needed to run tests" ; exit 1 ; }
if [ ! -x "${ZCAT}" ] ; then
echo "${ZCAT}: cannot execute"
exit 1
fi
if [ -d tmp ] ; then rm -rf tmp ; fi
mkdir tmp
cd "${objdir}"/tmp
for i in ${compressors}; do
cat "${testdir}"/test.txt > in || framework_failure
$i in || compressor_needed
done
printf "testing zutils-%s..." "$2"
cat "${testdir}"/test.txt > in || framework_failure
cat in > -in- || framework_failure
cat in.lz > -in-.lz || framework_failure
cat in.lz > lz_only.lz || framework_failure
cat in in in in in in > in6 || framework_failure
fail=0
printf "\ntesting zcat-%s..." "$2"
for i in ${extensions}; do
"${ZCAT}" in.$i > copy || fail=1
cmp in copy || fail=1
printf .
done
"${ZCAT}" < in > copy || fail=1
cmp in copy || fail=1
printf .
"${ZCAT}" < in.gz > copy || fail=1
cmp in copy || fail=1
printf .
"${ZCAT}" < in.bz2 > copy || fail=1
cmp in copy || fail=1
printf .
"${ZCAT}" < in.lz > copy || fail=1
cmp in copy || fail=1
printf .
"${ZCAT}" in > copy || fail=1
cmp in copy || fail=1
printf .
"${ZCAT}" lz_only > copy || fail=1
cmp in copy || fail=1
printf .
"${ZCAT}" in in.gz in.bz2 in.lz -- -in- -in-.lz > copy6 || fail=1
cmp in6 copy6 || fail=1
printf .
printf "\ntesting zcmp-%s..." "$2"
for i in ${extensions}; do
"${ZCMP}" in.$i || fail=1
printf .
"${ZCMP}" in in.$i || fail=1
printf .
"${ZCMP}" in.$i in || fail=1
printf .
done
"${ZCMP}" - || fail=1
printf .
"${ZCMP}" in in || fail=1
printf .
"${ZCMP}" in || fail=1
printf .
"${ZCMP}" in.lz in.gz || fail=1
printf .
"${ZCMP}" in.gz -- -in-.lz || fail=1
printf .
"${ZCMP}" -- -in-.lz in.gz || fail=1
printf .
"${ZCMP}" in -- -in-.lz || fail=1
printf .
"${ZCMP}" -- -in- in.lz || fail=1
printf .
"${ZCMP}" in.lz -- -in- || fail=1
printf .
"${ZCMP}" -- -in-.lz in || fail=1
printf .
"${ZCMP}" -- -in- in || fail=1
printf .
"${ZCMP}" in -- -in- || fail=1
printf .
"${ZCMP}" lz_only.lz < in || fail=1
printf .
"${ZCMP}" in.lz - < in || fail=1
printf .
"${ZCMP}" - in.lz < in || fail=1
printf .
"${ZCMP}" in - < in.lz || fail=1
printf .
"${ZCMP}" - in < in.lz || fail=1
printf .
printf "\ntesting zdiff-%s..." "$2"
for i in ${extensions}; do
"${ZDIFF}" in.$i || fail=1
printf .
"${ZDIFF}" in in.$i || fail=1
printf .
"${ZDIFF}" in.$i in || fail=1
printf .
done
"${ZDIFF}" - || fail=1
printf .
"${ZDIFF}" in in || fail=1
printf .
"${ZDIFF}" in || fail=1
printf .
"${ZDIFF}" in.lz in.gz || fail=1
printf .
"${ZDIFF}" in.gz -- -in-.lz || fail=1
printf .
"${ZDIFF}" -- -in-.lz in.gz || fail=1
printf .
"${ZDIFF}" in -- -in-.lz || fail=1
printf .
"${ZDIFF}" -- -in- in.lz || fail=1
printf .
"${ZDIFF}" in.lz -- -in- || fail=1
printf .
"${ZDIFF}" -- -in-.lz in || fail=1
printf .
"${ZDIFF}" -- -in- in || fail=1
printf .
"${ZDIFF}" in -- -in- || fail=1
printf .
"${ZDIFF}" lz_only.lz < in || fail=1
printf .
"${ZDIFF}" in.lz - < in || fail=1
printf .
"${ZDIFF}" - in.lz < in || fail=1
printf .
"${ZDIFF}" in - < in.lz || fail=1
printf .
"${ZDIFF}" - in < in.lz || fail=1
printf .
printf "\ntesting zgrep-%s..." "$2"
for i in ${extensions}; do
"${ZGREP}" License in.$i > /dev/null || fail=1
"${ZGREP}" nx_pattern in.$i > /dev/null && fail=1
printf .
done
"${ZGREP}" -r License . > /dev/null || fail=1
printf .
"${ZGREP}" nx_pattern -r . in > /dev/null && fail=1
printf .
"${ZGREP}" License < in > /dev/null || fail=1
printf .
"${ZGREP}" License < in.gz > /dev/null || fail=1
printf .
"${ZGREP}" License < in.bz2 > /dev/null || fail=1
printf .
"${ZGREP}" License < in.lz > /dev/null || fail=1
printf .
"${ZGREP}" License in > /dev/null || fail=1
printf .
"${ZGREP}" License -- -in- > /dev/null || fail=1
printf .
"${ZGREP}" License -- -in-.lz > /dev/null || fail=1
printf .
"${ZGREP}" License in in.gz in.bz2 in.lz -- -in- > /dev/null || fail=1
printf .
"${ZEGREP}" License in > /dev/null || fail=1
printf .
"${ZFGREP}" License in > /dev/null || fail=1
printf .
printf "\ntesting ztest-%s..." "$2"
"${ZTEST}" in in.gz in.bz2 in.lz -- -in- || fail=1
printf .
"${ZTEST}" -r . || fail=1
printf .
printf "LZIPvs0000000000000000000000" | "${ZTEST}" 2>/dev/null && fail=1
printf .
echo
if [ ${fail} = 0 ] ; then
echo "tests completed successfully."
cd "${objdir}" && rm -r tmp
else
echo "tests failed."
fi
exit ${fail}
|