From df0b6bb56c05436bc51d3ee5221eace4dd56dd90 Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Mon, 18 Aug 2003 15:01:25 +0000 Subject: [PATCH] This commit was generated by cvs2svn to compensate for changes in r101, which included commits to RCS files with non-trunk default branches. --- README | 47 +++++++++ test/Makefile.am | 242 +++++++++++++++++++++++++++++++++++++++++++++++ test/README | 47 +++++++++ 3 files changed, 336 insertions(+) create mode 100644 README create mode 100644 test/Makefile.am create mode 100644 test/README diff --git a/README b/README new file mode 100644 index 0000000..5668eda --- /dev/null +++ b/README @@ -0,0 +1,47 @@ +PROJECT + The zziplib provides read access to zipped files in a zip-archive, + using compression based solely on free algorithms provided by zlib. + It also provides a functionality to overlay the archive filesystem + with the filesystem of the operating system environment. + +AUTHOR + The project was originally written by Tomi Ollila, later largely + rewritten by Guido Draheim, and extended with contributions in + the years to follow. Guido Draheim holds the full + copyright to the zziplib sources. + +COPYING + The zziplib may be used freely under the restrictions of the + GNU Lesser General Public License version 2 or later. Alternativly + the Mozilla Public license can be chosen. The sources are under + a dual license, as long as the MPL hint is not removed, the modified + files will be again under a dual license for the final recipient. + +LICENSING + If you can not use a dynalinked library according to LGPL rules, + then look at docs/copying.htm for a few hints. Generally the LGPL + has a way for staticlinking as well as the MPL has a way. Anyway, + special (paid) licenses can be negotiated with the copyright holder. + +HOMEPAGE + The zziplib project is hosted at SourceForge, the complete + documentation can be found at http://zziplib.sf.net - the + SourceForge servers are also used to distribute the sources + of the zziplib project. Releases are announced via the + freshmeat services on http://freshmeat.net/projects/zziplib + +INSTALLATION + The zziplib sources are built with gnu autotools and they should + be easy to install on unixish systems via the usual sequence of + `configure && make && make check && make install`. Many distributors + ship prebuilt packages e.g. in rpm format. Additionally there are + MSVC project files shipped along for usage with the Microsoft + VisualC series of compilers. There should be no problem either + when crosscompiling the zziplib for a third host platform. + +MAINTAINANCE + The zziplib library is intentionally a lightweight interface to + zip files. The author take patches but please consider to put + complex extensions into separate modules rather than implanting them + right into the core of the library engine. All Patches and Bug Reports + should be sent to Guido Draheim . diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..9b554b9 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,242 @@ +AUTOMAKE_OPTIONS = 1.4 foreign +AUTOTOOL_VERSION=autoconf-2.52 automake-1.5 libtool-1.4.2 +DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir) +DEFS = @DEFS@ -I$(top_builddir) -I$(top_srcdir) # also for automake 1.4 + +EXTRA_DIST = test.zip test1.zip +DISTCLEANFILES = test*.dat test2.zip test3.zip + +zzcat = ../bins/zzcat$(EXEEXT) +zzdir = ../bins/zzdir$(EXEEXT) +zziptest = ../bins/zziptest$(EXEEXT) +zzxorcat = ../bins/zzxorcat$(EXEEXT) +zzxordir = ../bins/zzxordir$(EXEEXT) +zzxorcopy = ../bins/zzxorcopy$(EXEEXT) + +$(zzcat) $(zzdir) $(zziptest) $(zzxorcat) $(zzxordir) $(xorcopy) : \ + @top_srcdir@/bins/*.c @top_srcdir@/zzip/*.c + (cd ../bins && $(MAKE)) + +# ------------------------------------------------------------------- +NULL=/dev/null +README = @top_srcdir@/README + +testzip testzips : test.zip test1.zip test2.zip test3.zip + +test.zip : $(README) + test -f README || ln -s $(README) . + - $(MKZIP) test_.zip README + @ if test -s test_.zip ; then echo mv test_.zip $@ ; mv test_.zip $@ \ + ; else if test ! -s $@ ; then echo test -s ">" $@ ; test -s > $@ ;fi fi + +test1.zip : + @ echo $(MKZIP) $@ ... \ + ; mkdir test.tmp \ + ; for i in 1 2 3 4 5 6 8 9 \ + ; do echo "file-$i" >test.tmp/file.$$i ; done \ + ; echo " a plain text file here" >test.tmp/README \ + ; (cd test.tmp && $(MKZIP) ../$@ file.* >$(NULL)) \ + ; rm -rf test.tmp + +test2.zip : # will not be shipped in source tarball + @ echo $(MKZIP) $@ ... \ + ; mkdir test.tmp \ + ; 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 echo "file-$i" >test.tmp/file.$$j$$i ; done done \ + ; (cd test.tmp && $(MKZIP) ../$@ file.* >$(NULL)) \ + ; rm -rf test.tmp + +test3.zip : # will not be shipped in source tarball + @ echo $(MKZIP) $@ ... \ + ; mkdir test.tmp ; for h in 1 2 3 4 5 6 7 8 9 ; do : \ + ; 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 echo "file-$i" >test.tmp/file.$$h$$j$$i ; done done done \ + ; (cd test.tmp && $(MKZIP) ../$@ file.* >$(NULL)) \ + ; rm -rf test.tmp + +test.dat : test.zip + $(zzxorcopy) $? $@ +test1.dat : test1.zip + $(zzxorcopy) $? $@ +test2.dat : test2.zip + $(zzxorcopy) $? $@ +test3.dat : test3.zip + $(zzxorcopy) $? $@ + +# ------------------------------------------------------------------- + +stdtests = @ZIPTESTS@ check-test0 check-test1 check-zzdir check-zzcat +xortests = @ZIPTESTS@ check-zzxor check-zzxordir check-zzxorcat +sfxtests = @ZIPTESTS@ check-sfx + +check-local: check-readme $(stdtests) $(xortests) $(sfxtests) + +check-readme : $(zzcat) test.zip + @ test -f test.zip || cp $(srcdir)/test.zip test.zip + @ echo checking $(zzcat) test/README + @ $(zzcat) test/README >test.out + @ if diff test.out $(README) >$(NULL) \ + ; then rm test.out ; echo check OK ; true \ + ; else rm test.out ; echo check FAIL ; false ; fi + +check-zzxor : $(zzxorcat) test.dat + @ echo checking $(zzxorcat) test.dat/README + @ $(zzxorcat) test.dat/README >test.out + @ if diff test.out $(README) >$(NULL) \ + ; then rm test.out ; echo check OK ; true \ + ; else rm test.out ; echo check FAIL ; false ; fi + +test: test0 test1 test2 test3 +test0: $(zziptest) + $(zziptest) test.zip +test1: $(zziptest) + $(zziptest) test1.zip +test2: $(zzcat) + $(zzcat) test/README +test3: $(zzdir) + $(zzdir) test1.zip + +check-test0 : $(zziptest) + @ echo ___ $@ ___ + $(zziptest) test.zip >test.out + rm test.out +check-test1 : $(zziptest) + @ test -f test1.zip || ln -s $(srcdir)/test1.zip test1.zip + @ echo ___ $@ ___ "(about ten seconds)" + $(zziptest) test1.zip >test.out + rm test.out + +check-zzdir : test1.zip test2.zip test3.zip $(zzdir) + @ echo ___ $@ ___ + ./$(zzdir) test1 > test.out + @ X="$(zzdir) test1 "\ + ; if grep file.1 test.out >$(NULL) ; then : \ + ; if grep file.9 test.out >$(NULL) ; then : \ + ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi + ./$(zzdir) test2 > test.out + @ X="$(zzdir) test2 "\ + ; if grep file.11 test.out >$(NULL) ; then : \ + ; if grep file.99 test.out >$(NULL) ; then : \ + ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi + ./$(zzdir) test3 > test.out + @ X="$(zzdir) test3 "\ + ; if grep file.111 test.out >$(NULL) ; then : \ + ; if grep file.999 test.out >$(NULL) ; then : \ + ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi + @ X="$(zzdir) test000" ; echo ./$$X "(negative test)" \ + ; if ./$(zzdir) test000 >test.out ; then : \ + ; echo ..$$X.. FAIL ; false ; else echo ..$$X.. OK ; true ; fi + rm test.out + +check-zzcat : test1.zip test2.zip test3.zip $(zzcat) + @ echo ___ $@ ___ + ./$(zzcat) test1/file.1 test1/file.9 > test.out + @ X="$(zzcat) test1/file.1 test1/file.9 "\ + ; if grep file-1 test.out >$(NULL) ; then : \ + ; if grep file-9 test.out >$(NULL) ; then : \ + ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi + ./$(zzcat) test2/file.11 test2/file.99 > test.out + @ X="$(zzcat) test2/file.10 test2/file.99 "\ + ; if grep file-10 test.out >$(NULL) ; then : \ + ; if grep file-99 test.out >$(NULL) ; then : \ + ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi + ./$(zzcat) test3/file.111 test3/file.999 > test.out + @ X="$(zzcat) test3/file.111 test3/file.999 "\ + ; if grep file-100 test.out >$(NULL) ; then : \ + ; if grep file-999 test.out >$(NULL) ; then : \ + ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi + @ X="$(zzcat) test1/file.999" ; echo ./$$X "(negative test)" \ + ; if ./$(zzdir) test1/file.999 >test.out ; then : \ + ; echo ..$$X.. FAIL ; false ; else echo ..$$X.. OK ; true ; fi + rm test.out + +check-zzxordir : test1.dat test2.dat $(zzxordir) + @ echo ___ $@ ___ + ./$(zzxordir) test1 > test.out + @ X="$(zzxordir) test1 "\ + ; if grep file.1 test.out >$(NULL) ; then : \ + ; if grep file.9 test.out >$(NULL) ; then : \ + ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi + ./$(zzxordir) test2.dat > test.out + @ X="$(zzxordir) test2.dat "\ + ; if grep file.11 test.out >$(NULL) ; then : \ + ; if grep file.99 test.out >$(NULL) ; then : \ + ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi + rm test.out + +check-zzxorcat : test1.dat test2.dat $(zzxorcat) + @ echo ___ $@ ___ + ./$(zzxorcat) test1/file.1 test1/file.9 > test.out + @ X="$(zzxorcat) test1/file.1 test1/file.9 "\ + ; if grep file-1 test.out >$(NULL) ; then : \ + ; if grep file-9 test.out >$(NULL) ; then : \ + ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi + ./$(zzxorcat) test2.dat/file.11 test2/file.99 > test.out + @ X="$(zzxorcat) test2.dat/file.10 test2/file.99 "\ + ; if grep file-10 test.out >$(NULL) ; then : \ + ; if grep file-99 test.out >$(NULL) ; then : \ + ; echo ..$$X.. OK ; true ; else echo ..$$X.. FAIL ; false ; fi fi + rm test.out + +# ------------------------------------------------------------------- +ECHON = echo -n +BRUTE = 0 # default is less than a thousand tests +brute : # which is still a brute force selftest + @ echo $(MKZIP) $@: \ + ; 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 : \ + ; for w in 1 2 3 4 5 6 8 9 ; do for x in $(BRUTE) ; do : \ + ; $(ECHON) $$u$$v$$w$$x: \ + ; rm -rf test.tmp ; mkdir test.tmp \ + ; 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 : \ + ; for m in 1 2 3 4 5 6 8 9 ; do for n in $(BRUTE) ; do : \ + ; echo "file-$$i$$j$$m$$n" >test.tmp/file$$i$$j$$m$$n.txt \ + ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \ + ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \ + ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \ + ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \ + ; done ; test -f test.tmp/file$$i$$j$$m$$n.txt || exit 2 \ + ; (cd test.tmp && $(MKZIP) ../test$$u$$v$$w$$x.zip file*.* >$(NULL)) \ + ; rm -rf test.tmp \ + ; 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 : \ + ; for m in 1 2 3 4 5 6 8 9 ; do for n in $(BRUTE) ; do : \ + ; ./$(zzcat) test$$u$$v$$w$$x/file$$i$$j$$m$$n.txt >test.out \ + ; if grep file-$$i$$j$$m$$n test.out >$(NULL) ; then rm test.out \ + ; else echo ERROR file-$$i$$j$$m$$n diff in test$$u$$v$$w$$x \ + ; exit 1 ; fi \ + ; ./$(zzdir) test$$u$$v$$w$$x >test.out \ + ; if grep file$$i$$j$$m$$n.txt test.out >$(NULL) ; then rm test.out \ + ; else echo ERROR file$$i$$j$$m$$n.txt not in test$$u$$v$$w$$x \ + ; exit 1 ; fi \ + ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \ + ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \ + ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \ + ; done ; test "$$i$$j$$m$$n" = "$$u$$v$$w$$x" && break \ + ; done ; rm test$$u$$v$$w$$x.zip \ + ; done ; done ; done ; done ; true + +# ------------------------------------------------------------------- + +noinst_PROGRAMS = zzipself zzipsetstub + +zzipself_LDFLAGS = @ZZIPLIB_LDFLAGS@ +zzipself_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz + +../zzip/libzzip.la : @top_srcdir@/zzip/*.c + (cd ../zzip && $(MAKE) `basename $@`) + +zzshowme$(EXEEXT) : zzipself$(EXEEXT) zzipsetstub$(EXEEXT) + zip -0 -j $@ .libs/zzipself$(EXEEXT) + zip -9 -j $@ $(README) + test ! -f $@.zip || mv $@.zip $@ + ./zzipsetstub $@ .libs/zzipself$(EXEEXT) + - chmod +x $@ + +check-sfx : zzshowme$(EXEEXT) + echo ___ $@ ___ + @ echo "./zzshowme readme >readme.out" \ + ; export LD_LIBRARY_PATH="../zzip/.libs:$$LD_LIBRARY_PATH" \ + ; ./zzshowme readme >readme.out 2>readme.err || cat readme.err || true + @ echo 'grep readme.out $(README) || grep "libzzip-" readme.err' \ + ; if test -s readme.out ; then diff readme.out $(README) \ + ; else grep "libzzip-" readme.err || echo "possibly an error!" ; fi + rm readme.out readme.err diff --git a/test/README b/test/README new file mode 100644 index 0000000..5668eda --- /dev/null +++ b/test/README @@ -0,0 +1,47 @@ +PROJECT + The zziplib provides read access to zipped files in a zip-archive, + using compression based solely on free algorithms provided by zlib. + It also provides a functionality to overlay the archive filesystem + with the filesystem of the operating system environment. + +AUTHOR + The project was originally written by Tomi Ollila, later largely + rewritten by Guido Draheim, and extended with contributions in + the years to follow. Guido Draheim holds the full + copyright to the zziplib sources. + +COPYING + The zziplib may be used freely under the restrictions of the + GNU Lesser General Public License version 2 or later. Alternativly + the Mozilla Public license can be chosen. The sources are under + a dual license, as long as the MPL hint is not removed, the modified + files will be again under a dual license for the final recipient. + +LICENSING + If you can not use a dynalinked library according to LGPL rules, + then look at docs/copying.htm for a few hints. Generally the LGPL + has a way for staticlinking as well as the MPL has a way. Anyway, + special (paid) licenses can be negotiated with the copyright holder. + +HOMEPAGE + The zziplib project is hosted at SourceForge, the complete + documentation can be found at http://zziplib.sf.net - the + SourceForge servers are also used to distribute the sources + of the zziplib project. Releases are announced via the + freshmeat services on http://freshmeat.net/projects/zziplib + +INSTALLATION + The zziplib sources are built with gnu autotools and they should + be easy to install on unixish systems via the usual sequence of + `configure && make && make check && make install`. Many distributors + ship prebuilt packages e.g. in rpm format. Additionally there are + MSVC project files shipped along for usage with the Microsoft + VisualC series of compilers. There should be no problem either + when crosscompiling the zziplib for a third host platform. + +MAINTAINANCE + The zziplib library is intentionally a lightweight interface to + zip files. The author take patches but please consider to put + complex extensions into separate modules rather than implanting them + right into the core of the library engine. All Patches and Bug Reports + should be sent to Guido Draheim . -- 2.40.0