1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

tests: Add macro managing ephemeral home directories.

* tests/openpgp/defs.scm (with-ephemeral-home-directory): New macro.
* tests/openpgp/setup.scm: Use the new macro.
This commit is contained in:
Justus Winter 2016-12-20 16:24:12 +01:00
parent a30c0a6972
commit c067a012c7
2 changed files with 12 additions and 2 deletions

View File

@ -200,6 +200,17 @@
;; GnuPG helper.
;;
;; Evaluate a sequence of expressions with an ephemeral home
;; directory.
(macro (with-ephemeral-home-directory form)
`(let ((original-home-directory (getenv "GNUPGHOME")))
(with-temporary-working-directory
(define ephemeral-home-directory (getcwd))
(dynamic-wind
(lambda () (setenv "GNUPGHOME" ephemeral-home-directory #t))
(lambda () ,@(cdr form))
(lambda () (setenv "GNUPGHOME" original-home-directory #t))))))
;; Call GPG to obtain the hash sums. Either specify an input file in
;; ARGS, or an string in INPUT. Returns a list of (<algo>
;; "<hashsum>") lists.

View File

@ -22,8 +22,7 @@
(unless (member "--create-tarball" *args*)
(fail "Usage: setup.scm --create-tarball <file>"))
(with-temporary-working-directory
(setenv "GNUPGHOME" (getcwd) #t)
(with-ephemeral-home-directory
(create-gpghome)
(create-legacy-gpghome)
(stop-agent)