tests: Improve GPGHOME handling.

* tests/openpgp/defs.scm (GPGHOME): New variable.
* tests/openpgp/ssh-import.scm: Remove redundant code, use 'path-join'.
* tests/openpgp/tofu.scm: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-01-16 13:59:56 +01:00
parent 0801f49b0d
commit 8b1611a960
3 changed files with 6 additions and 12 deletions

View File

@ -253,6 +253,7 @@
(setenv "GPG_AGENT_INFO" "" #t)
(setenv "GNUPGHOME" (getcwd) #t)
(define GNUPGHOME (getcwd))
;;
;; GnuPG helper.

View File

@ -20,10 +20,6 @@
(load (with-path "defs.scm"))
(setup-environment)
(define GNUPGHOME (getenv "GNUPGHOME"))
(if (string=? "" GNUPGHOME)
(fail "GNUPGHOME not set"))
(setenv "SSH_AUTH_SOCK"
(call-check `(,(tool 'gpgconf) --null --list-dirs agent-ssh-socket))
#t)
@ -55,7 +51,7 @@
car keys)
(info "Checking for issue2316...")
(unlink (string-append GNUPGHOME "/sshcontrol"))
(unlink (path-join GNUPGHOME "sshcontrol"))
(pipe:do
(pipe:open (path-join (in-srcdir "samplekeys")
(string-append "ssh-rsa.key"))

View File

@ -30,9 +30,6 @@
;; Redefine GPG without --always-trust and a fixed time.
(define GPG `(,(tool 'gpg) --no-permission-warning ,(faketime 0)))
(define GNUPGHOME (getenv "GNUPGHOME"))
(if (string=? "" GNUPGHOME)
(fail "GNUPGHOME not set"))
(catch (skip "Tofu not supported")
(call-check `(,@GPG --trust-model=tofu --list-config)))
@ -106,7 +103,7 @@
(info "Checking tofu policies and trust...")
;; Carefully remove the TOFU db.
(catch '() (unlink (string-append GNUPGHOME "/tofu.db")))
(catch '() (unlink (path-join GNUPGHOME "tofu.db")))
;; Verify a message. There should be no conflict and the trust
;; policy should be set to auto.
@ -205,7 +202,7 @@
))
;; Carefully remove the TOFU db.
(catch '() (unlink (string-append GNUPGHOME "/tofu.db")))
(catch '() (unlink (path-join GNUPGHOME "tofu.db")))
(check-counts "1C005AF3" 0 0 0 0)
(check-counts "BE04EB2B" 0 0 0 0)
@ -288,7 +285,7 @@
--faked-system-time=1476304861))
;; Carefully remove the TOFU db.
(catch '() (unlink (string-append GNUPGHOME "/tofu.db")))
(catch '() (unlink (path-join GNUPGHOME "tofu.db")))
(define DIR "tofu/cross-sigs")
;; The test keys.
@ -380,7 +377,7 @@
--faked-system-time=1476304861))
;; Carefully remove the TOFU db.
(catch '() (unlink (string-append GNUPGHOME "/tofu.db")))
(catch '() (unlink (path-join GNUPGHOME "tofu.db")))
(define DIR "tofu/cross-sigs")
;; The test keys.