summaryrefslogtreecommitdiff
path: root/test/lisp
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2018-07-15 09:37:59 -0400
committerNoam Postavsky <npostavs@gmail.com>2018-07-15 16:26:22 -0400
commit7acb87ab97082026e692e1d1d679df2313148343 (patch)
tree19842b8c3c003a01e953b17445d5b11c49518598 /test/lisp
parent95931085fafc67aebc62ec0c672d29bfbecd1e8a (diff)
downloademacs-7acb87ab97082026e692e1d1d679df2313148343.tar.gz
emacs-7acb87ab97082026e692e1d1d679df2313148343.tar.bz2
emacs-7acb87ab97082026e692e1d1d679df2313148343.zip
Don't test symmetric operations on gpg 2.0 (Bug#23561)
On the Hydra test machines, which have gpg 2.0, the symmetric tests fail. * test/lisp/epg-tests.el (with-epg-tests): Pass REQUIRE-PUBLIC-KEY to `epg-tests-find-usable-gpg-configuration' and call it before `epg-make-context' so that the latter uses the resulting cached config. (epg-tests-find-usable-gpg-configuration): Only allow gpg 2.0 for symmetric operations. Clear `epg--configurations' and don't pass NO-CACHE to `epg-find-configuration'. (epg-tests--config-program-alist): Use copy-tree to avoid modifying the epg-config--program-alist cons values. * test/lisp/emacs-lisp/package-tests.el (package-test-signed): Allow running with gpg 2.0.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/emacs-lisp/package-tests.el12
-rw-r--r--test/lisp/epg-tests.el33
2 files changed, 31 insertions, 14 deletions
diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el
index b1adfabe525..f08bc92ff2a 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -473,7 +473,17 @@ Must called from within a `tar-mode' buffer."
(let ((process-environment
(cons (concat "HOME=" homedir)
process-environment)))
- (epg-find-configuration 'OpenPGP))
+ (epg-find-configuration
+ 'OpenPGP nil
+ ;; By default we require gpg2 2.1+ due to some
+ ;; practical problems with pinentry. But this
+ ;; test works fine with 2.0 as well.
+ (let ((prog-alist (copy-tree epg-config--program-alist)))
+ (setf (alist-get "gpg2"
+ (alist-get 'OpenPGP prog-alist)
+ nil nil #'equal)
+ "2.0")
+ prog-alist)))
(delete-directory homedir t))))
(let* ((keyring (expand-file-name "key.pub" package-test-data-dir))
(package-test-data-dir
diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el
index c34e589a4ac..d249e77fb15 100644
--- a/test/lisp/epg-tests.el
+++ b/test/lisp/epg-tests.el
@@ -33,17 +33,26 @@
(defconst epg-tests--config-program-alist
;; The default `epg-config--program-alist' requires gpg2 2.1 or
- ;; greater due to some practical problems with pinentry. But the
- ;; tests here all work fine with 2.0 as well.
- (let ((prog-alist (copy-sequence epg-config--program-alist)))
+ ;; greater due to some practical problems with pinentry. But most
+ ;; tests here work fine with 2.0 as well.
+ (let ((prog-alist (copy-tree epg-config--program-alist)))
(setf (alist-get "gpg2"
(alist-get 'OpenPGP prog-alist)
nil nil #'equal)
"2.0")
prog-alist))
-(defun epg-tests-find-usable-gpg-configuration (&optional _require-passphrase)
- (epg-find-configuration 'OpenPGP 'no-cache epg-tests--config-program-alist))
+(defun epg-tests-find-usable-gpg-configuration
+ (&optional require-passphrase require-public-key)
+ ;; Clear config cache because we may be using a different
+ ;; program-alist. We do want to update the cache, so that
+ ;; `epg-make-context' can use our result.
+ (setq epg--configurations nil)
+ (epg-find-configuration 'OpenPGP nil
+ ;; The symmetric operations fail on Hydra
+ ;; with gpg 2.0.
+ (if (or (not require-passphrase) require-public-key)
+ epg-tests--config-program-alist)))
(defun epg-tests-passphrase-callback (_c _k _d)
;; Need to create a copy here, since the string will be wiped out
@@ -63,14 +72,12 @@
(format "GNUPGHOME=%s" epg-tests-home-directory))
process-environment)))
(unwind-protect
- (let ((context (epg-make-context 'OpenPGP))
- (epg-config (epg-tests-find-usable-gpg-configuration
- ,(if require-passphrase
- `'require-passphrase))))
- ;; GNUPGHOME is needed to find a usable gpg, so we can't
- ;; check whether to skip any earlier (Bug#23561).
- (unless epg-config
- (ert-skip "No usable gpg config"))
+ ;; GNUPGHOME is needed to find a usable gpg, so we can't
+ ;; check whether to skip any earlier (Bug#23561).
+ (let ((epg-config (or (epg-tests-find-usable-gpg-configuration
+ ,require-passphrase ,require-public-key)
+ (ert-skip "No usable gpg config")))
+ (context (epg-make-context 'OpenPGP)))
(setf (epg-context-program context)
(alist-get 'program epg-config))
(setf (epg-context-home-directory context)