Change OpenPGP test framework to run under the control of the agent.

This commit is contained in:
Werner Koch 2010-06-07 15:11:35 +00:00
parent bbe388b5db
commit c8eb7bd839
8 changed files with 42 additions and 17 deletions

View File

@ -1,5 +1,7 @@
2010-06-07 Werner Koch <wk@g10code.com>
* sysutils.c [W32CE]: Finish pipe creation.
* estream.c (es_fname_get, es_fname_set): New.
(fname_set_internal): New.
(struct estream_internal): Add fields printable_fname and

View File

@ -299,11 +299,16 @@ translate_sys2libc_fd (gnupg_fd_t fd, int for_write)
}
/* This is the same as translate_sys2libc_fd but takes an integer
which is assumed to be such an system handle. */
which is assumed to be such an system handle. On WindowsCE the
passed FD is a rendezvous ID and the function finishes the pipe
creation. */
int
translate_sys2libc_fd_int (int fd, int for_write)
{
#ifdef HAVE_W32_SYSTEM
#if HAVE_W32CE_SYSTEM
fd = _assuan_w32ce_finish_pipe fd, for_write);
return translate_sys2libc_fd ((void*)fd, for_write);
#elif HAVE_W32_SYSTEM
if (fd <= 2)
return fd; /* Do not do this for error, stdin, stdout, stderr. */

View File

@ -1,3 +1,12 @@
2010-06-07 Werner Koch <wk@g10code.com>
* Makefile.am (TESTS_ENVIRONMENT): New. Start all scripts under
the control of the gpg-agent.
(prepared.stamp): Create gpg-agent.conf.
* defs.inc: Do not create gpg-agent.conf
(GNUPGHOME): Check that it is set properly.
(GPG_AGENT_INFO): Do not change.
2010-05-12 Werner Koch <wk@g10code.com>
* armor.test (Version): Add test for bug#1179.

View File

@ -23,6 +23,9 @@ GPG_IMPORT = ../../g10/gpg2 --homedir . \
required_pgms = ../../g10/gpg2 ../../agent/gpg-agent \
../../tools/gpg-connect-agent
TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= LC_ALL=C \
../../agent/gpg-agent --quiet --daemon sh
TESTS = version.test mds.test \
decrypt.test decrypt-dsa.test \
sigs.test sigs-dsa.test \
@ -49,8 +52,6 @@ DATA_FILES = data-500 data-9000 data-32000 data-80000 plain-large
EXTRA_DIST = defs.inc $(TESTS) $(TEST_FILES) \
mkdemodirs signdemokey
# Note that removing S.gpg-agent forces a running gpg-agent to
# terminate after some time.
CLEANFILES = prepared.stamp x y yy z out err $(DATA_FILES) \
plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \
*.test.log gpg_dearmor gpg.conf gpg-agent.conf S.gpg-agent \
@ -67,6 +68,7 @@ distclean-local:
prepared.stamp: ./pubring.gpg ./secring.gpg ./plain-1 ./plain-2 ./plain-3 \
./pubring.pkr ./secring.skr ./gpg_dearmor $(DATA_FILES)
$(GPG_IMPORT) $(srcdir)/pubdemo.asc
cat $(srcdir)/gpg-agent.conf.tmpl > gpg-agent.conf
echo timestamp >./prepared.stamp
# We need to depend on a couple of programs so that the tests don't

View File

@ -12,7 +12,7 @@
#info Checking decryption of supplied files
for i in $plain_files ; do
echo "$usrpass1" | $GPG --passphrase-fd 0 -o y --yes $srcdir/$i.asc
echo "$usrpass1" | $GPG --passphrase-fd 0 -o y --yes $srcdir/$i.asc
cmp $i y || error "$i: mismatch"
done

View File

@ -162,7 +162,7 @@ pgmname=`basename $0`
[ -z "$srcdir" ] && fatal "not called from make"
# Make sure we have a valid option files even with VPATH builds.
for f in gpg.conf gpg-agent.conf; do
for f in gpg.conf ; do
if [ -f ./$f ]; then
:
elif [ -f $srcdir/$f.tmpl ]; then
@ -170,19 +170,23 @@ for f in gpg.conf gpg-agent.conf; do
fi
done
# Always work in the current directory
GNUPGHOME=`pwd`
export GNUPGHOME
# We do not use an external info variable for gpg-agent because we use
# a standard socket in the home directory. This way gpg-agent will be
# started as soon as needed. It is terminated indirectly using a
# Makefile rule.
GPG_AGENT_INFO=
# 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`
export GNUPGHOME
elif [ "$GNUPGHOME" != `pwd` ]; then
echo "$pgmname: GNUPGHOME not set to the cwd" $* >&2
exit 1
fi
GPG="../../g10/gpg2 --no-permission-warning "
exec 5>&2 2>${pgmname}.log
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
:
# end

View File

@ -10,6 +10,9 @@
. $srcdir/defs.inc || exit 3
# FIXME: Skip this test for now
exit 77
$GPG --quiet --batch --debug-quick-random --gen-key <<EOF
Key-Type: DSA
Key-Length: 1024

View File

@ -1,2 +1,2 @@
use-standard-socket
no-use-standard-socket