diff options
Diffstat (limited to 'debian/tests')
-rw-r--r-- | debian/tests/control | 11 | ||||
-rwxr-xr-x | debian/tests/gpgv-win32 | 34 | ||||
-rwxr-xr-x | debian/tests/migration | 20 | ||||
-rw-r--r-- | debian/tests/simple-tests | 34 |
4 files changed, 99 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..7f84c8b --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,11 @@ +Tests: gpgv-win32 +Depends: gpgv-win32, gnupg2, gpgv2, wine32, diffutils +Restrictions: allow-stderr, skip-not-installable + +Tests: simple-tests +Depends: gnupg2, gpgv2 +Restrictions: allow-stderr + +Tests: migration +Depends: gpg, gnupg1, gnupg-utils, debian-archive-keyring, diffutils +Restrictions: allow-stderr diff --git a/debian/tests/gpgv-win32 b/debian/tests/gpgv-win32 new file mode 100755 index 0000000..035c060 --- /dev/null +++ b/debian/tests/gpgv-win32 @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +export GNUPGHOME=$(mktemp -d) +gpgargs=(--batch --quiet --pinentry-mode=loopback --passphrase '' --with-colons) + +# Generate a minimal signing key: +gpg "${gpgargs[@]}" --quick-gen-key 'Test key for gpgv-win32 <test-key@example.com>' + +gpg "${gpgargs[@]}" -o "$GNUPGHOME/key.gpg" --export test-key@example.com + +# Sign this very script +rm -f "${0}.gpg" +gpg "${gpgargs[@]}" --output "${0}.gpg" --detach-sign "${0}" + +# Verify using gpgv +gpgv --quiet --status-fd 3 3> native.status --keyring "$GNUPGHOME/key.gpg" "${0}.gpg" "${0}" + +WINE=/usr/lib/wine/wine +export WINESERVER=/usr/lib/wine/wineserver32 + +# Verify using gpgv.exe (using --status-fd 1 because i don't know how +# to pass a non-standard file descriptor into wine) +"$WINE" /usr/share/win32/gpgv.exe --quiet --status-fd 1 > win32.status --keyring "Z://${GNUPGHOME}/key.gpg" "${0}.gpg" "${0}" + +# convert to unix newlines if necessary: +sed -i 's/\r$//' win32.status + +diff -u native.status win32.status + +head -v win32.status + +rm -rf "$GNUPGHOME" diff --git a/debian/tests/migration b/debian/tests/migration new file mode 100755 index 0000000..b676999 --- /dev/null +++ b/debian/tests/migration @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e +set -x + +DIR=$(mktemp -d) +GPG_HOME="$DIR/gnupg" +gpg=(gpg --homedir "$GPG_HOME" --batch --quiet --with-colons) +gpg1=(gpg1 --homedir "$GPG_HOME" --batch --quiet --with-colons) + +mkdir "$GPG_HOME" +chmod 700 "$GPG_HOME" + +cat /usr/share/keyrings/debian-archive-*.gpg | "${gpg1[@]}" --import +"${gpg1[@]}" --list-keys +"${gpg[@]}" --list-keys > "$DIR/key.list.before" +migrate-pubring-from-classic-gpg "$GPG_HOME" +"${gpg[@]}" --list-keys > "$DIR/key.list.after" + +diff -u "$DIR/key.list.before" "$DIR/key.list.after" diff --git a/debian/tests/simple-tests b/debian/tests/simple-tests new file mode 100644 index 0000000..97d4ab4 --- /dev/null +++ b/debian/tests/simple-tests @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e +set -x + +DIR=$(mktemp -d) +GPG_HOME=$DIR/gnupg +gpg="gpg --homedir $GPG_HOME" + +mkdir $GPG_HOME +chmod 700 $GPG_HOME + +#trap "cd $HOME && rm -rf $DIR" EXIT + +cd $DIR + +cat > key-batch << EOF +Key-Type: default +Subkey-Type: default +Name-Real: test case +Name-Email: example@example.com +Expire-Date: 0 +%no-protection +%commit +EOF + +$gpg --batch --generate-key key-batch +$gpg -abs < $GPG_HOME/pubring.kbx > pubring.kbx.asc +$gpg --verify pubring.kbx.asc $GPG_HOME/pubring.kbx +gpgv --keyring $GPG_HOME/pubring.kbx pubring.kbx.asc $GPG_HOME/pubring.kbx + +# Encrypt +$gpg -e -r example@example.com < $GPG_HOME/pubring.kbx > pubring.kbx.gpg +$gpg -d -r example@example.com < pubring.kbx.gpg > pubring.kbx.gpg.dec |