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_builddir)/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 $@
77 test4.zip : # will not be shipped in source tarball
78 @ echo $(MKZIP) $@ ... "(1000 files)" \
79 ; mkdir test.tmp ; for h in 1 2 3 4 5 6 7 8 9 ; do : \
80 ; for i in 1 2 3 4 5 6 8 9 ; do for j in 1 2 3 4 5 6 7 8 9 \
81 ; do echo "file-$i" >test.tmp/file.$$h$$j$$i ; done done done \
82 ; (cd test.tmp && $(MKZIP) -n : ../$@ file.* >$(NULL)) \
84 @ test -d $(testdatadir) || mkdir $(testdatadir); if test -s $@ \
85 ; then echo cp $@ $(testdatadir)/ ; cp $@ $(testdatadir)/ \
86 ; else echo cp $(testdatadir)/$@ .; cp $(testdatadir)/$@ . \
87 ; fi ; echo test -s $@ ; test -s $@
98 # -------------------------------------------------------------------
100 stdtests = @ZIPTESTS@ check-test0 check-test1 check-zzdir check-zzcat
101 xortests = @ZIPTESTS@ check-zzxor check-zzxordir check-zzxorcat
102 sfxtests = @ZIPTESTS@ check-sfx
104 check-local: check-readme $(stdtests) $(xortests) $(sfxtests)
106 check-readme : $(zzcat) test.zip
107 @ test -f test.zip || $(MAKE) tmp/../test.zip
109 @ echo :$@: checking $(zzcat) test/README
110 @ $(zzcat) test/README >test.out
111 @ if diff test.out $(README) >$(NULL) \
112 ; then rm test.out ; echo check OK ; true \
113 ; else rm test.out ; echo check FAIL ; false ; fi
115 check-zzxor : $(zzxorcat) test.dat
116 @ echo :$@: checking $(zzxorcat) test.dat/README
117 @ $(zzxorcat) test.dat/README >test.out
118 @ if diff test.out $(README) >$(NULL) \
119 ; then rm test.out ; echo check OK ; true \
120 ; else rm test.out ; echo check FAIL ; false ; fi
122 test: test0 test1 test2 test3
126 $(zziptest) test1.zip
131 test4: $(zzdir) test4.zip
132 $(zzcat) test4/file.113
134 check-test0 : $(zziptest)
135 @ echo :$@: quick selftest
136 $(zziptest) test.zip >test.out
138 check-test1 : $(zziptest)
139 @ test -f test1.zip || ln -s $(srcdir)/test1.zip test1.zip
140 @ echo :$@: longer selftest "(about ten seconds)"
141 $(zziptest) test1.zip >test.out
144 check-zzdir : test1.zip test2.zip test3.zip $(zzdir)
145 @ echo :$@: zip directory access
146 ./$(zzdir) test1 > test.out
147 @ X="$(zzdir) test1 "\
148 ; if grep file.1 test.out >$(NULL) ; then : \
149 ; if grep file.9 test.out >$(NULL) ; then : \
150 ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
151 ./$(zzdir) test2 > test.out
152 @ X="$(zzdir) test2 "\
153 ; if grep file.11 test.out >$(NULL) ; then : \
154 ; if grep file.99 test.out >$(NULL) ; then : \
155 ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
156 ./$(zzdir) test3 > test.out
157 @ X="$(zzdir) test3 "\
158 ; if grep file.111 test.out >$(NULL) ; then : \
159 ; if grep file.999 test.out >$(NULL) ; then : \
160 ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
161 @ X="$(zzdir) test000" ; echo ./$$X "(negative test)" \
162 ; if ./$(zzdir) test000 >test.out ; then : \
163 ; echo ..$$X.. FAIL ; false ; else echo ..$$X.. OK ; true ; fi
166 check-zzcat : test1.zip test2.zip test3.zip $(zzcat)
168 ./$(zzcat) test1/file.1 test1/file.9 > test.out
169 @ X="$(zzcat) test1/file.1 test1/file.9 "\
170 ; if grep file-1 test.out >$(NULL) ; then : \
171 ; if grep file-9 test.out >$(NULL) ; then : \
172 ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
173 ./$(zzcat) test2/file.11 test2/file.99 > test.out
174 @ X="$(zzcat) test2/file.10 test2/file.99 "\
175 ; if grep file-10 test.out >$(NULL) ; then : \
176 ; if grep file-99 test.out >$(NULL) ; then : \
177 ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
178 ./$(zzcat) test3/file.111 test3/file.999 > test.out
179 @ X="$(zzcat) test3/file.111 test3/file.999 "\
180 ; if grep file-100 test.out >$(NULL) ; then : \
181 ; if grep file-999 test.out >$(NULL) ; then : \
182 ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
183 @ X="$(zzcat) test1/file.999" ; echo ./$$X "(negative test)" \
184 ; if ./$(zzdir) test1/file.999 >test.out ; then : \
185 ; echo ..$$X.. FAIL ; false ; else echo ..$$X.. OK ; true ; fi
188 check-zzxordir : test1.dat test2.dat $(zzxordir)
190 ./$(zzxordir) test1 > test.out
191 @ X="$(zzxordir) test1 "\
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 ./$(zzxordir) test2.dat > test.out
196 @ X="$(zzxordir) test2.dat "\
197 ; if grep file.11 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 check-zzxorcat : test1.dat test2.dat $(zzxorcat)
204 ./$(zzxorcat) test1/file.1 test1/file.9 > test.out
205 @ X="$(zzxorcat) test1/file.1 test1/file.9 "\
206 ; if grep file-1 test.out >$(NULL) ; then : \
207 ; if grep file-9 test.out >$(NULL) ; then : \
208 ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
209 ./$(zzxorcat) test2.dat/file.11 test2/file.99 > test.out
210 @ X="$(zzxorcat) test2.dat/file.10 test2/file.99 "\
211 ; if grep file-10 test.out >$(NULL) ; then : \
212 ; if grep file-99 test.out >$(NULL) ; then : \
213 ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
216 # -------------------------------------------------------------------
218 BRUTE = 0 # default is less than a thousand tests
219 brute : # which is still a brute force selftest
220 @ echo $(MKZIP) $@: \
221 ; 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 : \
222 ; for w in 1 2 3 4 5 6 8 9 ; do for x in $(BRUTE) ; do : \
223 ; $(ECHON) $$u$$v$$w$$x: \
224 ; rm -rf test.tmp ; mkdir test.tmp \
225 ; 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 : \
226 ; for m in 1 2 3 4 5 6 8 9 ; do for n in $(BRUTE) ; do : \
227 ; echo "file-$$i$$j$$m$$n" >test.tmp/file$$i$$j$$m$$n.txt \
228 ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
229 ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
230 ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
231 ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
232 ; done ; test -f test.tmp/file$$i$$j$$m$$n.txt || exit 2 \
233 ; (cd test.tmp && $(MKZIP) ../test$$u$$v$$w$$x.zip file*.* >$(NULL)) \
235 ; 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 : \
236 ; for m in 1 2 3 4 5 6 8 9 ; do for n in $(BRUTE) ; do : \
237 ; ./$(zzcat) test$$u$$v$$w$$x/file$$i$$j$$m$$n.txt >test.out \
238 ; if grep file-$$i$$j$$m$$n test.out >$(NULL) ; then rm test.out \
239 ; else echo ERROR file-$$i$$j$$m$$n diff in test$$u$$v$$w$$x \
241 ; ./$(zzdir) test$$u$$v$$w$$x >test.out \
242 ; if grep file$$i$$j$$m$$n.txt test.out >$(NULL) ; then rm test.out \
243 ; else echo ERROR file$$i$$j$$m$$n.txt not in test$$u$$v$$w$$x \
245 ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
246 ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
247 ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
248 ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
249 ; done ; rm test$$u$$v$$w$$x.zip \
250 ; done ; done ; done ; done ; true
252 # -------------------------------------------------------------------
254 noinst_PROGRAMS = zzipself zzipsetstub
256 zzipself_LDFLAGS = @ZZIPLIB_LDFLAGS@
257 zzipself_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
259 ../zzip/libzzip.la : @top_srcdir@/zzip/*.c
260 (cd ../zzip && $(MAKE) `basename $@`)
262 zzshowme$(EXEEXT) : zzipself$(EXEEXT) zzipsetstub$(EXEEXT)
263 $(MKZIP) -0 -j $@ .libs/zzipself$(EXEEXT)
264 $(MKZIP) -9 -j $@ $(README)
265 - test -s $@ || cp test2.zip $@
266 test ! -f $@.zip || mv $@.zip $@
267 ./zzipsetstub $@ .libs/zzipself$(EXEEXT)
270 check-sfx : zzshowme$(EXEEXT)
271 echo :$@: "./zzshowme readme >readme.out 2>readme.err"
272 export LD_LIBRARY_PATH="../zzip/.libs:$$LD_LIBRARY_PATH" \
273 ; ./zzshowme readme >readme.out 2>readme.err ; true
274 @ echo 'diff readme.out $(README) || grep "libzzip-" readme.err' \
275 ; if test -s readme.out ; then diff readme.out $(README) \
276 ; else grep "libzzip-" readme.err || echo "readme.out is empty!" ; fi
277 rm readme.out readme.err