diff options
Diffstat (limited to 'tests/gpg')
-rw-r--r-- | tests/gpg/Makefile.am | 23 | ||||
-rwxr-xr-x | tests/gpg/final.test | 2 | ||||
-rwxr-xr-x | tests/gpg/initial.test | 2 | ||||
-rwxr-xr-x | tests/gpg/start-stop-agent | 45 |
4 files changed, 17 insertions, 55 deletions
diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am index 5f40dfe2..107397b4 100644 --- a/tests/gpg/Makefile.am +++ b/tests/gpg/Makefile.am @@ -22,7 +22,8 @@ GPG = gpg GPG_AGENT = gpg-agent -TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO= +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO= \ + top_srcdir=$(top_srcdir) # The keylist tests must come after the import and the edit test. noinst_HEADERS = t-support.h @@ -43,7 +44,7 @@ TESTS = initial.test $(c_tests) final.test CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ - random_seed S.gpg-agent .gpg-v21-migrated + random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp private_keys = \ 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \ @@ -53,11 +54,12 @@ private_keys = \ 7A030357C0F253A5BBCD282FFC4E521B37558F5C -EXTRA_DIST = start-stop-agent initial.test final.test \ +EXTRA_DIST = initial.test final.test \ pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \ geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys) AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ +AM_LDFLAGS = -no-install LDADD = ../../src/libgpgme.la t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread @@ -65,12 +67,16 @@ t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread noinst_PROGRAMS = $(c_tests) t-genkey clean-local: - -$(srcdir)/start-stop-agent --stop + -$(top_srcdir)/tests/start-stop-agent --stop -rm -fR private-keys-v1.d -check-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \ +check-local: ./gpg.conf ./gpg-agent.conf ./pubring-stamp \ ./private-keys-v1.d/gpg-sample.stamp +# To guarantee that check-local is run before any tests we +# add this dependency: +initial.test : check-local + export GNUPGHOME := $(abs_builddir) export GPG_AGENT_INFO := @@ -82,11 +88,12 @@ export GPG_AGENT_INFO := done echo x > ./private-keys-v1.d/gpg-sample.stamp -./pubring.gpg: $(srcdir)/pubdemo.asc - -$(GPG) --no-permission-warning \ - --import $(srcdir)/pubdemo.asc +./pubring-stamp: $(srcdir)/pubdemo.asc + $(GPG) --no-permission-warning \ + --import $(srcdir)/pubdemo.asc -$(GPG) --no-permission-warning \ --import $(srcdir)/secdemo.asc + touch ./pubring-stamp ./gpg.conf: # This is required for t-sig-notations. diff --git a/tests/gpg/final.test b/tests/gpg/final.test index 5148a34b..5289396f 100755 --- a/tests/gpg/final.test +++ b/tests/gpg/final.test @@ -1,4 +1,4 @@ #!/bin/sh -${srcdir}/start-stop-agent --stop +${top_srcdir}/tests/start-stop-agent --stop exit 0 diff --git a/tests/gpg/initial.test b/tests/gpg/initial.test index 1981c99d..93c8621a 100755 --- a/tests/gpg/initial.test +++ b/tests/gpg/initial.test @@ -1,4 +1,4 @@ #!/bin/sh -${srcdir}/start-stop-agent --start +${top_srcdir}/tests/start-stop-agent --start exit 0 diff --git a/tests/gpg/start-stop-agent b/tests/gpg/start-stop-agent deleted file mode 100755 index ab47d8d9..00000000 --- a/tests/gpg/start-stop-agent +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# Copyright (C) 2013 g10 Code GmbH -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. This file is -# distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY, to the extent permitted by law; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -if [ -z "$(command -v gpg-connect-agent)" ]; then - echo "gpg-agent not installed and thus not started" >&2 - exit 0; -fi - -GPG_AGENT_INFO= -export GPG_AGENT_INFO - -token=$(echo "gpgme-$(pwd)" | tr ' ' '_') - -if [ "$1" = "--stop" ]; then - if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ - != "D set" ]; then - echo "gpg-agent not running" >&2 - exit 0 - fi - echo "stopping gpg-agent " >&2 - gpg-connect-agent KILLAGENT /bye >/dev/null 2>&1 - exit 0 -fi - -if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ - = "D set" ]; then - echo "gpg-agent already running" >&2 - exit 0 -fi - -echo "starting gpg-agent " >&2 -gpg-connect-agent putval\ $token\ set /bye >/dev/null 2>&1 -if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ - != "D set" ]; then - echo "error starting gpg-agent" >&2 - exit 1 -fi -exit 0 |