diff --git a/tests/Makefile.am b/tests/Makefile.am index f29b68a53..d26ef9df1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,7 +29,7 @@ SUBDIRS = gpgscm openpgp cms migrations gpgme pkits $(tpm2dtests) . GPGSM = ../sm/gpgsm -EXTRA_DIST = run-tests.scm \ +EXTRA_DIST = run-tests.scm gpgconf.ctl.in \ fake-pinentries/README.txt \ fake-pinentries/fake-pinentry.php \ fake-pinentries/fake-pinentry.pl \ @@ -44,3 +44,31 @@ 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 diff --git a/tests/cms/Makefile.am b/tests/cms/Makefile.am index bc86acba2..2ad29351e 100644 --- a/tests/cms/Makefile.am +++ b/tests/cms/Makefile.am @@ -32,6 +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" \ GPGSM="$(GPGSM)" "$(srcdir)/runtest" TESTS_ENVIRONMENT = LC_ALL=C \ @@ -39,6 +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" \ GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm" XTESTS = \ diff --git a/tests/gpgconf.ctl.in b/tests/gpgconf.ctl.in new file mode 100644 index 000000000..9bde62484 --- /dev/null +++ b/tests/gpgconf.ctl.in @@ -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/ diff --git a/tests/gpgme/Makefile.am b/tests/gpgme/Makefile.am index 60fb01df9..aa41940ca 100644 --- a/tests/gpgme/Makefile.am +++ b/tests/gpgme/Makefile.am @@ -33,6 +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" \ GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm # XXX: Currently, one cannot override automake's 'check' target. As a diff --git a/tests/migrations/Makefile.am b/tests/migrations/Makefile.am index 6d2d2e8a6..f38d26e19 100644 --- a/tests/migrations/Makefile.am +++ b/tests/migrations/Makefile.am @@ -33,6 +33,7 @@ TESTS_ENVIRONMENT = GPG_AGENT_INFO= LC_ALL=C \ PATH="../gpgscm:$(PATH)" \ abs_top_srcdir="$(abs_top_srcdir)" \ objdir="$(abs_top_builddir)" \ + GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \ GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm" XTESTS = from-classic.scm \ diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index 106e49cdf..cecbde8cb 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)/tests" \ GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm" XTESTS = \ diff --git a/tests/pkits/Makefile.am b/tests/pkits/Makefile.am index 3dc2f16d6..b85e110b5 100644 --- a/tests/pkits/Makefile.am +++ b/tests/pkits/Makefile.am @@ -21,6 +21,7 @@ GPGSM = ../../sm/gpgsm TESTS_ENVIRONMENT = GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C \ + GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \ GPGSM=$(GPGSM) silent=yes @@ -71,5 +72,3 @@ run-all-tests: inittests.stamp elif test $$? -eq 77; then echo "- SKIP $$tst"; \ fi; \ done - - diff --git a/tests/tpm2dtests/Makefile.am b/tests/tpm2dtests/Makefile.am index eeae39906..f0afa2a37 100644 --- a/tests/tpm2dtests/Makefile.am +++ b/tests/tpm2dtests/Makefile.am @@ -37,6 +37,7 @@ TESTS_ENVIRONMENT = LC_ALL=C \ TPMSERVER="$(TPMSERVER)" \ SWTPM="$(SWTPM)" \ SWTPM_IOCTL="$(SWTPM_IOCTL)" \ + GNUPG_BUILD_ROOT="$(abs_top_builddir)/tests" \ GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm" XTESTS = \