diff options
| -rw-r--r-- | test/lisp/gnus/mml-sec-tests.el | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/lisp/gnus/mml-sec-tests.el b/test/lisp/gnus/mml-sec-tests.el index b715383c777..ba0783ba8cf 100644 --- a/test/lisp/gnus/mml-sec-tests.el +++ b/test/lisp/gnus/mml-sec-tests.el | |||
| @@ -82,7 +82,9 @@ instead of gpg-agent." | |||
| 82 | ;; not look in the proper places otherwise, see: | 82 | ;; not look in the proper places otherwise, see: |
| 83 | ;; https://bugs.gnupg.org/gnupg/issue2126 | 83 | ;; https://bugs.gnupg.org/gnupg/issue2126 |
| 84 | (setenv "GNUPGHOME" epg-gpg-home-directory) | 84 | (setenv "GNUPGHOME" epg-gpg-home-directory) |
| 85 | (funcall body)) | 85 | (unwind-protect |
| 86 | (funcall body) | ||
| 87 | (mml-sec-test--kill-gpg-agent))) | ||
| 86 | (error | 88 | (error |
| 87 | (setenv "GPG_AGENT_INFO" agent-info) | 89 | (setenv "GPG_AGENT_INFO" agent-info) |
| 88 | (setenv "GNUPGHOME" gpghome) | 90 | (setenv "GNUPGHOME" gpghome) |
| @@ -903,4 +905,16 @@ So the second decryption fails." | |||
| 903 | (let ((with-smime nil)) | 905 | (let ((with-smime nil)) |
| 904 | (ert-run-tests-batch))) | 906 | (ert-run-tests-batch))) |
| 905 | 907 | ||
| 908 | (defun mml-sec-test--kill-gpg-agent () | ||
| 909 | (dolist (pid (list-system-processes)) | ||
| 910 | (let ((atts (process-attributes pid))) | ||
| 911 | (when (and (equal (cdr (assq 'user atts)) (user-login-name)) | ||
| 912 | (equal (cdr (assq 'comm atts)) "gpg-agent") | ||
| 913 | (string-match | ||
| 914 | (concat "homedir.*" | ||
| 915 | (regexp-quote (expand-file-name "test/data/mml-sec" | ||
| 916 | source-directory))) | ||
| 917 | (cdr (assq 'args atts)))) | ||
| 918 | (call-process "kill" nil nil nil (format "%d" pid)))))) | ||
| 919 | |||
| 906 | ;;; mml-sec-tests.el ends here | 920 | ;;; mml-sec-tests.el ends here |