diff options
author | Werner Koch <[email protected]> | 2015-06-08 08:43:29 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2015-06-08 08:43:29 +0000 |
commit | a5b040cc57c65b3d105666b90c7eb59ee6ff3882 (patch) | |
tree | 6ead4e6bd57cb045c2a734f6a704dae3ab510357 /tests/start-stop-agent | |
parent | Set GPGME_SIGSUM_KEY_REVOKED also for gpg. (diff) | |
download | gpgme-a5b040cc57c65b3d105666b90c7eb59ee6ff3882.tar.gz gpgme-a5b040cc57c65b3d105666b90c7eb59ee6ff3882.zip |
Fix test suite for GnuPG 2.1 which uses pubring.kbx.
* tests/gpgsm/final.test: New.
* tests/gpgsm/initial.test: New.
* tests/gpg/start-stop-agent: Move to ../.
* tests/gpgsm/Makefile.am (TESTS_ENVIRONMENT): Export top_srcdir.
(TESTS): Add intial.test and final.test.
(AM_LDFLAGS): Add -no-install.
(clean-local): Use start-stop-agent
(initial.test): Add dependency.
* tests/gpg/Makefile.am (top_srcdir): Export top_srcdir.
(AM_LDFLAGS): Add -no-install.
(check-local): Depend on pubring-stamp instead of pubring.gpg.
(initial.test): Depend on check-local.
(./pubring-gpg): Replace by rule for ./pubring-stamp.
--
There are also a couple of other changes which should make the tests a
bit more robust and the gpg and gpgsm tests more similar.
The -no-install avoids creating wrappers for test programs, which make
debugging easier.
The dependency on check-local guarantees that its rules are run before
the first test. This is important because conf files are setup by
this rule. Earlier automake versions seem to have run check-local
always before the tests but today the order of execution is not
defined.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tests/start-stop-agent')
-rwxr-xr-x | tests/start-stop-agent | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/start-stop-agent b/tests/start-stop-agent new file mode 100755 index 00000000..ab47d8d9 --- /dev/null +++ b/tests/start-stop-agent @@ -0,0 +1,45 @@ +#!/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 |