blob: a8843f39dfb38b0e32d07c7b4961bc84a0e84f40 (
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
|
#! /bin/sh
# check script for Zutils - Utilities dealing with compressed files
# Copyright (C) 2009 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
ZUTILS="${objdir}"/zutils
compressors="gzip bzip2 lzip"
extensions="gz bz2 lz"
framework_failure() { echo 'failure in testing framework'; exit 1; }
if [ ! -x "${ZCAT}" ] ; then
echo "${ZCAT}: cannot execute"
exit 1
fi
if [ -d tmp ] ; then rm -rf tmp ; fi
mkdir tmp
echo -n "testing zutils..."
cd "${objdir}"/tmp
for i in ${compressors}; do
cat "${testdir}"/../COPYING > in || framework_failure
$i in || framework_failure
echo -n .
done
cat "${testdir}"/../COPYING > in || framework_failure
cat in > -in- || framework_failure
cat in.lz > -in-.lz || framework_failure
cat in in in in in > in5 || framework_failure
fail=0
for i in ${extensions}; do
"${ZCAT}" in.$i > copy || fail=1
cmp in copy || fail=1
echo -n .
done
"${ZCAT}" < in > copy || fail=1
cmp in copy || fail=1
echo -n .
"${ZCAT}" < in.gz > copy || fail=1
cmp in copy || fail=1
echo -n .
"${ZCAT}" --gzip < in.gz > copy || fail=1
cmp in copy || fail=1
echo -n .
"${ZCAT}" --bzip2 < in.bz2 > copy || fail=1
cmp in copy || fail=1
echo -n .
"${ZCAT}" --lzip < in.lz > copy || fail=1
cmp in copy || fail=1
echo -n .
"${ZCAT}" in > copy || fail=1
cmp in copy || fail=1
echo -n .
"${ZCAT}" in in.gz in.bz2 in.lz -- -in- > copy5 || fail=1
cmp in5 copy5 || fail=1
echo -n .
for i in ${extensions}; do
"${ZCMP}" in.$i || fail=1
echo -n .
"${ZCMP}" in in.$i || fail=1
echo -n .
"${ZCMP}" in.$i in || fail=1
echo -n .
done
for i in ${extensions}; do
"${ZDIFF}" in.$i || fail=1
echo -n .
"${ZDIFF}" in in.$i || fail=1
echo -n .
"${ZDIFF}" in.$i in || fail=1
echo -n .
done
"${ZDIFF}" in || fail=1
echo -n .
"${ZDIFF}" in.lz in.gz || fail=1
echo -n .
"${ZDIFF}" in.gz -- -in-.lz || fail=1
echo -n .
"${ZDIFF}" -- -in-.lz in.gz || fail=1
echo -n .
"${ZDIFF}" in -- -in-.lz || fail=1
echo -n .
"${ZDIFF}" -- -in- in.lz || fail=1
echo -n .
"${ZDIFF}" in.lz -- -in- || fail=1
echo -n .
"${ZDIFF}" -- -in-.lz in || fail=1
echo -n .
"${ZDIFF}" -- -in- in || fail=1
echo -n .
"${ZDIFF}" in -- -in- || fail=1
echo -n .
for i in ${extensions}; do
"${ZGREP}" License in.$i 2>&1 > /dev/null || fail=1
echo -n .
done
"${ZGREP}" License < in 2>&1 > /dev/null || fail=1
echo -n .
"${ZGREP}" License < in.gz 2>&1 > /dev/null || fail=1
echo -n .
"${ZGREP}" --gzip License < in.gz 2>&1 > /dev/null || fail=1
echo -n .
"${ZGREP}" --bzip2 License < in.bz2 2>&1 > /dev/null || fail=1
echo -n .
"${ZGREP}" --lzip License < in.lz 2>&1 > /dev/null || fail=1
echo -n .
"${ZGREP}" License in 2>&1 > /dev/null || fail=1
echo -n .
"${ZGREP}" License -- -in- 2>&1 > /dev/null || fail=1
echo -n .
"${ZGREP}" License -- -in-.lz 2>&1 > /dev/null || fail=1
echo -n .
"${ZGREP}" License in in.gz in.bz2 in.lz -- -in- 2>&1 > /dev/null || fail=1
echo -n .
"${ZEGREP}" License in 2>&1 > /dev/null || fail=1
echo -n .
"${ZFGREP}" License in 2>&1 > /dev/null || fail=1
echo -n .
if [ "gzip" != `"${ZUTILS}" -t in.gz` ]; then fail=1 ; fi
echo -n .
if [ "bzip2" != `"${ZUTILS}" -t in.bz2` ]; then fail=1 ; fi
echo -n .
if [ "lzip" != `"${ZUTILS}" -t in.lz` ]; then fail=1 ; fi
echo -n .
echo
if [ ${fail} = 0 ]; then
echo "tests completed successfully."
cd "${objdir}" && rm -r tmp
else
echo "tests failed."
fi
exit ${fail}
|