aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/migrations/Makefile.am33
-rw-r--r--tests/migrations/common.scm10
-rw-r--r--tests/migrations/run-tests.scm26
-rw-r--r--tests/migrations/setup.scm20
4 files changed, 73 insertions, 16 deletions
diff --git a/tests/migrations/Makefile.am b/tests/migrations/Makefile.am
index 277396976..d0cd9ee60 100644
--- a/tests/migrations/Makefile.am
+++ b/tests/migrations/Makefile.am
@@ -20,7 +20,8 @@
# Programs required before we can run these tests.
required_pgms = ../../g10/gpg$(EXEEXT) ../../agent/gpg-agent$(EXEEXT) \
- ../../tools/gpgtar$(EXEEXT)
+ ../../tools/gpgtar$(EXEEXT) \
+ ../gpgscm/gpgscm$(EXEEXT)
AM_CPPFLAGS = -I$(top_srcdir)/common
include $(top_srcdir)/am/cmacros.am
@@ -30,11 +31,14 @@ AM_CFLAGS =
TMP ?= /tmp
TESTS_ENVIRONMENT = GPG_AGENT_INFO= LC_ALL=C \
+ EXEEXT=$(EXEEXT) \
PATH=../gpgscm:$(PATH) \
TMP=$(TMP) \
- GPGSCM_PATH=$(top_srcdir)/tests/gpgscm:$(top_srcdir)/tests/migrations
+ srcdir=$(abs_srcdir) \
+ objdir=$(abs_top_builddir) \
+ GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm:$(abs_top_srcdir)/tests/migrations
-TESTS = from-classic.scm \
+XTESTS = from-classic.scm \
extended-pkf.scm \
issue2276.scm
@@ -42,17 +46,22 @@ TEST_FILES = from-classic.tar.asc \
extended-pkf.tar.asc \
issue2276.tar.asc
-EXTRA_DIST = common.scm $(TESTS) $(TEST_FILES)
+# 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
-CLEANFILES = prepared.stamp x y yy z out err $(data_files) \
- plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \
- *.test.log gpg_dearmor gpg.conf gpg-agent.conf S.gpg-agent \
- pubring.gpg pubring.gpg~ pubring.kbx pubring.kbx~ \
- secring.gpg pubring.pkr secring.skr \
- gnupg-test.stop random_seed gpg-agent.log tofu.db
+.PHONY: xcheck
+xcheck:
+ $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \
+ run-tests.scm $(TESTFLAGS) $(XTESTS)
-clean-local:
- -rm -rf from-classic.gpghome/*.gpg
+EXTRA_DIST = common.scm run-tests.scm setup.scm $(XTESTS) $(TEST_FILES)
+
+CLEANFILES = *.log
# We need to depend on a couple of programs so that the tests don't
# start before all programs are built.
diff --git a/tests/migrations/common.scm b/tests/migrations/common.scm
index 944d4f662..30ac62ba1 100644
--- a/tests/migrations/common.scm
+++ b/tests/migrations/common.scm
@@ -18,14 +18,16 @@
(if (string=? "" (getenv "srcdir"))
(error "not called from make"))
-(setenv "GNUPGHOME" "" #t)
+(let ((verbose (string->number (getenv "verbose"))))
+ (if (number? verbose)
+ (*set-verbose!* verbose)))
(define (qualify executable)
(string-append executable (getenv "EXEEXT")))
;; We may not use a relative name for gpg-agent.
-(define GPG-AGENT (qualify (string-append (getcwd) "/../../agent/gpg-agent")))
-(define GPG `(,(qualify (string-append (getcwd) "/../../g10/gpg"))
+(define GPG-AGENT (path-join (getenv "objdir") "agent" (qualify "gpg-agent")))
+(define GPG `(,(path-join (getenv "objdir") "g10" (qualify "gpg"))
--no-permission-warning --no-greeting
--no-secmem-warning --batch
,(string-append "--agent-program=" GPG-AGENT
@@ -33,7 +35,7 @@
(define GPG-no-batch
(filter (lambda (arg) (not (equal? arg '--batch))) GPG))
-(define GPGTAR (qualify (string-append (getcwd) "/../../tools/gpgtar")))
+(define GPGTAR (path-join (getenv "objdir") "tools" (qualify "gpgtar")))
(define (untar-armored source-name)
(pipe:do
diff --git a/tests/migrations/run-tests.scm b/tests/migrations/run-tests.scm
new file mode 100644
index 000000000..069af5b47
--- /dev/null
+++ b/tests/migrations/run-tests.scm
@@ -0,0 +1,26 @@
+;; Test-suite runner.
+;;
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+(let* ((tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))
+ (runner (if (and (member "--parallel" *args*)
+ (> (length tests) 1))
+ run-tests-parallel
+ run-tests-sequential)))
+ (runner (test::scm "setup.scm" "setup.scm")
+ (map (lambda (t) (test::scm t t)) tests)))
diff --git a/tests/migrations/setup.scm b/tests/migrations/setup.scm
new file mode 100644
index 000000000..76a584061
--- /dev/null
+++ b/tests/migrations/setup.scm
@@ -0,0 +1,20 @@
+#!/usr/bin/env gpgscm
+
+;; Copyright (C) 2016 g10 Code GmbH
+;;
+;; This file is part of GnuPG.
+;;
+;; GnuPG is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; GnuPG is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+;; Nothing to do for now.