aboutsummaryrefslogtreecommitdiffstats
path: root/tests/openpgp/defs.scm
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-10-20 09:37:26 +0000
committerJustus Winter <[email protected]>2016-10-20 15:01:23 +0000
commit2d794779e0fd9d9a1efc98e7bd77a296a25f4293 (patch)
tree95735cced09cade52951fbdab611ec4fd6c4df92 /tests/openpgp/defs.scm
parentagent, g10: Fix keygen. (diff)
downloadgnupg-2d794779e0fd9d9a1efc98e7bd77a296a25f4293.tar.gz
gnupg-2d794779e0fd9d9a1efc98e7bd77a296a25f4293.zip
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 <[email protected]>
Diffstat (limited to '')
-rw-r--r--tests/openpgp/defs.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index e484e8633..48ac46c03 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)))