mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
tests: Use the common test framework for the migration tests.
* tests/migrations/Makefile.am (reqired_pgms): Add 'gpgscm'. (TESTS_ENVIRONMENT): Populate. (TESTS): Rename to 'XTESTS'. (xcheck): New target. (EXTRA_DIST): Add new files. (CLEANFILES): Remove log files. * tests/migrations/common.scm: Honor 'verbose', fix paths. * tests/migrations/run-tests.scm: New file. * tests/migrations/setup.scm: Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
0bf16d7026
commit
65a0d6a24e
@ -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.
|
||||
|
@ -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
|
||||
|
26
tests/migrations/run-tests.scm
Normal file
26
tests/migrations/run-tests.scm
Normal file
@ -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)))
|
20
tests/migrations/setup.scm
Normal file
20
tests/migrations/setup.scm
Normal file
@ -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.
|
Loading…
x
Reference in New Issue
Block a user