1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

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> 2010-06-07 Werner Koch <wk@g10code.com>
* sysutils.c [W32CE]: Finish pipe creation.
* estream.c (es_fname_get, es_fname_set): New. * estream.c (es_fname_get, es_fname_set): New.
(fname_set_internal): New. (fname_set_internal): New.
(struct estream_internal): Add fields printable_fname and (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 /* 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 int
translate_sys2libc_fd_int (int fd, int for_write) 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) if (fd <= 2)
return fd; /* Do not do this for error, stdin, stdout, stderr. */ 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> 2010-05-12 Werner Koch <wk@g10code.com>
* armor.test (Version): Add test for bug#1179. * 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 \ required_pgms = ../../g10/gpg2 ../../agent/gpg-agent \
../../tools/gpg-connect-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 \ TESTS = version.test mds.test \
decrypt.test decrypt-dsa.test \ decrypt.test decrypt-dsa.test \
sigs.test sigs-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) \ EXTRA_DIST = defs.inc $(TESTS) $(TEST_FILES) \
mkdemodirs signdemokey 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) \ CLEANFILES = prepared.stamp x y yy z out err $(DATA_FILES) \
plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \ plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \
*.test.log gpg_dearmor gpg.conf gpg-agent.conf S.gpg-agent \ *.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 \ prepared.stamp: ./pubring.gpg ./secring.gpg ./plain-1 ./plain-2 ./plain-3 \
./pubring.pkr ./secring.skr ./gpg_dearmor $(DATA_FILES) ./pubring.pkr ./secring.skr ./gpg_dearmor $(DATA_FILES)
$(GPG_IMPORT) $(srcdir)/pubdemo.asc $(GPG_IMPORT) $(srcdir)/pubdemo.asc
cat $(srcdir)/gpg-agent.conf.tmpl > gpg-agent.conf
echo timestamp >./prepared.stamp echo timestamp >./prepared.stamp
# 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

View File

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

View File

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

View File

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