1
AUTOMAKE_OPTIONS = 1.4 foreign
2
AUTOTOOL_VERSION=autoconf-2.52 automake-1.5 libtool-1.4.2
3
DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir)
4
DEFS = @DEFS@ -I$(top_builddir) -I$(top_srcdir) # also for automake 1.4
6
EXTRA_DIST = test.zip test1.zip
7
DISTCLEANFILES = test*.dat test2.zip test3.zip
9
zzcat = ../bins/zzcat$(EXEEXT)
10
zzdir = ../bins/zzdir$(EXEEXT)
11
zziptest = ../bins/zziptest$(EXEEXT)
12
zzxorcat = ../bins/zzxorcat$(EXEEXT)
13
zzxordir = ../bins/zzxordir$(EXEEXT)
14
zzxorcopy = ../bins/zzxorcopy$(EXEEXT)
16
$(zzcat) $(zzdir) $(zziptest) $(zzxorcat) $(zzxordir) $(xorcopy) : \
17
@top_srcdir@/bins/*.c @top_srcdir@/zzip/*.c
18
(cd ../bins && $(MAKE))
20
# -------------------------------------------------------------------
22
README = $(top_srcdir)/README
23
testdatadir = $(top_srcdir)/testdata.d
25
testzip testzips : test.zip test1.zip test2.zip test3.zip
27
test.zip tmp/../test.zip : $(README)
28
- test -d tmp || mkdir tmp
29
- $(MAKE) test0.zip && mv test0.zip $@
30
test -s $@ || cp $(srcdir)/test.zip $@
32
test -f README || ln -s $(README) .
33
- $(MKZIP) test_.zip README
34
@ if test -s test_.zip ;then echo mv test_.zip $@ ; mv test_.zip $@ ;fi
35
@ test -d $(testdatadir) || mkdir $(testdatadir); if test -s $@ \
36
; then echo cp $@ $(testdatadir)/ ; cp $@ $(testdatadir)/ \
37
; else echo cp $(testdatadir)/$@ .; cp $(testdatadir)/$@ . \
38
; fi ; echo test -s $@ ; test -s $@
41
@ echo $(MKZIP) $@ ... "(10 files)" \
43
; for i in 1 2 3 4 5 6 8 9 \
44
; do echo "file-$i" >test.tmp/file.$$i ; done \
45
; echo " a plain text file here" >test.tmp/README \
46
; (cd test.tmp && $(MKZIP) ../$@ file.* >$(NULL)) \
48
@ test -d $(testdatadir) || mkdir $(testdatadir); if test -s $@ \
49
; then echo cp $@ $(testdatadir)/ ; cp $@ $(testdatadir)/ \
50
; else echo cp $(testdatadir)/$@ .; cp $(testdatadir)/$@ . \
51
; fi ; echo test -s $@ ; test -s $@
53
test2.zip : # will not be shipped in source tarball
54
@ echo $(MKZIP) $@ ... "(100 files)" \
56
; for i in 1 2 3 4 5 6 8 9 ; do for j in 1 2 3 4 5 6 7 8 9 \
57
; do echo "file-$i" >test.tmp/file.$$j$$i ; done done \
58
; (cd test.tmp && $(MKZIP) ../$@ file.* >$(NULL)) \
60
@ test -d $(testdatadir) || mkdir $(testdatadir); if test -s $@ \
61
; then echo cp $@ $(testdatadir)/ ; cp $@ $(testdatadir)/ \
62
; else echo cp $(testdatadir)/$@ .; cp $(testdatadir)/$@ . \
63
; fi ; echo test -s $@ ; test -s $@
65
test3.zip : # will not be shipped in source tarball
66
@ echo $(MKZIP) $@ ... "(1000 files)" \
67
; mkdir test.tmp ; for h in 1 2 3 4 5 6 7 8 9 ; do : \
68
; for i in 1 2 3 4 5 6 8 9 ; do for j in 1 2 3 4 5 6 7 8 9 \
69
; do echo "file-$i" >test.tmp/file.$$h$$j$$i ; done done done \
70
; (cd test.tmp && $(MKZIP) ../$@ file.* >$(NULL)) \
72
@ test -d $(testdatadir) || mkdir $(testdatadir); if test -s $@ \
73
; then echo cp $@ $(testdatadir)/ ; cp $@ $(testdatadir)/ \
74
; else echo cp $(testdatadir)/$@ .; cp $(testdatadir)/$@ . \
75
; fi ; echo test -s $@ ; test -s $@
86
# -------------------------------------------------------------------
88
stdtests = @ZIPTESTS@ check-test0 check-test1 check-zzdir check-zzcat
89
xortests = @ZIPTESTS@ check-zzxor check-zzxordir check-zzxorcat
90
sfxtests = @ZIPTESTS@ check-sfx
92
check-local: check-readme $(stdtests) $(xortests) $(sfxtests)
94
check-readme : $(zzcat) test.zip
95
@ test -f test.zip || $(MAKE) tmp/../test.zip
97
@ echo :$@: checking $(zzcat) test/README
98
@ $(zzcat) test/README >test.out
99
@ if diff test.out $(README) >$(NULL) \
100
; then rm test.out ; echo check OK ; true \
101
; else rm test.out ; echo check FAIL ; false ; fi
103
check-zzxor : $(zzxorcat) test.dat
104
@ echo :$@: checking $(zzxorcat) test.dat/README
105
@ $(zzxorcat) test.dat/README >test.out
106
@ if diff test.out $(README) >$(NULL) \
107
; then rm test.out ; echo check OK ; true \
108
; else rm test.out ; echo check FAIL ; false ; fi
110
test: test0 test1 test2 test3
114
$(zziptest) test1.zip
120
check-test0 : $(zziptest)
121
@ echo :$@: quick selftest
122
$(zziptest) test.zip >test.out
124
check-test1 : $(zziptest)
125
@ test -f test1.zip || ln -s $(srcdir)/test1.zip test1.zip
126
@ echo :$@: longer selftest "(about ten seconds)"
127
$(zziptest) test1.zip >test.out
130
check-zzdir : test1.zip test2.zip test3.zip $(zzdir)
131
@ echo :$@: zip directory access
132
./$(zzdir) test1 > test.out
133
@ X="$(zzdir) test1 "\
134
; if grep file.1 test.out >$(NULL) ; then : \
135
; if grep file.9 test.out >$(NULL) ; then : \
136
; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
137
./$(zzdir) test2 > test.out
138
@ X="$(zzdir) test2 "\
139
; if grep file.11 test.out >$(NULL) ; then : \
140
; if grep file.99 test.out >$(NULL) ; then : \
141
; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
142
./$(zzdir) test3 > test.out
143
@ X="$(zzdir) test3 "\
144
; if grep file.111 test.out >$(NULL) ; then : \
145
; if grep file.999 test.out >$(NULL) ; then : \
146
; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
147
@ X="$(zzdir) test000" ; echo ./$$X "(negative test)" \
148
; if ./$(zzdir) test000 >test.out ; then : \
149
; echo ..$$X.. FAIL ; false ; else echo ..$$X.. OK ; true ; fi
152
check-zzcat : test1.zip test2.zip test3.zip $(zzcat)
154
./$(zzcat) test1/file.1 test1/file.9 > test.out
155
@ X="$(zzcat) test1/file.1 test1/file.9 "\
156
; if grep file-1 test.out >$(NULL) ; then : \
157
; if grep file-9 test.out >$(NULL) ; then : \
158
; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
159
./$(zzcat) test2/file.11 test2/file.99 > test.out
160
@ X="$(zzcat) test2/file.10 test2/file.99 "\
161
; if grep file-10 test.out >$(NULL) ; then : \
162
; if grep file-99 test.out >$(NULL) ; then : \
163
; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
164
./$(zzcat) test3/file.111 test3/file.999 > test.out
165
@ X="$(zzcat) test3/file.111 test3/file.999 "\
166
; if grep file-100 test.out >$(NULL) ; then : \
167
; if grep file-999 test.out >$(NULL) ; then : \
168
; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
169
@ X="$(zzcat) test1/file.999" ; echo ./$$X "(negative test)" \
170
; if ./$(zzdir) test1/file.999 >test.out ; then : \
171
; echo ..$$X.. FAIL ; false ; else echo ..$$X.. OK ; true ; fi
174
check-zzxordir : test1.dat test2.dat $(zzxordir)
176
./$(zzxordir) test1 > test.out
177
@ X="$(zzxordir) test1 "\
178
; if grep file.1 test.out >$(NULL) ; then : \
179
; if grep file.9 test.out >$(NULL) ; then : \
180
; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
181
./$(zzxordir) test2.dat > test.out
182
@ X="$(zzxordir) test2.dat "\
183
; if grep file.11 test.out >$(NULL) ; then : \
184
; if grep file.99 test.out >$(NULL) ; then : \
185
; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
188
check-zzxorcat : test1.dat test2.dat $(zzxorcat)
190
./$(zzxorcat) test1/file.1 test1/file.9 > test.out
191
@ X="$(zzxorcat) test1/file.1 test1/file.9 "\
192
; if grep file-1 test.out >$(NULL) ; then : \
193
; if grep file-9 test.out >$(NULL) ; then : \
194
; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
195
./$(zzxorcat) test2.dat/file.11 test2/file.99 > test.out
196
@ X="$(zzxorcat) test2.dat/file.10 test2/file.99 "\
197
; if grep file-10 test.out >$(NULL) ; then : \
198
; if grep file-99 test.out >$(NULL) ; then : \
199
; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
202
# -------------------------------------------------------------------
204
BRUTE = 0 # default is less than a thousand tests
205
brute : # which is still a brute force selftest
206
@ echo $(MKZIP) $@: \
207
; for u in 1 2 3 4 5 6 8 9 ; do for v in 1 2 3 4 5 6 7 8 9 ; do : \
208
; for w in 1 2 3 4 5 6 8 9 ; do for x in $(BRUTE) ; do : \
209
; $(ECHON) $$u$$v$$w$$x: \
210
; rm -rf test.tmp ; mkdir test.tmp \
211
; for i in 1 2 3 4 5 6 8 9 ; do for j in 1 2 3 4 5 6 7 8 9 ; do : \
212
; for m in 1 2 3 4 5 6 8 9 ; do for n in $(BRUTE) ; do : \
213
; echo "file-$$i$$j$$m$$n" >test.tmp/file$$i$$j$$m$$n.txt \
214
; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
215
; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
216
; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
217
; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
218
; done ; test -f test.tmp/file$$i$$j$$m$$n.txt || exit 2 \
219
; (cd test.tmp && $(MKZIP) ../test$$u$$v$$w$$x.zip file*.* >$(NULL)) \
221
; for i in 1 2 3 4 5 6 8 9 ; do for j in 1 2 3 4 5 6 7 8 9 ; do : \
222
; for m in 1 2 3 4 5 6 8 9 ; do for n in $(BRUTE) ; do : \
223
; ./$(zzcat) test$$u$$v$$w$$x/file$$i$$j$$m$$n.txt >test.out \
224
; if grep file-$$i$$j$$m$$n test.out >$(NULL) ; then rm test.out \
225
; else echo ERROR file-$$i$$j$$m$$n diff in test$$u$$v$$w$$x \
227
; ./$(zzdir) test$$u$$v$$w$$x >test.out \
228
; if grep file$$i$$j$$m$$n.txt test.out >$(NULL) ; then rm test.out \
229
; else echo ERROR file$$i$$j$$m$$n.txt not in test$$u$$v$$w$$x \
231
; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
232
; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
233
; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
234
; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
235
; done ; rm test$$u$$v$$w$$x.zip \
236
; done ; done ; done ; done ; true
238
# -------------------------------------------------------------------
240
noinst_PROGRAMS = zzipself zzipsetstub
242
zzipself_LDFLAGS = @ZZIPLIB_LDFLAGS@
243
zzipself_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
245
../zzip/libzzip.la : @top_srcdir@/zzip/*.c
246
(cd ../zzip && $(MAKE) `basename $@`)
248
zzshowme$(EXEEXT) : zzipself$(EXEEXT) zzipsetstub$(EXEEXT)
249
$(MKZIP) -0 -j $@ .libs/zzipself$(EXEEXT)
250
$(MKZIP) -9 -j $@ $(README)
251
- test -s $@ || cp test2.zip $@
252
test ! -f $@.zip || mv $@.zip $@
253
./zzipsetstub $@ .libs/zzipself$(EXEEXT)
256
check-sfx : zzshowme$(EXEEXT)
257
echo :$@: "./zzshowme readme >readme.out 2>readme.err"
258
export LD_LIBRARY_PATH="../zzip/.libs:$$LD_LIBRARY_PATH" \
259
; ./zzshowme readme >readme.out 2>readme.err ; true
260
@ echo 'diff readme.out $(README) || grep "libzzip-" readme.err' \
261
; if test -s readme.out ; then diff readme.out $(README) \
262
; else grep "libzzip-" readme.err || echo "readme.out is empty!" ; fi
263
rm readme.out readme.err