[Pkg-gnupg-commit] [gnupg2] 136/292: tests: Create and remove socket directories.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Mon Nov 21 06:31:34 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gnupg2.
commit 2d794779e0fd9d9a1efc98e7bd77a296a25f4293
Author: Justus Winter <justus at g10code.com>
Date: Thu Oct 20 11:37:26 2016 +0200
tests: Create and remove socket directories.
* tests/openpgp/defs.scm (start-agent): Move function here and create
the socket directory prior to starting the agent.
(stop-agent): Move function here and remove the socket directory.
* tests/openpgp/finish.scm: Adapt.
* tests/openpgp/setup.scm: Likewise.
Signed-off-by: Justus Winter <justus at g10code.com>
---
tests/openpgp/defs.scm | 17 +++++++++++++++++
tests/openpgp/finish.scm | 3 +--
tests/openpgp/setup.scm | 19 ++++++-------------
3 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index e484e86..48ac46c 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -146,3 +146,20 @@
(let ((verbose (string->number (getenv "verbose"))))
(if (number? verbose)
(*set-verbose!* verbose)))
+
+;; Create the socket dir and start the agent.
+(define (start-agent)
+ (echo "Starting gpg-agent...")
+ (catch (echo "Warning: Creating socket directory failed:" (car *error*))
+ (call-popen `(,(tool 'gpgconf) --create-socketdir) ""))
+ (call-check `(,(tool 'gpg-connect-agent) --verbose
+ ,(string-append "--agent-program=" (tool 'gpg-agent)
+ "|--debug-quick-random")
+ /bye)))
+
+;; Stop the agent and remove the socket dir.
+(define (stop-agent)
+ (echo "Stopping gpg-agent...")
+ (catch (echo "Warning: Removing socket directory failed.")
+ (call-popen `(,(tool 'gpgconf) --remove-socketdir) ""))
+ (call-check `(,(tool 'gpg-connect-agent) --verbose killagent /bye)))
diff --git a/tests/openpgp/finish.scm b/tests/openpgp/finish.scm
index 48801c8..37845ae 100755
--- a/tests/openpgp/finish.scm
+++ b/tests/openpgp/finish.scm
@@ -19,5 +19,4 @@
(load (with-path "defs.scm"))
-(echo "Killing gpg-agent...")
-(call-check `(,(tool 'gpg-connect-agent) --verbose killagent /bye))
+(stop-agent)
diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm
index 75310d1..99fbdea 100755
--- a/tests/openpgp/setup.scm
+++ b/tests/openpgp/setup.scm
@@ -95,13 +95,7 @@
(pipe:spawn `(, at GPG --dearmor))
(pipe:spawn `(, at GPG --yes --import))))
-(define (start-agent)
- (echo "Starting gpg-agent...")
- (call-check `(,(tool 'gpg-connect-agent) --verbose
- ,(string-append "--agent-program=" (tool 'gpg-agent)
- "|--debug-quick-random")
- /bye))
-
+(define (preset-passphrases)
(info "Preset passphrases")
;; one at example.com
(call-check `(,(tool 'gpg-preset-passphrase)
@@ -119,19 +113,18 @@
"A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD"))
(echo "All set up."))
-(define (kill-agent)
- (call-check `(,(tool 'gpg-connect-agent) --verbose killagent /bye)))
-
(cond
((member "--create-tarball" *args*)
(with-temporary-working-directory
(setenv "GNUPGHOME" (getcwd) #t)
(create-gpghome)
- (kill-agent)
+ (stop-agent)
(call-check `(,(tool 'gpgtar) --create --output ,(cadr *args*) "."))))
((member "--unpack-tarball" *args*)
(call-check `(,(tool 'gpgtar) --extract --directory=. ,(cadr *args*)))
- (start-agent))
+ (start-agent)
+ (preset-passphrases))
(else
(create-gpghome)
- (start-agent)))
+ (start-agent)
+ (preset-passphrases)))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list