summaryrefslogtreecommitdiff
path: root/tests/openpgp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2022-09-16 07:45:23 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2022-09-16 07:45:23 +0900
commit4497851adccf3cd3a801797b36bacc8d6f0920f0 (patch)
tree9f0423415d59ca26c14c0a1dde30221ab16a5a04 /tests/openpgp
parent3c74890c721740d405adcfeb89aeecc03ef49e6c (diff)
downloadgpg2-4497851adccf3cd3a801797b36bacc8d6f0920f0.tar.gz
gpg2-4497851adccf3cd3a801797b36bacc8d6f0920f0.tar.bz2
gpg2-4497851adccf3cd3a801797b36bacc8d6f0920f0.zip
Imported Upstream version 2.3.3upstream/2.3.3
Diffstat (limited to 'tests/openpgp')
-rw-r--r--tests/openpgp/Makefile.am1
-rw-r--r--tests/openpgp/Makefile.in1
-rw-r--r--tests/openpgp/README15
-rw-r--r--tests/openpgp/defs.scm21
4 files changed, 17 insertions, 21 deletions
diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am
index 106e49c..3d0cc9d 100644
--- a/tests/openpgp/Makefile.am
+++ b/tests/openpgp/Makefile.am
@@ -38,6 +38,7 @@ TESTS_ENVIRONMENT = LC_ALL=C \
PATH="../gpgscm:$(PATH)" \
abs_top_srcdir="$(abs_top_srcdir)" \
objdir="$(abs_top_builddir)" \
+ GNUPG_BUILD_ROOT="$(abs_top_builddir)" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
XTESTS = \
diff --git a/tests/openpgp/Makefile.in b/tests/openpgp/Makefile.in
index 30dbb87..fa88f94 100644
--- a/tests/openpgp/Makefile.in
+++ b/tests/openpgp/Makefile.in
@@ -459,6 +459,7 @@ TESTS_ENVIRONMENT = LC_ALL=C \
PATH="../gpgscm:$(PATH)" \
abs_top_srcdir="$(abs_top_srcdir)" \
objdir="$(abs_top_builddir)" \
+ GNUPG_BUILD_ROOT="$(abs_top_builddir)" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
XTESTS = version.scm enarmor.scm mds.scm decrypt.scm \
diff --git a/tests/openpgp/README b/tests/openpgp/README
index d85ff3f..63f1886 100644
--- a/tests/openpgp/README
+++ b/tests/openpgp/README
@@ -1,4 +1,5 @@
# Emacs, this is an -*- org -*- file.
+#+STARTUP: showall
* How to run the test suite
** tldr: How to run all tests fast.
@@ -94,14 +95,12 @@ data files.
**** GPGSCM_PATH
Used to locate the Scheme library as well as code used by the test
suite.
-**** BIN_PREFIX
-The test suite does not hardcode any paths to tools. If set it is
-used to locate the tools to test, otherwise the test suite assumes to
-be run from the build directory.
-**** GPG_PRESET_PASSPHRASE
-This tool is not installed by 'make install', hence we need to
-explicitly override its position. In fact, the location of any tool
-used by the test suite can be overridden this way. See defs.scm.
+**** GNUPG_BUILD_ROOT
+This envvar gives the root directory of the build tree. See
+tests/gpgconf.ctl.in for the way we tell the GnuPG components this
+location. Note that we can't use that envvar directly because this
+would allow user scripts and other software to accidently mess up the
+used components.
**** argv[0]
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
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 86d312f..6795512 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -111,6 +111,10 @@
(assert (equal? (percent-encode "%61") "%2561"))
(assert (equal? (percent-encode "foob%61r") "foob%2561r"))
+;; Note that the entry for pinentry relies on the fact that
+;; GNUPG_BUILD_ROOT is the top of the build root. The second element
+;; in each list is an envvar which can be used to specifiy a different
+;; tool than the installed one.
(define tools
'((gpgv "GPGV" "g10/gpgv")
(gpg-connect-agent "GPG_CONNECT_AGENT" "tools/gpg-connect-agent")
@@ -118,19 +122,15 @@
(gpg-preset-passphrase "GPG_PRESET_PASSPHRASE"
"agent/gpg-preset-passphrase")
(gpgtar "GPGTAR" "tools/gpgtar")
- (gpg-zip "GPGZIP" "tools/gpg-zip")
(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)
(let ((t (assoc which tools)))
(getenv' (cadr t)
- (qualify (if installed?
- (string-append bin-prefix "/" (basename (caddr t)))
- (string-append (getenv "objdir") "/" (caddr t)))))))
+ (qualify (string-append (getenv "GNUPG_BUILD_ROOT")
+ "/" (caddr t))))))
+
+(define with-valgrind? (not (string=? (getenv "with_valgrind") "")))
;; You can splice VALGRIND into your argument vector to run programs
;; under valgrind. For example, to run valgrind on gpg, you may want
@@ -142,15 +142,10 @@
'("/usr/bin/valgrind" -q --leak-check=no --track-origins=yes
--error-exitcode=154 --exit-on-first-error=yes))
-(unless installed?
- (setenv "GNUPG_BUILDDIR" (getenv "objdir") #t))
-
(define (gpg-conf . args)
(gpg-conf' "" args))
(define (gpg-conf' input args)
(let ((s (call-popen `(,(tool-hardcoded 'gpgconf)
- ,@(if installed? '()
- (list '--build-prefix (getenv "objdir")))
,@args) input)))
(map (lambda (line) (map percent-decode (string-split line #\:)))
(string-split-newlines s))))