1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

tests: New way to make use of gpgconf.ctl in tests.

* Makefile.am (all-local): New to setup symlinks.
(distclean-local): New.
* tests/Makefile.am: Remove the gpgconf related targets.  Just keep
gpgconf.ctl.in in EXTRA_DIST
* tests/cms/Makefile.am (GNUPG_BUILD_ROOT):
* tests/gpgme/Makefile.am (GPGSCM_PATH):
* tests/openpgp/Makefile.am (GNUPG_BUILD_ROOT):
* tests/pkits/Makefile.am (GNUPG_BUILD_ROOT):
* tests/tpm2dtests/defs.scm (tools): Revert to the former values.
* tests/openpgp/defs.scm (tools): Ditto.
--

This
Fixes-commit: 399ebf6d873d4178c1d527aa4df34bf16a76360e
Fixes-commit: 84fcd8e6eb7e0786399e1f6461c3f60b0db2d070
because we ran into problems with the idea of first doing a
test-install for the checks.  "make distcheck" turned out to
be too problematic.  Symlinks are a better way of doing this.
Also fixes
GnuPG-bug-id: 5634
This commit is contained in:
Werner Koch 2021-10-12 14:30:13 +02:00
parent 257632f58d
commit bcd5feec0e
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
9 changed files with 61 additions and 55 deletions

View File

@ -120,6 +120,42 @@ SUBDIRS = m4 common regexp kbx \
dist_doc_DATA = README
# Create test directory etc/gnupg so that we have an
# empty sysconfdir and bin where we put out gpgconf.ctl.
# we also put symlinks to the actual binaries there.
# Unfortunately there is no all-hook, but symlinks have the
# nice property that they can be created even for not yet
# created files.
all-local:
@-$(MKDIR_P) bin etc/gnupg libexec
@cat $(srcdir)/tests/gpgconf.ctl.in > bin/gpgconf.ctl
(set -e; cd bin; \
for i in gpg gpgv; \
do ln -sf ../g10/$$i .; done; \
for i in gpgsm; \
do ln -sf ../sm/$$i .; done; \
for i in gpg-agent; \
do ln -sf ../agent/$$i .; done; \
for i in dirmngr; \
do ln -sf ../dirmngr/$$i .; done; \
for i in gpgconf gpg-connect-agent gpgtar gpg-card; \
do ln -sf ../tools/$$i .; done; \
cd ../libexec ; \
for i in keyboxd; \
do ln -sf ../kbx/$$i .; done; \
for i in scdaemon; \
do ln -sf ../scd/$$i .; done; \
for i in gpg-preset-passphrase; \
do ln -sf ../agent/$$i .; done; \
echo "created links to binaries" )
# Clean up our test directories but take care that this is never
# called from / or /usr/local
distclean-local:
@if pwd | grep gnupg 2>/dev/null; then rm -rf etc bin libexec; fi
dist-hook: gen-ChangeLog
distcheck-hook:

View File

@ -44,31 +44,3 @@ noinst_PROGRAMS = asschk
endif
asschk_SOURCES = asschk.c
TESTINST_DIRS = bin sbin libexec share etc
clean-local: clean-local-testinst
# We do a cd ../tests here so that we make sure tha the bin dir etc
# are under our tests dir. This is failsafe thingy in case this
# Makefile rule is accidently run /.
clean-local-testinst:
-(cd ../tests && rm -rf $(TESTINST_DIRS))
# Before we can run any tests we need to make sure that we have a
# proper test installation with this dir (tests) as root dir. It is
# too hard to track the built files here thus we do the install step
# always.
check-recursive: bin/gpgconf.ctl
bin/gpgconf.ctl: FORCE
@echo '==== Installing into a test root ======'
@-mkdir bin 2>/dev/null
@cat $(srcdir)/gpgconf.ctl.in > bin/gpgconf.ctl.tmp
cd .. && \
$(MAKE) $(AM_MAKEFLAGS) install prefix=$(abs_top_builddir)/tests
@mv bin/gpgconf.ctl.tmp bin/gpgconf.ctl
@echo '==== Finished installing into a test root ======'
.PHONY: FORCE clean-local-testinst

