mirror of
git://git.gnupg.org/gnupg.git
synced 2024-06-14 00:19:50 +02:00
tests: Use the new gpgconf.ctl based method.
* tests/openpgp/defs.scm: We expect that stuff is now installed. (tools): Fix the names. (intsalled?, bin-prefix): Remove. (tool-hardcoded): Simplify. (gpg-conf'): Simplify. (GNUPG_BUILDDIR): Do not anymore set this envvar. * tests/tpm2dtests/defs.scm: Ditto. -- This simplifies things a bit.
This commit is contained in:
parent
399ebf6d87
commit
84fcd8e6eb
|
@ -94,14 +94,14 @@ data files.
|
||||||
**** GPGSCM_PATH
|
**** GPGSCM_PATH
|
||||||
Used to locate the Scheme library as well as code used by the test
|
Used to locate the Scheme library as well as code used by the test
|
||||||
suite.
|
suite.
|
||||||
**** BIN_PREFIX
|
**** GNUPG_BUILD_ROOT
|
||||||
The test suite does not hardcode any paths to tools. If set it is
|
To locate the actual binaries under test the test suite requires that
|
||||||
used to locate the tools to test, otherwise the test suite assumes to
|
those binaries and associate files are installed to a test location.
|
||||||
be run from the build directory.
|
This envvar gives the root directory of the install tree. See
|
||||||
**** GPG_PRESET_PASSPHRASE
|
tests/gpgconf.ctl for the way we tell the GnuPG components this
|
||||||
This tool is not installed by 'make install', hence we need to
|
location. Note that we can't use that envvar directlyr because this
|
||||||
explicitly override its position. In fact, the location of any tool
|
would allow user scripts and other software to accidently mess up the
|
||||||
used by the test suite can be overridden this way. See defs.scm.
|
used components.
|
||||||
**** argv[0]
|
**** argv[0]
|
||||||
run-tests.scm depends on being able to re-exec gpgscm. It uses
|
run-tests.scm depends on being able to re-exec gpgscm. It uses
|
||||||
argv[0] for that. Therefore you must use an absolute path to invoke
|
argv[0] for that. Therefore you must use an absolute path to invoke
|
||||||
|
|
|
@ -111,26 +111,27 @@
|
||||||
(assert (equal? (percent-encode "%61") "%2561"))
|
(assert (equal? (percent-encode "%61") "%2561"))
|
||||||
(assert (equal? (percent-encode "foob%61r") "foob%2561r"))
|
(assert (equal? (percent-encode "foob%61r") "foob%2561r"))
|
||||||
|
|
||||||
|
;; Note that the entry for pinentry relies on the fact that
|
||||||
|
;; GNUPG_BUILD_ROOT has the bin,libexec,share directories (where we
|
||||||
|
;; have installed versions of the tools under test) as well as the
|
||||||
|
;; openpgp directory. The second element in each list is an envvar which
|
||||||
|
;; can be used to specifiy a different tool than the installed one.
|
||||||
(define tools
|
(define tools
|
||||||
'((gpgv "GPGV" "g10/gpgv")
|
'((gpgv "GPGV" "bin/gpgv")
|
||||||
(gpg-connect-agent "GPG_CONNECT_AGENT" "tools/gpg-connect-agent")
|
(gpg-connect-agent "GPG_CONNECT_AGENT" "bin/gpg-connect-agent")
|
||||||
(gpgconf "GPGCONF" "tools/gpgconf")
|
(gpgconf "GPGCONF" "bin/gpgconf")
|
||||||
(gpg-preset-passphrase "GPG_PRESET_PASSPHRASE"
|
(gpg-preset-passphrase "GPG_PRESET_PASSPHRASE"
|
||||||
"agent/gpg-preset-passphrase")
|
"libexec/gpg-preset-passphrase")
|
||||||
(gpgtar "GPGTAR" "tools/gpgtar")
|
(gpgtar "GPGTAR" "bin/gpgtar")
|
||||||
(gpg-zip "GPGZIP" "tools/gpg-zip")
|
(pinentry "PINENTRY" "openpgp/fake-pinentry")))
|
||||||
(pinentry "PINENTRY" "tests/openpgp/fake-pinentry")))
|
|
||||||
|
|
||||||
(define bin-prefix (getenv "BIN_PREFIX"))
|
|
||||||
(define installed? (not (string=? "" bin-prefix)))
|
|
||||||
(define with-valgrind? (not (string=? (getenv "with_valgrind") "")))
|
|
||||||
|
|
||||||
(define (tool-hardcoded which)
|
(define (tool-hardcoded which)
|
||||||
(let ((t (assoc which tools)))
|
(let ((t (assoc which tools)))
|
||||||
(getenv' (cadr t)
|
(getenv' (cadr t)
|
||||||
(qualify (if installed?
|
(qualify (string-append (getenv "GNUPG_BUILD_ROOT")
|
||||||
(string-append bin-prefix "/" (basename (caddr t)))
|
"/" (caddr t))))))
|
||||||
(string-append (getenv "objdir") "/" (caddr t)))))))
|
|
||||||
|
(define with-valgrind? (not (string=? (getenv "with_valgrind") "")))
|
||||||
|
|
||||||
;; You can splice VALGRIND into your argument vector to run programs
|
;; You can splice VALGRIND into your argument vector to run programs
|
||||||
;; under valgrind. For example, to run valgrind on gpg, you may want
|
;; under valgrind. For example, to run valgrind on gpg, you may want
|
||||||
|
@ -142,15 +143,10 @@
|
||||||
'("/usr/bin/valgrind" -q --leak-check=no --track-origins=yes
|
'("/usr/bin/valgrind" -q --leak-check=no --track-origins=yes
|
||||||
--error-exitcode=154 --exit-on-first-error=yes))
|
--error-exitcode=154 --exit-on-first-error=yes))
|
||||||
|
|
||||||
(unless installed?
|
|
||||||
(setenv "GNUPG_BUILDDIR" (getenv "objdir") #t))
|
|
||||||
|
|
||||||
(define (gpg-conf . args)
|
(define (gpg-conf . args)
|
||||||
(gpg-conf' "" args))
|
(gpg-conf' "" args))
|
||||||
(define (gpg-conf' input args)
|
(define (gpg-conf' input args)
|
||||||
(let ((s (call-popen `(,(tool-hardcoded 'gpgconf)
|
(let ((s (call-popen `(,(tool-hardcoded 'gpgconf)
|
||||||
,@(if installed? '()
|
|
||||||
(list '--build-prefix (getenv "objdir")))
|
|
||||||
,@args) input)))
|
,@args) input)))
|
||||||
(map (lambda (line) (map percent-decode (string-split line #\:)))
|
(map (lambda (line) (map percent-decode (string-split line #\:)))
|
||||||
(string-split-newlines s))))
|
(string-split-newlines s))))
|
||||||
|
|
|
@ -61,26 +61,22 @@
|
||||||
(assert (equal? (percent-encode "foob%61r") "foob%2561r"))
|
(assert (equal? (percent-encode "foob%61r") "foob%2561r"))
|
||||||
|
|
||||||
(define tools
|
(define tools
|
||||||
'((gpgv "GPGV" "g10/gpgv")
|
'((gpgv "GPGV" "bin/gpgv")
|
||||||
(gpg-connect-agent "GPG_CONNECT_AGENT" "tools/gpg-connect-agent")
|
(gpg-connect-agent "GPG_CONNECT_AGENT" "bin/gpg-connect-agent")
|
||||||
(gpgconf "GPGCONF" "tools/gpgconf")
|
(gpgconf "GPGCONF" "bin/gpgconf")
|
||||||
(gpg-preset-passphrase "GPG_PRESET_PASSPHRASE"
|
(gpg-preset-passphrase "GPG_PRESET_PASSPHRASE"
|
||||||
"agent/gpg-preset-passphrase")
|
"libexec/gpg-preset-passphrase")
|
||||||
(gpgtar "GPGTAR" "tools/gpgtar")
|
(gpgtar "GPGTAR" "bin/gpgtar")
|
||||||
(gpg-zip "GPGZIP" "tools/gpg-zip")
|
(tpm2daemon "TPM2DAEMON" "libexec/tpm2daemon")
|
||||||
(pinentry "PINENTRY" "tests/openpgp/fake-pinentry")
|
(pinentry "PINENTRY" "openpgp/fake-pinentry")))
|
||||||
(tpm2daemon "TPM2DAEMON" "tpm2d/tpm2daemon")))
|
|
||||||
|
|
||||||
(define bin-prefix (getenv "BIN_PREFIX"))
|
|
||||||
(define installed? (not (string=? "" bin-prefix)))
|
|
||||||
(define with-valgrind? (not (string=? (getenv "with_valgrind") "")))
|
(define with-valgrind? (not (string=? (getenv "with_valgrind") "")))
|
||||||
|
|
||||||
(define (tool-hardcoded which)
|
(define (tool-hardcoded which)
|
||||||
(let ((t (assoc which tools)))
|
(let ((t (assoc which tools)))
|
||||||
(getenv' (cadr t)
|
(getenv' (cadr t)
|
||||||
(qualify (if installed?
|
(qualify (string-append (getenv "GNUPG_BUILD_ROOT")
|
||||||
(string-append bin-prefix "/" (basename (caddr t)))
|
"/" (caddr t))))))
|
||||||
(string-append (getenv "objdir") "/" (caddr t)))))))
|
|
||||||
|
|
||||||
;; You can splice VALGRIND into your argument vector to run programs
|
;; You can splice VALGRIND into your argument vector to run programs
|
||||||
;; under valgrind. For example, to run valgrind on gpg, you may want
|
;; under valgrind. For example, to run valgrind on gpg, you may want
|
||||||
|
@ -92,15 +88,10 @@
|
||||||
'("/usr/bin/valgrind" -q --leak-check=no --track-origins=yes
|
'("/usr/bin/valgrind" -q --leak-check=no --track-origins=yes
|
||||||
--error-exitcode=154 --exit-on-first-error=yes))
|
--error-exitcode=154 --exit-on-first-error=yes))
|
||||||
|
|
||||||
(unless installed?
|
|
||||||
(setenv "GNUPG_BUILDDIR" (getenv "objdir") #t))
|
|
||||||
|
|
||||||
(define (gpg-conf . args)
|
(define (gpg-conf . args)
|
||||||
(gpg-conf' "" args))
|
(gpg-conf' "" args))
|
||||||
(define (gpg-conf' input args)
|
(define (gpg-conf' input args)
|
||||||
(let ((s (call-popen `(,(tool-hardcoded 'gpgconf)
|
(let ((s (call-popen `(,(tool-hardcoded 'gpgconf)
|
||||||
,@(if installed? '()
|
|
||||||
(list '--build-prefix (getenv "objdir")))
|
|
||||||
,@args) input)))
|
,@args) input)))
|
||||||
(map (lambda (line) (map percent-decode (string-split line #\:)))
|
(map (lambda (line) (map percent-decode (string-split line #\:)))
|
||||||
(string-split-newlines s))))
|
(string-split-newlines s))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user