mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-07 17:33:02 +01:00
tests: Add tests for gpgtar and gpg-zip.
* tests/openpgp/Makefile.am (TESTS): Add new file. * tests/openpgp/gpgtar.test: New file. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
127aba9a4d
commit
556e8c4426
@ -46,6 +46,7 @@ TESTS = version.test mds.test \
|
|||||||
multisig.test verify.test armor.test \
|
multisig.test verify.test armor.test \
|
||||||
import.test ecc.test 4gb-packet.test \
|
import.test ecc.test 4gb-packet.test \
|
||||||
$(sqlite3_dependent_tests) \
|
$(sqlite3_dependent_tests) \
|
||||||
|
gpgtar.test \
|
||||||
finish.test
|
finish.test
|
||||||
|
|
||||||
|
|
||||||
@ -108,7 +109,7 @@ CLEANFILES = prepared.stamp x y yy z out err $(data_files) \
|
|||||||
gnupg-test.stop random_seed gpg-agent.log tofu.db
|
gnupg-test.stop random_seed gpg-agent.log tofu.db
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
-rm -rf private-keys-v1.d openpgp-revocs.d tofu.d
|
-rm -rf private-keys-v1.d openpgp-revocs.d tofu.d gpgtar.d
|
||||||
|
|
||||||
|
|
||||||
# We need to depend on a couple of programs so that the tests don't
|
# We need to depend on a couple of programs so that the tests don't
|
||||||
|
59
tests/openpgp/gpgtar.test
Executable file
59
tests/openpgp/gpgtar.test
Executable file
@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#set -x
|
||||||
|
|
||||||
|
# Make sure $srcdir is set.
|
||||||
|
if test "x$srcdir" = x
|
||||||
|
then
|
||||||
|
echo srcdir environment variable not set!
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
. $srcdir/defs.inc || exit 3
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Make sure $GNUPGHOME is set.
|
||||||
|
if test "x$GNUPGHOME" = x
|
||||||
|
then
|
||||||
|
echo "GNUPGHOME not set."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TESTFILES="$plain_files $data_files"
|
||||||
|
|
||||||
|
TESTDIR=gpgtar.d
|
||||||
|
FILELIST="${TESTDIR}/filelist"
|
||||||
|
GPG=../../g10/gpg2
|
||||||
|
GPGTAR="../../tools/gpgtar"
|
||||||
|
GPGZIP="sh ../../tools/gpg-zip --gpg-args --trust-model=always"
|
||||||
|
|
||||||
|
for TOOL in "$GPGTAR" "$GPGZIP"
|
||||||
|
do
|
||||||
|
rm -rf -- "${TESTDIR}"
|
||||||
|
mkdir "${TESTDIR}"
|
||||||
|
|
||||||
|
$TOOL --gpg "$GPG" --encrypt --recipient "$usrname2" \
|
||||||
|
--output "${TESTDIR}/test.tar.pgp" $TESTFILES
|
||||||
|
|
||||||
|
$TOOL --gpg "$GPG" --list-archive "${TESTDIR}/test.tar.pgp" >"$FILELIST"
|
||||||
|
for F in $TESTFILES
|
||||||
|
do
|
||||||
|
grep -qe "\\b${F}\\b" "$FILELIST"
|
||||||
|
done
|
||||||
|
|
||||||
|
EXTRACT_FLAGS="--directory=${TESTDIR}"
|
||||||
|
if [ "$TOOL" = "$GPGZIP" ]
|
||||||
|
then
|
||||||
|
EXTRACT_FLAGS="--tar-args $EXTRACT_FLAGS"
|
||||||
|
fi
|
||||||
|
$TOOL --gpg "$GPG" $EXTRACT_FLAGS --decrypt "${TESTDIR}/test.tar.pgp"
|
||||||
|
for F in $TESTFILES
|
||||||
|
do
|
||||||
|
diff -q "$F" "${TESTDIR}/$F"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
# Success!
|
||||||
|
|
||||||
|
exit 0
|
Loading…
x
Reference in New Issue
Block a user