]> granicus.if.org Git - zziplib/blob - test/Makefile.am
This commit was generated by cvs2svn to compensate for changes in r101,
[zziplib] / test / Makefile.am
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
5
6 EXTRA_DIST = test.zip test1.zip
7 DISTCLEANFILES = test*.dat test2.zip test3.zip
8
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)
15
16 $(zzcat) $(zzdir) $(zziptest) $(zzxorcat) $(zzxordir) $(xorcopy) : \
17         @top_srcdir@/bins/*.c @top_srcdir@/zzip/*.c
18         (cd ../bins && $(MAKE))
19
20 # -------------------------------------------------------------------
21 NULL=/dev/null
22 README = @top_srcdir@/README
23
24 testzip testzips : test.zip test1.zip test2.zip test3.zip 
25
26 test.zip : $(README)
27         test -f README || ln -s $(README) .
28         - $(MKZIP) test_.zip README
29         @ if test -s test_.zip ; then echo mv test_.zip $@ ; mv test_.zip $@ \
30         ; else if test ! -s $@ ; then echo test -s ">" $@ ; test -s > $@ ;fi fi
31
32 test1.zip :
33         @ echo $(MKZIP) $@ ... \
34         ; mkdir test.tmp \
35         ; for i in 1 2 3 4 5 6 8 9 \
36         ; do echo "file-$i" >test.tmp/file.$$i ; done \
37         ; echo " a plain text file here" >test.tmp/README \
38         ; (cd test.tmp && $(MKZIP) ../$@ file.* >$(NULL)) \
39         ; rm -rf test.tmp
40
41 test2.zip : # will not be shipped in source tarball
42         @ echo $(MKZIP) $@ ... \
43         ; mkdir test.tmp \
44         ; for i in 1 2 3 4 5 6 8 9 ; do for j in 1 2 3 4 5 6 7 8 9 \
45         ; do echo "file-$i" >test.tmp/file.$$j$$i ; done done \
46         ; (cd test.tmp && $(MKZIP) ../$@ file.* >$(NULL)) \
47         ; rm -rf test.tmp
48
49 test3.zip : # will not be shipped in source tarball
50         @ echo $(MKZIP) $@ ... \
51         ; mkdir test.tmp ; for h in 1 2 3 4 5 6 7 8 9 ; do : \
52         ; for i in 1 2 3 4 5 6 8 9 ; do for j in 1 2 3 4 5 6 7 8 9 \
53         ; do echo "file-$i" >test.tmp/file.$$h$$j$$i ; done done done \
54         ; (cd test.tmp && $(MKZIP) ../$@ file.* >$(NULL)) \
55         ; rm -rf test.tmp
56
57 test.dat : test.zip
58         $(zzxorcopy) $? $@
59 test1.dat : test1.zip
60         $(zzxorcopy) $? $@
61 test2.dat : test2.zip
62         $(zzxorcopy) $? $@
63 test3.dat : test3.zip
64         $(zzxorcopy) $? $@
65
66 # -------------------------------------------------------------------
67
68 stdtests = @ZIPTESTS@ check-test0 check-test1 check-zzdir check-zzcat
69 xortests = @ZIPTESTS@ check-zzxor check-zzxordir check-zzxorcat
70 sfxtests = @ZIPTESTS@ check-sfx
71
72 check-local: check-readme $(stdtests) $(xortests) $(sfxtests)
73
74 check-readme : $(zzcat)  test.zip
75         @ test -f test.zip || cp $(srcdir)/test.zip test.zip
76         @ echo checking $(zzcat) test/README 
77         @ $(zzcat) test/README >test.out
78         @ if diff test.out $(README) >$(NULL) \
79         ; then rm test.out ; echo check OK ; true \
80         ; else rm test.out ; echo check FAIL ; false ; fi
81
82 check-zzxor : $(zzxorcat) test.dat
83         @ echo checking $(zzxorcat) test.dat/README 
84         @ $(zzxorcat) test.dat/README >test.out
85         @ if diff test.out $(README) >$(NULL) \
86         ; then rm test.out ; echo check OK ; true \
87         ; else rm test.out ; echo check FAIL ; false ; fi
88
89 test: test0 test1 test2 test3
90 test0: $(zziptest)
91         $(zziptest) test.zip
92 test1: $(zziptest)
93         $(zziptest) test1.zip
94 test2: $(zzcat)
95         $(zzcat) test/README
96 test3: $(zzdir)
97         $(zzdir) test1.zip
98
99 check-test0 : $(zziptest)
100         @ echo ___ $@ ___
101         $(zziptest) test.zip >test.out
102         rm test.out
103 check-test1 : $(zziptest)
104         @ test -f test1.zip || ln -s $(srcdir)/test1.zip test1.zip
105         @ echo ___ $@ ___ "(about ten seconds)"
106         $(zziptest) test1.zip >test.out
107         rm test.out
108
109 check-zzdir : test1.zip test2.zip test3.zip $(zzdir) 
110         @ echo ___ $@ ___
111            ./$(zzdir) test1 > test.out
112         @ X="$(zzdir) test1 "\
113         ; if grep file.1 test.out >$(NULL) ; then : \
114         ; if grep file.9 test.out >$(NULL) ; then : \
115         ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
116            ./$(zzdir) test2 > test.out
117         @ X="$(zzdir) test2 "\
118         ; if grep file.11 test.out >$(NULL) ; then : \
119         ; if grep file.99 test.out >$(NULL) ; then : \
120         ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
121            ./$(zzdir) test3 > test.out
122         @ X="$(zzdir) test3 "\
123         ; if grep file.111 test.out >$(NULL) ; then : \
124         ; if grep file.999 test.out >$(NULL) ; then : \
125         ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
126         @ X="$(zzdir) test000" ; echo ./$$X "(negative test)" \
127         ; if ./$(zzdir) test000 >test.out ; then : \
128         ; echo ..$$X.. FAIL ; false ; else echo ..$$X.. OK ; true ; fi 
129         rm test.out
130
131 check-zzcat : test1.zip test2.zip test3.zip $(zzcat)
132         @ echo ___ $@ ___
133            ./$(zzcat) test1/file.1 test1/file.9 > test.out
134         @ X="$(zzcat) test1/file.1 test1/file.9 "\
135         ; if grep file-1 test.out >$(NULL) ; then : \
136         ; if grep file-9 test.out >$(NULL) ; then : \
137         ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
138            ./$(zzcat) test2/file.11 test2/file.99 > test.out
139         @ X="$(zzcat) test2/file.10 test2/file.99 "\
140         ; if grep file-10 test.out >$(NULL) ; then : \
141         ; if grep file-99 test.out >$(NULL) ; then : \
142         ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
143            ./$(zzcat) test3/file.111 test3/file.999 > test.out
144         @ X="$(zzcat) test3/file.111 test3/file.999 "\
145         ; if grep file-100 test.out >$(NULL) ; then : \
146         ; if grep file-999 test.out >$(NULL) ; then : \
147         ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
148         @ X="$(zzcat) test1/file.999" ; echo ./$$X "(negative test)" \
149         ; if ./$(zzdir) test1/file.999 >test.out ; then : \
150         ; echo ..$$X.. FAIL ; false ; else echo ..$$X.. OK ; true ; fi 
151         rm test.out
152
153 check-zzxordir : test1.dat test2.dat $(zzxordir) 
154         @ echo ___ $@ ___
155            ./$(zzxordir) test1 > test.out
156         @ X="$(zzxordir) test1 "\
157         ; if grep file.1 test.out >$(NULL) ; then : \
158         ; if grep file.9 test.out >$(NULL) ; then : \
159         ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
160            ./$(zzxordir) test2.dat > test.out
161         @ X="$(zzxordir) test2.dat "\
162         ; if grep file.11 test.out >$(NULL) ; then : \
163         ; if grep file.99 test.out >$(NULL) ; then : \
164         ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
165         rm test.out
166
167 check-zzxorcat : test1.dat test2.dat $(zzxorcat)
168         @ echo ___ $@ ___
169            ./$(zzxorcat) test1/file.1 test1/file.9 > test.out
170         @ X="$(zzxorcat) test1/file.1 test1/file.9 "\
171         ; if grep file-1 test.out >$(NULL) ; then : \
172         ; if grep file-9 test.out >$(NULL) ; then : \
173         ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
174            ./$(zzxorcat) test2.dat/file.11 test2/file.99 > test.out
175         @ X="$(zzxorcat) test2.dat/file.10 test2/file.99 "\
176         ; if grep file-10 test.out >$(NULL) ; then : \
177         ; if grep file-99 test.out >$(NULL) ; then : \
178         ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi
179         rm test.out
180
181 # -------------------------------------------------------------------
182 ECHON = echo -n
183 BRUTE = 0    # default is less than a thousand tests
184 brute :      # which is still a brute force selftest
185         @ echo $(MKZIP) $@: \
186         ; 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 : \
187         ; for w in 1 2 3 4 5 6 8 9 ; do for x in $(BRUTE) ; do : \
188         ; $(ECHON) $$u$$v$$w$$x: \
189         ; rm -rf test.tmp ; mkdir test.tmp \
190         ; 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 : \
191         ; for m in 1 2 3 4 5 6 8 9 ; do for n in $(BRUTE) ; do : \
192         ; echo "file-$$i$$j$$m$$n" >test.tmp/file$$i$$j$$m$$n.txt \
193         ;        test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
194         ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
195         ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
196         ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
197         ; done ; test -f test.tmp/file$$i$$j$$m$$n.txt || exit 2 \
198         ; (cd test.tmp && $(MKZIP) ../test$$u$$v$$w$$x.zip file*.* >$(NULL)) \
199         ; rm -rf test.tmp \
200         ; 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 : \
201         ; for m in 1 2 3 4 5 6 8 9 ; do for n in $(BRUTE) ; do : \
202         ; ./$(zzcat) test$$u$$v$$w$$x/file$$i$$j$$m$$n.txt >test.out \
203         ; if grep file-$$i$$j$$m$$n test.out >$(NULL) ; then rm test.out \
204         ; else echo ERROR file-$$i$$j$$m$$n diff in test$$u$$v$$w$$x \
205         ; exit 1 ; fi \
206         ; ./$(zzdir) test$$u$$v$$w$$x >test.out \
207         ; if grep file$$i$$j$$m$$n.txt test.out >$(NULL) ; then rm test.out \
208         ; else echo ERROR file$$i$$j$$m$$n.txt not in test$$u$$v$$w$$x \
209         ; exit 1 ; fi \
210         ;        test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
211         ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
212         ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
213         ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \
214         ; done ; rm test$$u$$v$$w$$x.zip \
215         ; done ; done ; done ; done ; true
216
217 # -------------------------------------------------------------------
218
219 noinst_PROGRAMS = zzipself zzipsetstub
220
221 zzipself_LDFLAGS = @ZZIPLIB_LDFLAGS@
222 zzipself_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz
223
224 ../zzip/libzzip.la : @top_srcdir@/zzip/*.c
225         (cd ../zzip && $(MAKE) `basename $@`)
226
227 zzshowme$(EXEEXT) : zzipself$(EXEEXT) zzipsetstub$(EXEEXT)
228         zip -0 -j $@ .libs/zzipself$(EXEEXT)
229         zip -9 -j $@ $(README)
230         test ! -f $@.zip || mv $@.zip $@
231         ./zzipsetstub $@ .libs/zzipself$(EXEEXT)
232         - chmod +x $@
233
234 check-sfx : zzshowme$(EXEEXT)
235         echo ___ $@ ___
236         @ echo "./zzshowme readme >readme.out" \
237         ; export LD_LIBRARY_PATH="../zzip/.libs:$$LD_LIBRARY_PATH" \
238         ; ./zzshowme readme >readme.out 2>readme.err || cat readme.err || true
239         @ echo 'grep readme.out $(README) || grep "libzzip-" readme.err' \
240         ; if test -s readme.out ; then diff readme.out $(README) \
241         ; else grep "libzzip-" readme.err || echo "possibly an error!" ; fi
242         rm readme.out readme.err