Add runtest from ckmame, and modify it for libzip's purposes.
Convert buffadd.c to add_from_buffer.c and make it use runtest.
Add another test, add_from_file.c.

--HG--
branch : HEAD
diff --git a/ChangeLog b/ChangeLog
index 9f262a4..c09c775 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-07-15  Thomas Klausner  <wiz@danbala.tuwien.ac.at>
+
+	* regress/Makefile.am: convert for new-style test cases
+	* regress/add_from_file.c: add, based on add_from_buffer.c
+	* regress/add_from_buffer.c: add, based on buffadd.c.
+	* regress/buffadd.c: removed.
+	* regress/runtest: add, based on ckmame's
+
 2005-07-14  Thomas Klausner  <wiz@danbala.tuwien.ac.at>
 
 	* compile, depcomp, install-sh, missing, mkinstalldirs: update
diff --git a/TODO b/TODO
index f6b294c..dcc0ce6 100644
--- a/TODO
+++ b/TODO
@@ -1,3 +1,5 @@
+* document that zip_source_free must not be called after
+  zip_{add,replace} was successful.
 ------------------------------------------------ others
 * regression tests (duplicate file names, unchange, .{200})
 * zip_commit
diff --git a/regress/Makefile.am b/regress/Makefile.am
index 3e5ea4c..87cec28 100644
--- a/regress/Makefile.am
+++ b/regress/Makefile.am
@@ -1,10 +1,14 @@
-noinst_PROGRAMS=buffadd open name_locate fread
+noinst_PROGRAMS=add_from_buffer add_from_file open name_locate fread
 noinst_HEADERS=mkname.h
 EXTRA_PROGRAMS=ziptest deltest
 
-EXTRA_DIST=broken.zip test.zip
+EXTRA_DIST= \
+	runtest \
+	${TESTCASES} \
+	testbuffer.zip \
+	testfile.txt testfile.zip \
+	broken.zip test.zip
 
-buffadd_SOURCES=	buffadd.c
 fread_SOURCES=		fread.c mkname.c
 name_locate_SOURCES=	name_locate.c mkname.c
 open_SOURCES=		open.c mkname.c
@@ -12,8 +16,37 @@
 deltest_SOURCES=	deltest.c
 ziptest_SOURCES=	ziptest.c
 
-TESTS=buffadd open name_locate fread
+TESTS=open name_locate fread
 TESTS_ENVIRONMENT=	SRCDIR=${srcdir}
 
+TESTCASES= \
+	add_from_file.test \
+	add_from_buffer.test
+
+check:
+	@failed=0; all=0; \
+	srcdir=$(srcdir); export srcdir; \
+	for tst in ${TESTCASES}; do \
+	  t=`basename $$tst .test`; \
+	  if ${TESTS_ENVIRONMENT} $(srcdir)/runtest $$t; then \
+	    all=`expr $$all + 1`; \
+	    echo "PASS: $$tst"; \
+	  elif test $$? -ne 77; then \
+	    all=`expr $$all + 1`; \
+	    failed=`expr $$failed + 1`; \
+	    echo "FAIL: $$tst"; \
+	  fi; \
+	done; \
+	if test "$$failed" -eq 0; then \
+	  banner="All $$all tests passed"; \
+	else \
+	  banner="$$failed of $$all tests failed"; \
+	fi; \
+	dashes=`echo "$$banner" | sed s/./=/g`; \
+	echo "$$dashes"; \
+	echo "$$banner"; \
+	echo "$$dashes"; \
+	test "$$failed" -eq 0
+
 AM_CPPFLAGS=-I${top_srcdir}/lib
 LDADD=../lib/libzip.la
