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

build: Prepare for using installed versions for tests.

* tests/gpgconf.ctl.in: New.
* tests/Makefile.am (EXTRA_DIST): Add new file.
(TESTINST_DIRS): New.
(clean-local): New.
(clean-local-testinst): New.
(check-recursive): New hook.
(bin/gpgconf.ctl): Run a test install.
* tests/cms/Makefile.am (TESTS_ENVIRONMENT): Set new envvar
GNUPG_BUILD_ROOT.
* tests/gpgme/Makefile.am (TESTS_ENVIRONMENT): Ditto.
* tests/openpgp/Makefile.am (TESTS_ENVIRONMENT): Ditto.
* tests/pkits/Makefile.am (TESTS_ENVIRONMENT): Ditto.
* tests/tpm2dtests/Makefile.am (TESTS_ENVIRONMENT): Ditto.
--

Right now this helps only with the global configuraion dir which is
now not set and thus the build host'ss own /etc/gnupg does not anymore
affect the build.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2021-09-30 18:18:00 +02:00
parent dbe1b237a6
commit 399ebf6d87
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
8 changed files with 51 additions and 3 deletions

View File

@ -29,7 +29,7 @@ SUBDIRS = gpgscm openpgp cms migrations gpgme pkits $(tpm2dtests) .
GPGSM = ../sm/gpgsm GPGSM = ../sm/gpgsm
EXTRA_DIST = run-tests.scm \ EXTRA_DIST = run-tests.scm gpgconf.ctl.in \
fake-pinentries/README.txt \ fake-pinentries/README.txt \
fake-pinentries/fake-pinentry.php \ fake-pinentries/fake-pinentry.php \
fake-pinentries/fake-pinentry.pl \ fake-pinentries/fake-pinentry.pl \
@ -44,3 +44,31 @@ noinst_PROGRAMS = asschk
endif endif
asschk_SOURCES = asschk.c 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,6 +32,7 @@ AM_CFLAGS =
# if the shell used for inittests would uses an internal version of # if the shell used for inittests would uses an internal version of
# pwd which handles symlinks differently. # pwd which handles symlinks differently.
OLD_TESTS_ENVIRONMENT = GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C \ OLD_TESTS_ENVIRONMENT = GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C \
GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \
GPGSM="$(GPGSM)" "$(srcdir)/runtest" GPGSM="$(GPGSM)" "$(srcdir)/runtest"
TESTS_ENVIRONMENT = LC_ALL=C \ TESTS_ENVIRONMENT = LC_ALL=C \
@ -39,6 +40,7 @@ TESTS_ENVIRONMENT = LC_ALL=C \
PATH="../gpgscm:$(PATH)" \ PATH="../gpgscm:$(PATH)" \
abs_top_srcdir="$(abs_top_srcdir)" \ abs_top_srcdir="$(abs_top_srcdir)" \
objdir="$(abs_top_builddir)" \ objdir="$(abs_top_builddir)" \
GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm" GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
XTESTS = \ XTESTS = \

15
tests/gpgconf.ctl.in Normal file
View File

@ -0,0 +1,15 @@
# gpgconf.ctl.in - copied to bin during tests.
#
# This file is used to change the directories where the gpg components
# are installed. It does not change the configuration directories.
# The file is expected in the same directory as gpgconf. The physical
# installation directories are evaluated and no symlinks. Blank lines
# and lines starting with pound signed are ignored. No errors are
# printed for unknown keywords or commands. The only defined key for
# now is "rootdir" which must be followed by one optional space, an
# equal sign, and the value for the root directory. Environment
# variables are substituted in standard shell manner, the final value
# must start with a slash, trailing slashed are stripped.
sysconfdir = $GNUPG_BUILD_ROOT/etc
rootdir = $GNUPG_BUILD_ROOT/

View File

@ -33,6 +33,7 @@ TESTS_ENVIRONMENT = LC_ALL=C \
PATH="../gpgscm:$(PATH)" \ PATH="../gpgscm:$(PATH)" \
abs_top_srcdir=$(abs_top_srcdir) \ abs_top_srcdir=$(abs_top_srcdir) \
objdir=$(abs_top_builddir) \ objdir=$(abs_top_builddir) \
GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm
# XXX: Currently, one cannot override automake's 'check' target. As a # XXX: Currently, one cannot override automake's 'check' target. As a

View File

@ -33,6 +33,7 @@ TESTS_ENVIRONMENT = GPG_AGENT_INFO= LC_ALL=C \
PATH="../gpgscm:$(PATH)" \ PATH="../gpgscm:$(PATH)" \
abs_top_srcdir="$(abs_top_srcdir)" \ abs_top_srcdir="$(abs_top_srcdir)" \
objdir="$(abs_top_builddir)" \ objdir="$(abs_top_builddir)" \
GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm" GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
XTESTS = from-classic.scm \ XTESTS = from-classic.scm \

View File

@ -38,6 +38,7 @@ TESTS_ENVIRONMENT = LC_ALL=C \
PATH="../gpgscm:$(PATH)" \ PATH="../gpgscm:$(PATH)" \
abs_top_srcdir="$(abs_top_srcdir)" \ abs_top_srcdir="$(abs_top_srcdir)" \
objdir="$(abs_top_builddir)" \ objdir="$(abs_top_builddir)" \
GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm" GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
XTESTS = \ XTESTS = \

View File

@ -21,6 +21,7 @@
GPGSM = ../../sm/gpgsm GPGSM = ../../sm/gpgsm
TESTS_ENVIRONMENT = GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C \ TESTS_ENVIRONMENT = GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C \
GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \
GPGSM=$(GPGSM) silent=yes GPGSM=$(GPGSM) silent=yes
@ -71,5 +72,3 @@ run-all-tests: inittests.stamp
elif test $$? -eq 77; then echo "- SKIP $$tst"; \ elif test $$? -eq 77; then echo "- SKIP $$tst"; \
fi; \ fi; \
done done

View File

@ -37,6 +37,7 @@ TESTS_ENVIRONMENT = LC_ALL=C \
TPMSERVER="$(TPMSERVER)" \ TPMSERVER="$(TPMSERVER)" \
SWTPM="$(SWTPM)" \ SWTPM="$(SWTPM)" \
SWTPM_IOCTL="$(SWTPM_IOCTL)" \ SWTPM_IOCTL="$(SWTPM_IOCTL)" \
GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm" GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
XTESTS = \ XTESTS = \