tests: Run each test in a clean environment.

* tests/openpgp/Makefile.am (TESTS_ENVIRONMENT): Drop obsolete
variables, add 'srcdir', use absolute paths.
(TESTS): Rename to 'XTESTS' to avoid emitting the automake test
runner.  Drop 'setup.scm' and 'finish.scm'.
(xcheck): New target that runs 'run-tests.scm', our Scheme test suite
runner.  It will run each test in a clean environment, isolated from
the other tests.
(EXTRA_DIST): Adapt accordingly.
* tests/openpgp/README: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-08-10 09:32:53 +02:00
parent b2b21580b6
commit e13f1ea8ff
2 changed files with 19 additions and 9 deletions

View File

@ -36,16 +36,15 @@ fake_pinentry_SOURCES = fake-pinentry.c
TMP ?= /tmp
TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= LC_ALL=C \
TESTS_ENVIRONMENT = LC_ALL=C \
EXEEXT=$(EXEEXT) \
PATH=../gpgscm:$(PATH) \
TMP=$(TMP) \
srcdir=$(abs_srcdir) \
objdir=$(abs_top_builddir) \
GPGSCM_PATH=$(top_srcdir)/tests/gpgscm:$(top_srcdir)/tests/openpgp
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm:$(abs_top_srcdir)/tests/openpgp
# Note: setup.scm needs to be the first test to run and finish.scm
# the last one
TESTS = setup.scm \
XTESTS = \
version.scm \
mds.scm \
decrypt.scm \
@ -85,9 +84,20 @@ TESTS = setup.scm \
ssh.scm \
issue2015.scm \
issue2346.scm \
issue2419.scm \
finish.scm
issue2419.scm
# XXX: Currently, one cannot override automake's 'check' target. As a
# workaround, we avoid defining 'TESTS', thus automake will not emit
# the 'check' target. For extra robustness, we merely define a
# dependency on 'xcheck', so this hack should also work even if
# automake would emit the 'check' target, as adding dependencies to
# targets is okay.
check: xcheck
.PHONY: xcheck
xcheck:
$(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \
run-tests.scm $(XTESTS)
TEST_FILES = pubring.asc secring.asc plain-1o.asc plain-2o.asc plain-3o.asc \
plain-1.asc plain-2.asc plain-3.asc plain-1-pgp.asc \
@ -158,7 +168,7 @@ sample_keys = samplekeys/README \
sample_msgs = samplemsgs/issue2419.asc
EXTRA_DIST = defs.inc defs.scm pinentry.sh $(TESTS) $(TEST_FILES) \
EXTRA_DIST = defs.inc defs.scm pinentry.sh $(XTESTS) $(TEST_FILES) \
mkdemodirs signdemokey $(priv_keys) $(sample_keys) \
$(sample_msgs) ChangeLog-2011 run-tests.scm

View File

@ -8,7 +8,7 @@ On POSIX you can just use
or
$ make -C tests/openpgp check TESTS="setup.scm your-test.scm finish.scm"
$ make -C tests/openpgp check XTESTS="setup.scm your-test.scm finish.scm"
as before.
** using the Scheme driver