Add ability to pipe to program's stdin, use to add non-seekable file.
diff --git a/regress/Makefile.am b/regress/Makefile.am
index f5a5f88..3005210 100644
--- a/regress/Makefile.am
+++ b/regress/Makefile.am
@@ -48,6 +48,7 @@
testfile.zip \
testfile-UTF8.zip \
testnottorrent.zip \
+ teststdin.zip \
teststored.zip \
testtorrent.tzip \
zip64.tzip
@@ -61,6 +62,7 @@
add_from_file_duplicate.test \
add_from_file_twice_duplicate.test \
add_from_filep.test \
+ add_from_stdin.test \
add_from_zip_deflated.test \
add_from_zip_partial_deflated.test \
add_from_zip_partial_stored.test \
diff --git a/regress/add_from_stdin.test b/regress/add_from_stdin.test
new file mode 100644
index 0000000..1bb343e
--- /dev/null
+++ b/regress/add_from_stdin.test
@@ -0,0 +1,6 @@
+# add stdin to zip
+pipein echo This is a test, and it seems to have been successful.
+program modify
+args teststdin.zip add_file teststring.txt /dev/stdin 0 -1
+return 0
+file-new teststdin.zip teststdin.zip
diff --git a/regress/runtest b/regress/runtest
index 6abd922..8fa5025 100755
--- a/regress/runtest
+++ b/regress/runtest
@@ -63,6 +63,9 @@
# mkdir MODE NAME
# create directory NAME with permissions MODE.
#
+# pipein PRG ARGS ...
+# execute PRG ARGS ... and pipe output to test program.
+#
# program PRG
# run PRG.
#
@@ -78,6 +81,8 @@
# program is expected to print TEXT to stdout. If multiple
# stdout commands are used, the messages are expected in
# the order given.
+#
+#
#
# exit status
# runtest uses the following exit codes:
@@ -256,6 +261,7 @@
FILES=''
FILES_SHOULD=''
DESCR=''
+PIPEIN=''
touch stderr stdout
@@ -282,6 +288,9 @@
mkdir)
set $arg
mkdir "$2" && chmod "$1" "$2";;
+ pipein)
+ test_empty "${PIPEIN}" pipein
+ PIPEIN="$arg";;
program)
PROGRAM=../"$arg";;
return)
@@ -312,11 +321,16 @@
if [ ! -z "${VERBOSE}" ]
then
- echo "${TEST}: ${DESCR}"
- echo "running: ${PROGRAM} ${ARGS}"
+ echo "${TEST}: ${DESCR}"
+ echo "running: ${PROGRAM} ${ARGS}"
fi
-${PROGRAM} ${ARGS} > gotout 2> goterr
+if [ ! -z "${PIPEIN}" ]
+then
+ ${PIPEIN} | ${PROGRAM} ${ARGS} > gotout 2> goterr
+else
+ ${PROGRAM} ${ARGS} > gotout 2> goterr
+fi
ret=$?
if [ $ret -ne ${RET} ]
diff --git a/regress/teststdin.zip b/regress/teststdin.zip
new file mode 100644
index 0000000..f9af3cf
--- /dev/null
+++ b/regress/teststdin.zip
Binary files differ