View File

@ -32,7 +32,7 @@ AM_CFLAGS =
# if the shell used for inittests would uses an internal version of
# pwd which handles symlinks differently.
OLD_TESTS_ENVIRONMENT = GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C \
GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \
GNUPG_BUILD_ROOT="$(abs_top_builddir)" \
GPGSM="$(GPGSM)" "$(srcdir)/runtest"
TESTS_ENVIRONMENT = LC_ALL=C \
@ -40,7 +40,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)/tests" \
GNUPG_BUILD_ROOT="$(abs_top_builddir)" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
XTESTS = \

View File

@ -33,7 +33,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)/tests" \
GNUPG_BUILD_ROOT="$(abs_top_builddir)" \
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm
# XXX: Currently, one cannot override automake's 'check' target. As a

View File

@ -38,7 +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)/tests" \
GNUPG_BUILD_ROOT="$(abs_top_builddir)" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
XTESTS = \

View File

@ -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.
@ -95,11 +96,9 @@ data files.
Used to locate the Scheme library as well as code used by the test
suite.
**** GNUPG_BUILD_ROOT
To locate the actual binaries under test the test suite requires that
those binaries and associate files are installed to a test location.
This envvar gives the root directory of the install tree. See
tests/gpgconf.ctl for the way we tell the GnuPG components this
location. Note that we can't use that envvar directlyr because this
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]

View File

@ -112,18 +112,17 @@
(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.
;; 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" "bin/gpgv")
(gpg-connect-agent "GPG_CONNECT_AGENT" "bin/gpg-connect-agent")
(gpgconf "GPGCONF" "bin/gpgconf")
'((gpgv "GPGV" "g10/gpgv")
(gpg-connect-agent "GPG_CONNECT_AGENT" "tools/gpg-connect-agent")
(gpgconf "GPGCONF" "tools/gpgconf")
(gpg-preset-passphrase "GPG_PRESET_PASSPHRASE"
"libexec/gpg-preset-passphrase")
(gpgtar "GPGTAR" "bin/gpgtar")
(pinentry "PINENTRY" "openpgp/fake-pinentry")))
"agent/gpg-preset-passphrase")
(gpgtar "GPGTAR" "tools/gpgtar")
(pinentry "PINENTRY" "tests/openpgp/fake-pinentry")))
(define (tool-hardcoded which)
(let ((t (assoc which tools)))

View File

@ -21,7 +21,7 @@
GPGSM = ../../sm/gpgsm
TESTS_ENVIRONMENT = GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C \
GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \
GNUPG_BUILD_ROOT="$(abs_top_builddir)" \
GPGSM=$(GPGSM) silent=yes

View File

@ -61,14 +61,14 @@
(assert (equal? (percent-encode "foob%61r") "foob%2561r"))
(define tools
'((gpgv "GPGV" "bin/gpgv")
(gpg-connect-agent "GPG_CONNECT_AGENT" "bin/gpg-connect-agent")
(gpgconf "GPGCONF" "bin/gpgconf")
'((gpgv "GPGV" "g10/gpgv")
(gpg-connect-agent "GPG_CONNECT_AGENT" "tools/gpg-connect-agent")
(gpgconf "GPGCONF" "tools/gpgconf")
(gpg-preset-passphrase "GPG_PRESET_PASSPHRASE"
"libexec/gpg-preset-passphrase")
(gpgtar "GPGTAR" "bin/gpgtar")
(tpm2daemon "TPM2DAEMON" "libexec/tpm2daemon")
(pinentry "PINENTRY" "openpgp/fake-pinentry")))
"agent/gpg-preset-passphrase")
(gpgtar "GPGTAR" "tools/gpgtar")
(tpm2daemon "TPM2DAEMON" "tpm2d/tpm2daemon")
(pinentry "PINENTRY" "tests/openpgp/fake-pinentry")))
(define with-valgrind? (not (string=? (getenv "with_valgrind") "")))