tests: Run each test in a clean environment.
authorJustus Winter <justus@g10code.com>
Wed, 10 Aug 2016 07:32:53 +0000 (09:32 +0200)
committerJustus Winter <justus@g10code.com>
Wed, 10 Aug 2016 07:42:00 +0000 (09:42 +0200)
* 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>
tests/openpgp/Makefile.am
tests/openpgp/README

index 564439a..a43f23b 100644 (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
 
index 1f8654b..9b384be 100644 (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