[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master b725049: Fix epg-tests with dummy-pinentry program
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] master b725049: Fix epg-tests with dummy-pinentry program (Bug#23619) |
Date: |
Tue, 28 Feb 2017 19:59:50 -0500 (EST) |
branch: master
commit b7250496bd2d681a7a7f3c958eb3f0047b5c0a22
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Fix epg-tests with dummy-pinentry program (Bug#23619)
* test/data/epg/dummy-pinentry: New file.
* test/lisp/epg-tests.el (with-epg-tests): Add it to gpg-agent.conf
when a passphrase is required. Add debug declaration. Set
GPG_AGENT_INFO non-destructively.
---
test/data/epg/dummy-pinentry | 22 ++++++++++++++++++++++
test/lisp/epg-tests.el | 18 ++++++++++++------
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/test/data/epg/dummy-pinentry b/test/data/epg/dummy-pinentry
new file mode 100755
index 0000000..2228dfb
--- /dev/null
+++ b/test/data/epg/dummy-pinentry
@@ -0,0 +1,22 @@
+#! /bin/bash
+# Dummy pinentry
+#
+# Copyright 2008 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.
+
+echo OK Your orders please
+
+while read cmd; do
+ case $cmd in
+ GETPIN) echo D test0123456789; echo OK;;
+ *) echo OK;;
+ esac
+done
diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el
index ea2b62c..c615272 100644
--- a/test/lisp/epg-tests.el
+++ b/test/lisp/epg-tests.el
@@ -52,8 +52,9 @@
require-secret-key)
&rest body)
"Set up temporary locations and variables for testing."
- (declare (indent 1))
- `(let ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t)))
+ (declare (indent 1) (debug (sexp body)))
+ `(let ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t))
+ (process-environment (cons "GPG_AGENT_INFO" process-environment)))
(unwind-protect
(let ((context (epg-make-context 'OpenPGP)))
(setf (epg-context-program context)
@@ -63,11 +64,16 @@
`'require-passphrase))))
(setf (epg-context-home-directory context)
epg-tests-home-directory)
- (setenv "GPG_AGENT_INFO")
,(if require-passphrase
- `(epg-context-set-passphrase-callback
- context
- #'epg-tests-passphrase-callback))
+ `(with-temp-file (expand-file-name
+ "gpg-agent.conf" epg-tests-home-directory)
+ (insert "pinentry-program "
+ (expand-file-name "dummy-pinentry"
+ epg-tests-data-directory)
+ "\n")
+ (epg-context-set-passphrase-callback
+ context
+ #'epg-tests-passphrase-callback)))
,(if require-public-key
`(epg-import-keys-from-file
context
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master b725049: Fix epg-tests with dummy-pinentry program (Bug#23619),
Noam Postavsky <=