summaryrefslogtreecommitdiff
path: root/tests/openpgp/defs.inc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/openpgp/defs.inc')
-rwxr-xr-xtests/openpgp/defs.inc99
1 files changed, 72 insertions, 27 deletions
diff --git a/tests/openpgp/defs.inc b/tests/openpgp/defs.inc
index 5d5e03d..941f786 100755
--- a/tests/openpgp/defs.inc
+++ b/tests/openpgp/defs.inc
@@ -12,22 +12,21 @@
#------ constants ---------------
#--------------------------------
-# Note that usrpass1 is also used in Makefile.am
-usrname1="one"
+usrname1="one@example.com"
usrpass1="def"
-usrname2="two"
+usrname2="two@example.com"
usrpass2=""
-usrname3="three"
+usrname3="three@example.com"
usrpass3=""
dsa_usrname1="pgp5"
-# we use the sub key because we do not yet have the logic to
-# to derive the first encryption key from a keyblock (I guess)
+# we use the sub key because we do not yet have the logic to to derive
+# the first encryption key from a keyblock (I guess) (Well of course
+# we have this by now and the notation below will lookup the primary
+# first and then search for the encryption subkey.)
dsa_usrname2="0xCB879DE9"
-dsa_keyrings="--keyring ./pubring.pkr --secret-keyring ./secring.skr"
-
plain_files="plain-1 plain-2 plain-3"
data_files="data-500 data-9000 data-32000 data-80000"
@@ -59,6 +58,7 @@ fatal () {
progress_cancel
echo "$pgmname: fatal:" $* >&2
echo "$pgmname: fatal:" $* >&5
+ echo stop >gnupg-test.stop
exit 1;
}
@@ -148,7 +148,7 @@ progress () {
#}
have_pubkey_algo () {
- if ../../g10/gpg2 --homedir . --version | grep "Pubkey:.*$1" >/dev/null
+ if $GPG --version | grep "Pubkey:.*$1" >/dev/null
then
true
else
@@ -157,7 +157,7 @@ have_pubkey_algo () {
}
have_cipher_algo () {
- if ../../g10/gpg2 --homedir . --version | grep "Cipher:.*$1" >/dev/null
+ if $GPG --version | grep "Cipher:.*$1" >/dev/null
then
true
else
@@ -166,7 +166,7 @@ have_cipher_algo () {
}
have_hash_algo () {
- if ../../g10/gpg2 --homedir . --version | grep "Hash:.*$1" >/dev/null
+ if $GPG --version | grep "Hash:.*$1" >/dev/null
then
true
else
@@ -175,11 +175,13 @@ have_hash_algo () {
}
all_cipher_algos () {
- ../../g10/gpg2 --homedir . --with-colons --list-config ciphername | sed 's/^cfg:ciphername://; s/;/ /g'
+ $GPG --with-colons --list-config ciphername \
+ | sed 's/^cfg:ciphername://; s/;/ /g'
}
all_hash_algos () {
- ../../g10/gpg2 --homedir . --with-colons --list-config digestname | sed 's/^cfg:digestname://; s/;/ /g'
+ $GPG --with-colons --list-config digestname \
+ | sed 's/^cfg:digestname://; s/;/ /g'
}
set -e
@@ -188,33 +190,76 @@ pgmname=`basename $0`
[ -z "$srcdir" ] && fatal "not called from make"
-# Make sure we have a valid option file even with VPATH builds.
-for f in gpg.conf ; do
- if [ -f ./$f ]; then
- :
- elif [ -f $srcdir/$f.tmpl ]; then
- cat $srcdir/$f.tmpl >$f
- fi
-done
+#
+if [ -f gnupg-test.stop ]; then
+ if [ $pgmname = "version.test" ]; then
+ rm gnupg-test.stop
+ else
+ # Skip the rest of the tests.
+ exit 77
+ fi
+fi
# Always work in the current directory. We set GNUPGHOME only if it
# has not been set already. Usually it is set through the Makefile's
# TESTS_ENVIRONMENT macro.
if [ -z "$GNUPGHOME" ]; then
- GNUPGHOME=`pwd`
+ GNUPGHOME=`/bin/pwd`
export GNUPGHOME
-elif [ "$GNUPGHOME" != `pwd` ]; then
+elif [ "$GNUPGHOME" != `/bin/pwd` ]; then
echo "$pgmname: GNUPGHOME not set to the cwd" $* >&2
exit 1
fi
+# We don't use GPG_AGENT_INFO anymore - better reset it.
+unset GPG_AGENT_INFO
+# (--no-permission-warning makes only sense on the commandline)
GPG="../../g10/gpg2 --no-permission-warning "
+# (We may not use a relative name for gpg-agent.)
+GPG_AGENT="$(cd ../../agent && /bin/pwd)/gpg-agent"
+GPG_CONNECT_AGENT="../../tools/gpg-connect-agent"
+GPGCONF="../../tools/gpgconf"
+GPG_PRESET_PASSPHRASE="../../agent/gpg-preset-passphrase"
+MKTDATA="../../tools/mk-tdata"
+PINENTRY="$(cd $srcdir && /bin/pwd)/pinentry.sh"
+# Default to empty passphrase for pinentry.sh
+PINENTRY_USER_DATA=
+
+# If --check-trustdb is not an option, GPG has been build without
+# trust model support. Thus we can't use --always-trust and some
+# other options.
+if $GPG --dump-options | grep '^--check-trustdb$' >/dev/null ; then
+ opt_always="--always-trust"
+else
+ opt_always=
+fi
-echo "Test: $pgmname" > ${pgmname}.log
-echo "GNUPGHOME=$GNUPGHOME" >> ${pgmname}.log
-echo "GPG_AGENT_INFO=$GPG_AGENT_INFO" >> ${pgmname}.log
-exec 5>&2 2>>${pgmname}.log
+# Make sure we have a valid option files even with VPATH builds.
+for f in gpg.conf gpg-agent.conf ; do
+ if [ -f ./$f ]; then
+ :
+ elif [ -f $srcdir/$f.tmpl ]; then
+ cat $srcdir/$f.tmpl >$f
+ case "$f" in
+ gpg.conf)
+ [ -n "${opt_always}" ] && echo "no-auto-check-trustdb" >>"$f"
+ echo "agent-program ${GPG_AGENT}|--debug-quick-random" >>"$f"
+ echo "allow-weak-digest-algos" >>"$f"
+ ;;
+ gpg-agent.conf)
+ echo "pinentry-program $PINENTRY" >>"$f"
+ ;;
+ esac
+ fi
+done
+if [ "${verbose:-0}" -gt "1" ]; then
+ exec 5>/dev/null
+else
+ echo "Test: $pgmname" > ${pgmname}.log
+ echo "GNUPGHOME=$GNUPGHOME" >> ${pgmname}.log
+ exec 5>&2 2>>${pgmname}.log
+fi
:
# end