aboutsummaryrefslogtreecommitdiffstats
path: root/tests/openpgp/defs.scm
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-12-14 13:18:22 +0000
committerJustus Winter <[email protected]>2016-12-14 15:41:18 +0000
commitca1e9749bfb069d90aa44efbf6f3d611b6104c1b (patch)
tree523a466ed36ebeb7b54d6149fddebfe5475edbd9 /tests/openpgp/defs.scm
parenttests: Rework check for trust models. (diff)
downloadgnupg-ca1e9749bfb069d90aa44efbf6f3d611b6104c1b.tar.gz
gnupg-ca1e9749bfb069d90aa44efbf6f3d611b6104c1b.zip
common: Support locating components in the build tree.
* common/homedir.c (gnupg_build_directory): New variable. (gnupg_module_name_called): Likewise. (gnupg_set_builddir): New function. (gnupg_set_builddir_from_env): Likewise. (gnupg_module_name): Support locating components in the build tree. * common/util.h (gnupg_set_builddir): New prototype. * tests/openpgp/defs.scm (tools): Drop 'gpg and 'gpg-agent. (tool): Rename to 'tool-hardcoded. (gpg-conf): New function, with accessors for the results. (gpg-components): New variable. (tool): New function. * tools/gpgconf.c (enum cmd_and_opt_values): New key. (opts): New option '--build-prefix'. (main): Handle new option. -- This change makes sure that the components from the build tree are used, and not some older installed version in PATH. It also lets us make GPGME use components from the build tree, making it possible to execute GPGME's test suite with them. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests/openpgp/defs.scm')
-rw-r--r--tests/openpgp/defs.scm24
1 files changed, 20 insertions, 4 deletions
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 5249ca9da..ef81f9964 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -56,9 +56,7 @@
value)))
(define tools
- '((gpg "GPG" "g10/gpg")
- (gpgv "GPGV" "g10/gpgv")
- (gpg-agent "GPG_AGENT" "agent/gpg-agent")
+ '((gpgv "GPGV" "g10/gpgv")
(gpg-connect-agent "GPG_CONNECT_AGENT" "tools/gpg-connect-agent")
(gpgconf "GPGCONF" "tools/gpgconf")
(gpg-preset-passphrase "GPG_PRESET_PASSPHRASE"
@@ -67,7 +65,7 @@
(gpg-zip "GPGZIP" "tools/gpg-zip")
(pinentry "PINENTRY" "tests/openpgp/fake-pinentry")))
-(define (tool which)
+(define (tool-hardcoded which)
(let ((t (assoc which tools))
(prefix (getenv "BIN_PREFIX")))
(getenv' (cadr t)
@@ -75,6 +73,24 @@
(string-append (getenv "objdir") "/" (caddr t))
(string-append prefix "/" (basename (caddr t))))))))
+(define (gpg-conf . args)
+ (let ((s (call-popen `(,(tool-hardcoded 'gpgconf) ,@args) "")))
+ (map (lambda (line) (string-split line #\:))
+ (string-split-newlines s))))
+(define :gc:c:name car)
+(define :gc:c:description cadr)
+(define :gc:c:pgmname caddr)
+
+(setenv "GNUPG_BUILDDIR" (getenv "objdir") #t)
+(define gpg-components (gpg-conf '--build-prefix (getenv "objdir")
+ '--list-components))
+
+(define (tool which)
+ (case which
+ ((gpg gpg-agent scdaemon gpgsm dirmngr)
+ (:gc:c:pgmname (assoc (symbol->string which) gpg-components)))
+ (else
+ (tool-hardcoded which))))
(define (gpg-has-option? option)
(string-contains? (call-popen `(,(tool 'gpg) --dump-options) "")