emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 7acb87a: Don't test symmetric operations on gpg 2.0


From: Noam Postavsky
Subject: [Emacs-diffs] master 7acb87a: Don't test symmetric operations on gpg 2.0 (Bug#23561)
Date: Sun, 15 Jul 2018 16:26:58 -0400 (EDT)

branch: master
commit 7acb87ab97082026e692e1d1d679df2313148343
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    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.
---
 test/lisp/emacs-lisp/package-tests.el | 12 +++++++++++-
 test/lisp/epg-tests.el                | 33 ++++++++++++++++++++-------------
 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 b1adfab..f08bc92 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 c34e589..d249e77 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]