diff --git a/regress/add_from_buffer.c b/regress/add_from_buffer.c
new file mode 100644
index 0000000..67b7078
--- /dev/null
+++ b/regress/add_from_buffer.c
@@ -0,0 +1,96 @@
+/*
+  $NiH$
+
+  add_from_buffer.c -- test case for adding file from buffer to archive
+  Copyright (C) 1999, 2003, 2005 Dieter Baron and Thomas Klausner
+
+  This file is part of libzip, a library to manipulate ZIP archives.
+  The authors can be contacted at <nih@giga.or.at>
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+  3. The names of the authors may not be used to endorse or promote
+     products derived from this software without specific prior
+     written permission.
+ 
+  THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "zip.h"
+
+const char *teststr="This is a test, and it seems to have been successful.\n";
+const char *file="teststring.txt";
+const char *prg;
+
+int
+main(int argc, char *argv[])
+{
+    char *srcdata;
+    const char *archive;
+    struct zip *za;
+    struct zip_file *zf;
+    struct zip_source *zs;
+    char buf[100];
+    int err;
+
+    prg = argv[0];
+
+    if (argc != 2) {
+	fprintf(stderr, "usage: %s archive\n", prg);
+	return 1;
+    }
+
+    archive = argv[1];
+    
+    if ((za=zip_open(archive, ZIP_CREATE, &err)) == NULL) {
+	zip_error_to_str(buf, sizeof(buf), err, errno);
+	fprintf(stderr,"%s: can't open zip archive %s: %s\n", prg,
+		archive, buf);
+	return 1;
+    }
+
+    if ((zs=zip_source_buffer(za, teststr, strlen(teststr), 0)) == NULL) {
+	fprintf(stderr,"%s: can't create zip_source from buffer: %s\n", prg,
+		zip_strerror(za));
+	exit(1);
+    }
+
+    if (zip_add(za, file, zs) == -1) {
+	zip_source_free(zs);
+	fprintf(stderr,"%s: can't add file `%s': %s\n", prg,
+		file, zip_strerror(za));
+	return 1;
+    }
+
+    if (zip_close(za) == -1) {
+	fprintf(stderr,"%s: can't close zip archive %s\n", prg,
+		file);
+	return 1;
+    }
+
+    return 0;
+}
diff --git a/regress/add_from_file.c b/regress/add_from_file.c
new file mode 100644
index 0000000..01d689a
--- /dev/null
+++ b/regress/add_from_file.c
@@ -0,0 +1,100 @@
+/*
+  $NiH$
+
+  add_from_file.c -- test case for adding file to archive
+  Copyright (C) 1999, 2003, 2005 Dieter Baron and Thomas Klausner
+
+  This file is part of libzip, a library to manipulate ZIP archives.
+  The authors can be contacted at <nih@giga.or.at>
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+  3. The names of the authors may not be used to endorse or promote
+     products derived from this software without specific prior
+     written permission.
+ 
+  THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
+  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
+  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "zip.h"
+
+static const char *prg;
+
+int
+main(int argc, char *argv[])
+{
+    char *srcdata;
+    const char *archive;
+    const char *file;
+    const char *name;
+    struct zip *za;
+    struct zip_file *zf;
+    struct zip_source *zs;
+    char buf[100];
+    int err;
+
+    prg = argv[0];
+
+    if (argc != 3) {
+	fprintf(stderr, "usage: %s archive file\n", prg);
+	return 1;
+    }
+
+    archive = argv[1];
+    file = argv[2];
+    
+    if ((za=zip_open(archive, ZIP_CREATE, &err)) == NULL) {
+	zip_error_to_str(buf, sizeof(buf), err, errno);
+	fprintf(stderr,"%s: can't open zip archive %s: %s\n", prg,
+		archive, buf);
+	return 1;
+    }
+
+    if ((zs=zip_source_file(za, file, 0, -1)) == NULL) {
+	fprintf(stderr,"%s: error creating file source for `%s': %s\n", prg,
+		file, zip_strerror(za));
+	return 1;
+    }
+
+    if ((name=strrchr(file, '/')) == NULL)
+	name = file;
+
+    if (zip_add(za, name, zs) == -1) {
+	zip_source_free(zs);
+	fprintf(stderr,"%s: can't add file `%s': %s\n", prg,
+		file, zip_strerror(za));
+	return 1;
+    }
+
+    if (zip_close(za) == -1) {
+	fprintf(stderr,"%s: can't close zip archive `%s'\n", prg,
+		archive);
+	return 1;
+    }
+
+    return 0;
+}
diff --git a/regress/buffadd.c b/regress/buffadd.c
deleted file mode 100644
index 2fe257a..0000000
--- a/regress/buffadd.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
-  $NiH: buffadd.c,v 1.10 2005/06/09 20:04:45 dillo Exp $
-
-  buffadd.c -- test cases for adding files from buffer
-  Copyright (C) 1999, 2003, 2005 Dieter Baron and Thomas Klausner
-
-  This file is part of libzip, a library to manipulate ZIP archives.
-  The authors can be contacted at <nih@giga.or.at>
-
-  Redistribution and use in source and binary forms, with or without
-  modification, are permitted provided that the following conditions
-  are met:
-  1. Redistributions of source code must retain the above copyright
-     notice, this list of conditions and the following disclaimer.
-  2. Redistributions in binary form must reproduce the above copyright
-     notice, this list of conditions and the following disclaimer in
-     the documentation and/or other materials provided with the
-     distribution.
-  3. The names of the authors may not be used to endorse or promote
-     products derived from this software without specific prior
-     written permission.
- 
-  THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
-  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
-  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "zip.h"
-
-char *teststr="This is a test, and it seems to have been successful.\n";
-char *testname="testfile.txt";
-char *testzip="test_zip.zip";
-
-int
-main(int argc, char *argv[])
-{
-    struct zip *za;
-    struct zip_file *zf;
-    struct zip_source *zs;
-    int err;
-    int len;
-    
-    char buf[2000];
-
-    remove(testzip);
-    
-    if ((za=zip_open(testzip, ZIP_CREATE, &err)) == NULL) {
-	zip_error_to_str(buf, sizeof(buf), err, errno);
-	fprintf(stderr,"%s: can't open zip archive %s: %s\n", argv[0],
-		testzip, buf);
-	exit(1);
-    }
-
-    if ((zs=zip_source_buffer(za, teststr, strlen(teststr), 0)) == NULL
-	|| zip_add(za, testname, zs) == -1) {
-	zip_source_free(zs);
-	fprintf(stderr,"%s: can't add buffer '%s': %s\n", argv[0],
-		teststr, zip_strerror(za));
-	exit(1);
-    }
-
-    if (zip_close(za) == -1) {
-	fprintf(stderr,"%s: can't close zip archive %s\n", argv[0],
-		testzip);
-	exit(1);
-    }
-
-    if ((za=zip_open(testzip, ZIP_CHECKCONS, &err))==NULL) {
-	zip_error_to_str(buf, sizeof(buf), err, errno);
-	fprintf(stderr,"%s: can't re-open zip archive %s: %s\n", argv[0],
-		testzip, buf);
-	exit(1);
-    }
-
-    if ((zf=zip_fopen(za, testname, 0))==NULL) {
-	fprintf(stderr,"%s: can't fopen file '%s' in '%s': %s\n", argv[0],
-		testname, testzip, zip_strerror(za));
-	exit(1);
-    }
-
-    if ((len=zip_fread(zf, buf, 2000)) < 0) {
-	fprintf(stderr,"%s: can't read from '%s' in zip archive '%s': %s\n",
-		argv[0], testname, testzip, zip_file_strerror(zf));
-	exit(1);
-    }
-    
-    zip_fclose(zf);
-    zf = zip_fopen(za, testname, 0);
-
-    /* not NUL-terminated, so we have to check length manually */
-    if (len != strlen(teststr) || strncmp(buf, teststr, len)) {
-	fprintf(stderr,"%s: wrong data: '%s' instead of '%s'\n", argv[0],
-		buf, teststr);
-	exit(1);
-    }
-
-    if (zip_close(za) == -1) {
-	fprintf(stderr,"%s: can't close zip archive %s\n", argv[0],
-		testzip);
-	exit(1);
-    }
-
-    buf[0] = '\0';
-    if ((err=zip_fread(zf, buf, 2000)) != -1) {
-	fprintf(stderr,"%s: can read from '%s' in closed zip archive '%s': %s\n",
-		argv[0], testname, testzip, zip_file_strerror(zf));
-	exit(1);
-    }
-    
-    remove(testzip);
-    
-    return 0;
-}
diff --git a/regress/runtest b/regress/runtest
new file mode 100755
index 0000000..889f958
--- /dev/null
+++ b/regress/runtest
@@ -0,0 +1,299 @@
+#!/bin/sh
+
+#  $NiH: runtest,v 1.17 2005/07/13 17:42:19 dillo Exp $
+#
+#  runtest -- run regression tests
+#  Copyright (C) 2002, 2003 Dieter Baron and Thomas Klausner
+#
+#  This file is part of libzip, a library to manipulate ZIP archives.
+#  The authors can be contacted at <nih@giga.or.at>
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# runtest TESTNAME
+#
+# files: 
+#   TESTNAME.test: test scenario
+#
+# test scenario:
+#    Lines beginning with # are comments.
+#
+#    The following commands are recognized; return and args must
+#    appear exactly once, the others are optional.
+#
+#	retrun RET
+#	    RET is the expected exit code
+#
+#	args ARGS
+#	    run program with command line arguments ARGS
+#	
+#	stdout TEXT
+#	    program is expected to print TEXT to stdout.  If multiple
+#	    stdout commands are used, the messages are expected in
+#	    the order given. 
+#   
+#	error TEXT
+#	    program is expected to produce the error message TEXT.  If
+#	    multiple error commands are used, the messages are
+#	    expected in the order given.
+#
+#	copy IN OUT
+#	    link file IN to OUT
+#
+#	file IN TEST OUT
+#           link zip file IN to TEST, check against OUT after
+#           program has run.
+#
+#	filenew CREATED EXPECTED
+#	    check that CREATED has been created and equals EXPECTED.
+#
+#	filedel IN TEST
+#	    link zip file IN to TEST, check that it is deleted.
+#
+# exit status
+#	runtest uses the following exit codes:
+#	    0: test passed
+#	    1: test failed
+#	    2: other error
+#	   77: test was skipped
+# 
+# environment variables:
+#   VERBOSE: if set, be more verbose (e. g., output diffs)
+#   NOCLEANUP: if set, don't delete directory test is run in
+
+die() {
+	echo "$0: $*" >&2;
+	cleanup;
+	exit 2;
+}
+
+fail() {
+	if [ ! -z "${VERBOSE}" ]
+	then
+	    echo "${TEST} -- FAILED: $*";
+	fi;
+	cleanup;
+	exit 1;
+}
+
+skip() {
+	if [ ! -z "${VERBOSE}" ]
+	then
+		echo "${TEST} -- skipped: $*";
+	fi;
+	cleanup;
+	exit 77;
+}
+
+succeed() {
+	if [ ! -z "${VERBOSE}" ]
+	then
+		echo "${TEST} -- passed";
+	fi
+	cleanup;
+	exit 0;
+}
+
+cleanup() {
+	cd ..;
+	if [ -z "${NOCLEANUP}" ]
+	then
+		rm -r ${DIR};
+	fi
+}
+
+checkfile() {
+    if [ ! -f "$2" ]
+    then
+	fail "missing output file: '$2'"
+    else
+	if [ ! -f "$1" ]
+	then
+	    die "cannot find input file $1"
+	fi
+	
+	diff "$1" "$2" > /dev/null
+	if [ $? -ne 0 ]
+	then
+	    if [ ! -z "${VERBOSE}" ]
+	    then
+		diff -u "$1" "$2"
+	    fi
+	    fail "$3"
+	fi
+    fi
+}
+
+checkzip() {
+    if [ ! -f "$2" ]
+    then
+	fail "missing output file: '$2'"
+    else
+	if [ ! -f "$1" ]
+	then
+	    die "cannot find input file $1"
+	fi
+	
+	${ZIPCMP} -t ${ZIPCMP_FLAGS} "$1" "$2"
+	if [ $? -ne 0 ]
+	then
+	    fail "$3"
+	fi
+    fi
+}
+
+test_empty() {
+    if [ ! -z "$1" ]
+    then
+	die "directive $2 appeared twice in test file"
+    fi
+}
+
+test_set() {
+    if [ -z "$1" ]
+    then
+	die "required directive $2 missing in test file"
+    fi
+}
+
+TEST=`echo $1 | sed 's/\.test$//'`
+shift
+
+DIR=${TEST}.d$$
+if [ -z "${srcdir}" ]
+then
+    srcdir=..
+else
+	# XXX: fix for absolute srcdir?
+	srcdir=../${srcdir}
+fi
+
+if [ -z "${ZIPCMP}" ]
+then
+    ZIPCMP=zipcmp
+else
+    if expr "${ZIPCMP}" : '[^/].*/' > /dev/null
+    then
+	ZIPCMP="../${ZIPCMP}"
+    fi
+fi
+
+if [ -z "${VERBOSE}" ]
+then
+    ZIPCMP_FLAGS='-q'
+else
+    ZIPCMP_FLAGS='-v'
+fi
+
+# XXX: set up trap to cleanup
+
+mkdir ${DIR} || ( die "cannot create test directory ${DIR}" )
+cd ${DIR} || ( die "cannot cd to test directory ${DIR}" )
+
+{
+
+RET=''
+ARGS=''
+FILES=''
+FILES_SHOULD=''
+
+touch errors stdout
+
+while read cmd arg
+do
+  case $cmd in
+  \#*) ;;
+  program)
+    PROGRAM=../$arg;;
+  return)
+    test_empty "${RET}" return
+    RET="$arg";;
+  args)
+    test_empty "${ARGS}" args
+    ARGS=$arg;;
+  copy)
+    set $arg
+    FILES_SHOULD="${FILES_SHOULD} $2"
+    cp "${srcdir}/$1" "$2";;
+  file)
+    set $arg
+    # XXX: check that $1 exists
+    FILES="${FILES} ${srcdir}/$3!$2";;
+  filenew)
+    set $arg
+    FILES="${FILES} ${srcdir}/$2!$1";;
+  filedel)
+    set $arg
+    # XXX: check that $1 exists
+    cp "${srcdir}/$1" "$2";;
+  stdout)
+    echo "$arg" >> stdout;;
+  error)
+    echo "${PROGRAM}: $arg" >> errors;;
+  *)
+    die "unknown directive '$cmd'"
+  esac
+done
+
+if [ -z "${PROGRAM}" ]
+then
+    die no program to run given
+fi
+
+test_set "${RET}" return
+test_set "${ARGS}" args
+
+if [ ! -z "${VERBOSE}" ]
+then
+	echo "running: ${PROGRAM} ${ARGS}"
+fi
+${PROGRAM} ${ARGS} > gotout 2> goterr
+ret=$?
+
+if [ $ret -ne ${RET} ]
+then
+    if [ ! -z "${VERBOSE}" ]
+    then
+	cat gotout
+	cat goterr
+    fi
+    fail "unexpected exit status: got $ret, expected ${RET}"
+fi
+
+FILES_SHOULD="${FILES_SHOULD} errors stdout gotout goterr"
+
+checkfile errors goterr "unexpected error output"
+checkfile stdout gotout "unexpected output"
+
+if [ ! -z "${FILES}" ]
+then
+    for fs in ${FILES}
+    do
+        set -- `echo ${fs} | tr '!' ' '`
+	FILES_SHOULD="${FILES_SHOULD} $2"
+	checkzip $1 $2 "zip file $2 wrong"
+    done
+fi
+
+# XXX: check that no additional files exist
+echo gotfiles shouldfiles ${FILES_SHOULD} | tr ' ' '\012' | sort > shouldfiles
+touch gotfiles
+find . -type f -print | sed 's!^./!!' | sort > gotfiles
+
+checkfile shouldfiles gotfiles "unexpected/missing files"
+
+succeed
+
+} < ${srcdir}/${TEST}.test
diff --git a/regress/testbuffer.zip b/regress/testbuffer.zip
new file mode 100644
index 0000000..e474989
--- /dev/null
+++ b/regress/testbuffer.zip
Binary files differ
diff --git a/regress/testfile.txt b/regress/testfile.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/regress/testfile.txt
diff --git a/regress/testfile.zip b/regress/testfile.zip
new file mode 100644
index 0000000..b46d298
--- /dev/null
+++ b/regress/testfile.zip
Binary files differ