mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
tests: Fix macro.
* tests/openpgp/defs.scm (with-ephemeral-home-directory): Make hygienic, use define-macro, do not change to the ephemeral home directory. * tests/gpgsm/setup.scm: Change to the ephemeral home directory. * tests/openpgp/setup.scm: Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
38671cfe5a
commit
4ded213698
@ -24,6 +24,7 @@
|
||||
(error "Usage: setup.scm --create-tarball <file> ..."))
|
||||
|
||||
(with-ephemeral-home-directory
|
||||
(chdir (getenv "GNUPGHOME"))
|
||||
(create-gpgsmhome)
|
||||
(stop-agent)
|
||||
(call-check `(,(tool 'gpgtar) --create --output ,(car tarball) ".")))
|
||||
|
@ -222,14 +222,16 @@
|
||||
|
||||
;; 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))))))
|
||||
(define-macro (with-ephemeral-home-directory . expressions)
|
||||
(let ((original-home-directory (gensym))
|
||||
(ephemeral-home-directory (gensym)))
|
||||
`(let ((,original-home-directory (getenv "GNUPGHOME"))
|
||||
(,ephemeral-home-directory (mkdtemp)))
|
||||
(finally (unlink-recursively ,ephemeral-home-directory)
|
||||
(dynamic-wind
|
||||
(lambda () (setenv "GNUPGHOME" ,ephemeral-home-directory #t))
|
||||
(lambda () ,@expressions)
|
||||
(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>
|
||||
|
@ -23,6 +23,7 @@
|
||||
(fail "Usage: setup.scm --create-tarball <file>"))
|
||||
|
||||
(with-ephemeral-home-directory
|
||||
(chdir (getenv "GNUPGHOME"))
|
||||
(create-gpghome)
|
||||
(create-legacy-gpghome)
|
||||
(stop-agent)
|
||||
|
Loading…
x
Reference in New Issue
Block a user