tests: Locate resources and scripts relative to top source dir.

--

Locate every resource and every script used in the tests using a path
relative to the top of the source tree.

This is a purely mechanical change, mostly done using regular
expressions, with a few manual fixups here and there.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-03-22 12:40:42 +01:00
parent f03d6897be
commit ed4d23d75e
No known key found for this signature in database
GPG Key ID: DD1A52F9DA8C9020
87 changed files with 208 additions and 182 deletions

View File

@ -54,6 +54,8 @@ noinst_PROGRAMS += gpgcompose
endif endif
noinst_PROGRAMS += $(module_tests) noinst_PROGRAMS += $(module_tests)
TESTS = $(module_tests) TESTS = $(module_tests)
TESTS_ENVIRONMENT = \
abs_top_srcdir=$(abs_top_srcdir)
if ENABLE_BZIP2_SUPPORT if ENABLE_BZIP2_SUPPORT
bzip2_source = compress-bz2.c bzip2_source = compress-bz2.c

View File

@ -58,6 +58,8 @@
#include "dek.h" #include "dek.h"
#include "../common/logging.h" #include "../common/logging.h"
#include "test.c"
static void static void
log_hexdump (byte *buffer, int length) log_hexdump (byte *buffer, int length)
{ {
@ -368,8 +370,8 @@ oracle_test (unsigned int d, int b, int debug)
return oracle (debug, probe, blocksize + 2, NULL, NULL) == 0; return oracle (debug, probe, blocksize + 2, NULL, NULL) == 0;
} }
int static void
main (int argc, char *argv[]) do_test (int argc, char *argv[])
{ {
int i; int i;
int debug = 0; int debug = 0;
@ -379,8 +381,6 @@ main (int argc, char *argv[])
byte *raw_data; byte *raw_data;
int raw_data_len; int raw_data_len;
int failed = 0;
for (i = 1; i < argc; i ++) for (i = 1; i < argc; i ++)
{ {
if (strcmp (argv[i], "--debug") == 0) if (strcmp (argv[i], "--debug") == 0)
@ -396,11 +396,10 @@ main (int argc, char *argv[])
} }
} }
if (! blocksize && ! filename && (filename = getenv ("srcdir"))) if (! blocksize && ! filename && (filename = prepend_srcdir ("t-stutter-data.asc")))
/* Try defaults. */ /* Try defaults. */
{ {
parse_session_key ("9:9274A8EC128E850C6DDDF9EAC68BFA84FC7BC05F340DA41D78C93D0640C7C503"); parse_session_key ("9:9274A8EC128E850C6DDDF9EAC68BFA84FC7BC05F340DA41D78C93D0640C7C503");
filename = xasprintf ("%s/t-stutter-data.asc", filename);
} }
if (help || ! blocksize || ! filename) if (help || ! blocksize || ! filename)
@ -601,7 +600,7 @@ main (int argc, char *argv[])
isprint (pt[0]) ? pt[0] : '?', isprint (pt[0]) ? pt[0] : '?',
isprint (pt[1]) ? pt[1] : '?', isprint (pt[1]) ? pt[1] : '?',
hexstr (m)); hexstr (m));
failed = 1; tests_failed++;
} }
} }
@ -610,5 +609,4 @@ main (int argc, char *argv[])
} }
xfree (filename); xfree (filename);
return failed;
} }

View File

@ -154,12 +154,12 @@ prepend_srcdir (const char *fname)
static const char *srcdir; static const char *srcdir;
char *result; char *result;
if (!srcdir && !(srcdir = getenv ("srcdir"))) if (!srcdir && !(srcdir = getenv ("abs_top_srcdir")))
srcdir = "."; srcdir = ".";
result = malloc (strlen (srcdir) + 1 + strlen (fname) + 1); result = malloc (strlen (srcdir) + strlen ("/g10/") + strlen (fname) + 1);
strcpy (result, srcdir); strcpy (result, srcdir);
strcat (result, "/"); strcat (result, "/g10/");
strcat (result, fname); strcat (result, fname);
return result; return result;
} }

View File

@ -31,9 +31,9 @@ AM_CFLAGS =
TESTS_ENVIRONMENT = LC_ALL=C \ TESTS_ENVIRONMENT = LC_ALL=C \
EXEEXT=$(EXEEXT) \ EXEEXT=$(EXEEXT) \
PATH=../gpgscm:$(PATH) \ PATH=../gpgscm:$(PATH) \
srcdir=$(abs_srcdir) \ abs_top_srcdir=$(abs_top_srcdir) \
objdir=$(abs_top_builddir) \ objdir=$(abs_top_builddir) \
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm:$(abs_top_srcdir)/tests/openpgp:$(abs_top_srcdir)/tests/gpgme GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm
# XXX: Currently, one cannot override automake's 'check' target. As a # XXX: Currently, one cannot override automake's 'check' target. As a
# workaround, we avoid defining 'TESTS', thus automake will not emit # workaround, we avoid defining 'TESTS', thus automake will not emit

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(define gpgme-srcdir (getenv "XTEST_GPGME_SRCDIR")) (define gpgme-srcdir (getenv "XTEST_GPGME_SRCDIR"))
(when (string=? "" gpgme-srcdir) (when (string=? "" gpgme-srcdir)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgme-defs.scm")) (load (in-srcdir "tests" "gpgme" "gpgme-defs.scm"))
(info "Running GPGME's test suite...") (info "Running GPGME's test suite...")
@ -40,11 +40,17 @@
run-tests-parallel run-tests-parallel
run-tests-sequential)) run-tests-sequential))
(setup-c (make-environment-cache (setup-c (make-environment-cache
(test::scm #f "setup.scm (tests/gpg)" (in-srcdir "setup.scm") (test::scm
"--" "tests" "gpg"))) #f
(path-join "tests" "gpgme" "setup.scm" "tests" "gpg")
(in-srcdir "tests" "gpgme" "setup.scm")
"--" "tests" "gpg")))
(setup-py (make-environment-cache (setup-py (make-environment-cache
(test::scm #f "setup.scm (lang/python/tests)" (in-srcdir "setup.scm") (test::scm
"--" "lang" "python" "tests"))) #f
(path-join "tests" "gpgme" "setup.scm" "lang" "python" "tests")
(in-srcdir "tests" "gpgme" "setup.scm")
"--" "lang" "python" "tests")))
(tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))) (tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*)))
(runner (runner
(apply (apply
@ -66,7 +72,10 @@
(map (lambda (name) (map (lambda (name)
(apply test::scm (apply test::scm
`(,(:setup cmpnts) `(,(:setup cmpnts)
,name ,(in-srcdir "wrap.scm") --executable ,(apply path-join
`("tests" "gpgme" ,@(:path cmpnts) ,name))
,(in-srcdir "tests" "gpgme" "wrap.scm")
--executable
,(find-test name) ,(find-test name)
-- ,@(:path cmpnts)))) -- ,@(:path cmpnts))))
(if (null? tests) (all-tests makefile (:key cmpnts)) tests)))) (if (null? tests) (all-tests makefile (:key cmpnts)) tests))))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgme-defs.scm")) (load (in-srcdir "tests" "gpgme" "gpgme-defs.scm"))
(define tarball (flag "--create-tarball" *args*)) (define tarball (flag "--create-tarball" *args*))
(unless (and tarball (not (null? tarball))) (unless (and tarball (not (null? tarball)))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgme-defs.scm")) (load (in-srcdir "tests" "gpgme" "gpgme-defs.scm"))
(define executable (flag "--executable" *args*)) (define executable (flag "--executable" *args*))
(unless (and executable (not (null? executable))) (unless (and executable (not (null? executable)))
@ -28,6 +28,7 @@
(setenv "abs_builddir" (getcwd) #t) (setenv "abs_builddir" (getcwd) #t)
(setenv "top_srcdir" gpgme-srcdir #t) (setenv "top_srcdir" gpgme-srcdir #t)
(setenv "srcdir" (path-join gpgme-srcdir "tests" "gpg") #t) (setenv "srcdir" (path-join gpgme-srcdir "tests" "gpg") #t)
(setenv "abs_top_srcdir" (path-join gpgme-srcdir "tests" "gpg") #t)
(define (run what) (define (run what)
(if (string-suffix? (car what) ".py") (if (string-suffix? (car what) ".py")

View File

@ -189,7 +189,7 @@
(if (absolute-path? path) path (path-join (getcwd) path))) (if (absolute-path? path) path (path-join (getcwd) path)))
(define (in-srcdir . names) (define (in-srcdir . names)
(canonical-path (apply path-join (cons (getenv "srcdir") names)))) (canonical-path (apply path-join (cons (getenv "abs_top_srcdir") names))))
;; Try to find NAME in PATHS. Returns the full path name on success, ;; Try to find NAME in PATHS. Returns the full path name on success,
;; or raises an error. ;; or raises an error.

View File

@ -31,9 +31,9 @@ AM_CFLAGS =
TESTS_ENVIRONMENT = LC_ALL=C \ TESTS_ENVIRONMENT = LC_ALL=C \
EXEEXT=$(EXEEXT) \ EXEEXT=$(EXEEXT) \
PATH=../gpgscm:$(PATH) \ PATH=../gpgscm:$(PATH) \
srcdir=$(abs_srcdir) \ abs_top_srcdir=$(abs_top_srcdir) \
objdir=$(abs_top_builddir) \ objdir=$(abs_top_builddir) \
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm:$(abs_top_srcdir)/tests/openpgp:$(abs_top_srcdir)/tests/gpgsm GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm
XTESTS = \ XTESTS = \
import.scm \ import.scm \

View File

@ -17,14 +17,14 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm")) (load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment) (setup-gpgsm-environment)
(for-each-p (for-each-p
"Checking decryption of supplied files." "Checking decryption of supplied files."
(lambda (name) (lambda (name)
(tr:do (tr:do
(tr:open (in-srcdir (string-append name ".cms.asc"))) (tr:open (in-srcdir "tests" "gpgsm" (string-append name ".cms.asc")))
(tr:gpgsm "" '(--decrypt)) (tr:gpgsm "" '(--decrypt))
(tr:assert-identity name))) (tr:assert-identity name)))
plain-files) plain-files)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm")) (load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment) (setup-gpgsm-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm")) (load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment) (setup-gpgsm-environment)
(for-each-p' (for-each-p'

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
;; This is the list of certificates that we install in the test ;; This is the list of certificates that we install in the test
;; environment. ;; environment.
@ -83,13 +83,13 @@
(log "Storing private keys") (log "Storing private keys")
(for-each (for-each
(lambda (name) (lambda (name)
(file-copy (in-srcdir name) (file-copy (in-srcdir "tests" "gpgsm" name)
(path-join "private-keys-v1.d" (path-join "private-keys-v1.d"
(string-append name ".key")))) (string-append name ".key"))))
'("32100C27173EF6E9C4E9A25D3D69F86D37A4F939")) '("32100C27173EF6E9C4E9A25D3D69F86D37A4F939"))
(log "Importing public demo and test keys") (log "Importing public demo and test keys")
(call-check `(,@gpgsm --import ,(in-srcdir "cert_g10code_test1.der"))) (call-check `(,@gpgsm --import ,(in-srcdir "tests" "gpgsm" "cert_g10code_test1.der")))
(create-sample-files) (create-sample-files)
(stop-agent)) (stop-agent))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm")) (load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment) (setup-gpgsm-environment)
(define certs-for-import (define certs-for-import
@ -47,7 +47,7 @@
"Checking certificate import." "Checking certificate import."
(lambda (test) (lambda (test)
(assert (not (sm-have-public-key? (:cert test)))) (assert (not (sm-have-public-key? (:cert test))))
(call-check `(,@gpgsm --import ,(in-srcdir (:name test)))) (call-check `(,@gpgsm --import ,(in-srcdir "tests" "gpgsm" (:name test))))
(assert (sm-have-public-key? (:cert test)))) (assert (sm-have-public-key? (:cert test))))
(lambda (test) (:name test)) (lambda (test) (:name test))
certs-for-import) certs-for-import)

View File

@ -17,16 +17,22 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(if (string=? "" (getenv "srcdir")) (if (string=? "" (getenv "abs_top_srcdir"))
(begin (begin
(echo "Environment variable 'srcdir' not set. Please point it to" (echo "Environment variable 'abs_top_srcdir' not set. Please point it to"
"tests/gpgsm.") "tests/gpgsm.")
(exit 2))) (exit 2)))
(let* ((tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*)) (let* ((tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))
(setup (make-environment-cache (test::scm #f "setup.scm" "setup.scm"))) (setup (make-environment-cache (test::scm
#f
(path-join "tests" "gpgsm" "setup.scm")
(in-srcdir "tests" "gpgsm" "setup.scm"))))
(runner (if (and (member "--parallel" *args*) (runner (if (and (member "--parallel" *args*)
(> (length tests) 1)) (> (length tests) 1))
run-tests-parallel run-tests-parallel
run-tests-sequential))) run-tests-sequential)))
(runner (map (lambda (t) (test::scm setup t t)) tests))) (runner (map (lambda (name)
(test::scm setup
(path-join "tests" "gpgsm" name)
(in-srcdir "tests" "gpgsm" name))) tests)))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm")) (load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(define tarball (flag "--create-tarball" *args*)) (define tarball (flag "--create-tarball" *args*))
(unless (and tarball (not (null? tarball))) (unless (and tarball (not (null? tarball)))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm")) (load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment) (setup-gpgsm-environment)
;; This is not a test, but can be used to inspect the test ;; This is not a test, but can be used to inspect the test

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm")) (load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment) (setup-gpgsm-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm")) (load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment) (setup-gpgsm-environment)
;; ;;

View File

@ -31,9 +31,9 @@ AM_CFLAGS =
TESTS_ENVIRONMENT = GPG_AGENT_INFO= LC_ALL=C \ TESTS_ENVIRONMENT = GPG_AGENT_INFO= LC_ALL=C \
EXEEXT=$(EXEEXT) \ EXEEXT=$(EXEEXT) \
PATH=../gpgscm:$(PATH) \ PATH=../gpgscm:$(PATH) \
srcdir=$(abs_srcdir) \ abs_top_srcdir=$(abs_top_srcdir) \
objdir=$(abs_top_builddir) \ objdir=$(abs_top_builddir) \
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm:$(abs_top_srcdir)/tests/migrations GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm
XTESTS = from-classic.scm \ XTESTS = from-classic.scm \
extended-pkf.scm \ extended-pkf.scm \
@ -54,7 +54,7 @@ check: xcheck
.PHONY: xcheck .PHONY: xcheck
xcheck: xcheck:
$(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \ $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \
run-tests.scm $(TESTFLAGS) $(XTESTS) $(abs_srcdir)/run-tests.scm $(TESTFLAGS) $(XTESTS)
EXTRA_DIST = common.scm run-tests.scm setup.scm $(XTESTS) $(TEST_FILES) EXTRA_DIST = common.scm run-tests.scm setup.scm $(XTESTS) $(TEST_FILES)

View File

@ -15,7 +15,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(if (string=? "" (getenv "srcdir")) (if (string=? "" (getenv "abs_top_srcdir"))
(error "not called from make")) (error "not called from make"))
(let ((verbose (string->number (getenv "verbose")))) (let ((verbose (string->number (getenv "verbose"))))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "common.scm")) (load (in-srcdir "tests" "migrations" "common.scm"))
(catch (skip "gpgtar not built") (catch (skip "gpgtar not built")
(call-check `(,GPGTAR --help))) (call-check `(,GPGTAR --help)))
@ -31,7 +31,7 @@
(run-test (run-test
"Testing the extended private key format ..." "Testing the extended private key format ..."
(in-srcdir "extended-pkf.tar.asc") (in-srcdir "tests" "migrations" "extended-pkf.tar.asc")
(lambda (gpghome) (lambda (gpghome)
(assert-keys-usable))) (assert-keys-usable)))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "common.scm")) (load (in-srcdir "tests" "migrations" "common.scm"))
(catch (skip "gpgtar not built") (catch (skip "gpgtar not built")
(call-check `(,GPGTAR --help))) (call-check `(,GPGTAR --help)))
@ -37,14 +37,14 @@
(run-test (run-test
"Testing a clean migration ..." "Testing a clean migration ..."
(in-srcdir "from-classic.tar.asc") (in-srcdir "tests" "migrations" "from-classic.tar.asc")
(lambda (gpghome) (lambda (gpghome)
(trigger-migration) (trigger-migration)
(assert-migrated))) (assert-migrated)))
(run-test (run-test
"Testing a migration with existing private-keys-v1.d ..." "Testing a migration with existing private-keys-v1.d ..."
(in-srcdir "from-classic.tar.asc") (in-srcdir "tests" "migrations" "from-classic.tar.asc")
(lambda (gpghome) (lambda (gpghome)
(mkdir "private-keys-v1.d" "-rwx") (mkdir "private-keys-v1.d" "-rwx")
(trigger-migration) (trigger-migration)
@ -52,7 +52,7 @@
(run-test (run-test
"Testing a migration with existing but weird private-keys-v1.d ..." "Testing a migration with existing but weird private-keys-v1.d ..."
(in-srcdir "from-classic.tar.asc") (in-srcdir "tests" "migrations" "from-classic.tar.asc")
(lambda (gpghome) (lambda (gpghome)
(mkdir "private-keys-v1.d" "") (mkdir "private-keys-v1.d" "")
(trigger-migration) (trigger-migration)

View File

@ -17,12 +17,12 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "common.scm")) (load (in-srcdir "tests" "migrations" "common.scm"))
(run-test (run-test
"Checking migration with legacy key (issue2276)..." "Checking migration with legacy key (issue2276)..."
;; This tarball contains a keyring with a legacy key. ;; This tarball contains a keyring with a legacy key.
(in-srcdir "issue2276.tar.asc") (in-srcdir "tests" "migrations" "issue2276.tar.asc")
(lambda (gpghome) (lambda (gpghome)
;; GnuPG up to 2.1.14 failed to skip the legacy key when updating ;; GnuPG up to 2.1.14 failed to skip the legacy key when updating
;; the trust database and thereby rebuilding the keyring cache. ;; the trust database and thereby rebuilding the keyring cache.

View File

@ -22,4 +22,7 @@
(> (length tests) 1)) (> (length tests) 1))
run-tests-parallel run-tests-parallel
run-tests-sequential))) run-tests-sequential)))
(runner (map (lambda (t) (test::scm #f t t)) tests))) (runner (map (lambda (name)
(test::scm #f
(path-join "tests" "migrations" name)
(in-srcdir "tests" "migrations" name))) tests)))

View File

@ -20,10 +20,10 @@
;; GnuPG through 2.1.7 would incorrect mark packets whose size is ;; GnuPG through 2.1.7 would incorrect mark packets whose size is
;; 2^32-1 as invalid and exit with status code 2. ;; 2^32-1 as invalid and exit with status code 2.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(unless (have-compression-algo? "BZIP2") (unless (have-compression-algo? "BZIP2")
(skip "BZIP2 support not compiled in.")) (skip "BZIP2 support not compiled in."))
(call-check `(,@GPG --list-packets ,(in-srcdir "4gb-packet.asc"))) (call-check `(,@GPG --list-packets ,(in-srcdir "tests" "openpgp" "4gb-packet.asc")))

View File

@ -36,9 +36,9 @@ fake_pinentry_SOURCES = fake-pinentry.c
TESTS_ENVIRONMENT = LC_ALL=C \ TESTS_ENVIRONMENT = LC_ALL=C \
EXEEXT=$(EXEEXT) \ EXEEXT=$(EXEEXT) \
PATH=../gpgscm:$(PATH) \ PATH=../gpgscm:$(PATH) \
srcdir=$(abs_srcdir) \ abs_top_srcdir=$(abs_top_srcdir) \
objdir=$(abs_top_builddir) \ objdir=$(abs_top_builddir) \
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm:$(abs_top_srcdir)/tests/openpgp GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm
XTESTS = \ XTESTS = \
version.scm \ version.scm \
@ -109,7 +109,7 @@ check: xcheck
.PHONY: xcheck .PHONY: xcheck
xcheck: xcheck:
$(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \ $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \
run-tests.scm $(TESTFLAGS) $(XTESTS) $(abs_srcdir)/run-tests.scm $(TESTFLAGS) $(XTESTS)
TEST_FILES = pubring.asc secring.asc plain-1o.asc plain-2o.asc plain-3o.asc \ 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 \ plain-1.asc plain-2.asc plain-3.asc plain-1-pgp.asc \

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define files (append plain-files data-files)) (define files (append plain-files data-files))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define armored_key_8192 "-----BEGIN PGP PUBLIC KEY BLOCK----- (define armored_key_8192 "-----BEGIN PGP PUBLIC KEY BLOCK-----

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define (check-signing args input) (define (check-signing args input)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define s2k '--s2k-count=65536) (define s2k '--s2k-count=65536)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define s2k '--s2k-count=65536) (define s2k '--s2k-count=65536)

View File

@ -17,14 +17,14 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p
"Checking decryption of supplied DSA encrypted file" "Checking decryption of supplied DSA encrypted file"
(lambda (name) (lambda (name)
(tr:do (tr:do
(tr:open (in-srcdir (string-append name "-pgp.asc"))) (tr:open (in-srcdir "tests" "openpgp" (string-append name "-pgp.asc")))
(tr:gpg "" '(--yes --decrypt)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity name))) (tr:assert-identity name)))
(list (car plain-files))) (list (car plain-files)))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(info "Checking decryption of supplied files using --multifile.") (info "Checking decryption of supplied files using --multifile.")
@ -31,7 +31,7 @@
;; First, copy the files so that GnuPG writes the decrypted files here ;; First, copy the files so that GnuPG writes the decrypted files here
;; and not into the source directory. ;; and not into the source directory.
(for-each (lambda (name) (for-each (lambda (name)
(file-copy (in-srcdir name) name)) (file-copy (in-srcdir "tests" "openpgp" name) name))
encrypted-files) encrypted-files)
;; Now decrypt all files. ;; Now decrypt all files.

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define (get-session-key filename) (define (get-session-key filename)
@ -35,7 +35,7 @@
(for-each-p (for-each-p
"Checking decryption of supplied files using the session key." "Checking decryption of supplied files using the session key."
(lambda (name) (lambda (name)
(let* ((source (in-srcdir (string-append name ".asc"))) (let* ((source (in-srcdir "tests" "openpgp" (string-append name ".asc")))
(key (get-session-key source))) (key (get-session-key source)))
(with-ephemeral-home-directory setup-environment (with-ephemeral-home-directory setup-environment
(tr:do (tr:do

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(lettmp (steve's-key) (lettmp (steve's-key)
@ -29,7 +29,7 @@
;; First, unwrap the encrypted message using Steve's secret key. ;; First, unwrap the encrypted message using Steve's secret key.
(lettmp (unwrapped) (lettmp (unwrapped)
(tr:do (tr:do
(tr:open (in-srcdir "samplemsgs" (string-append name ".asc"))) (tr:open (in-srcdir "tests" "openpgp" "samplemsgs" (string-append name ".asc")))
(tr:gpg "" `(--yes --decrypt --unwrap)) (tr:gpg "" `(--yes --decrypt --unwrap))
(tr:write-to unwrapped)) (tr:write-to unwrapped))

View File

@ -17,14 +17,14 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p
"Checking decryption of supplied files" "Checking decryption of supplied files"
(lambda (name) (lambda (name)
(tr:do (tr:do
(tr:open (in-srcdir (string-append name ".asc"))) (tr:open (in-srcdir "tests" "openpgp" (string-append name ".asc")))
(tr:gpg "" '(--yes --decrypt)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity name))) (tr:assert-identity name)))
plain-files) plain-files)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
;; Import the sample key ;; Import the sample key
@ -33,7 +33,7 @@
(info "Importing public key.") (info "Importing public key.")
(call-check (call-check
`(,(tool 'gpg) --import `(,(tool 'gpg) --import
,(in-srcdir "samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc"))) ,(in-srcdir "tests" "openpgp" "samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc")))
;; By default, the most recent, valid signing subkey (1EA97479). ;; By default, the most recent, valid signing subkey (1EA97479).
(for-each-p (for-each-p

View File

@ -318,7 +318,7 @@
(log "Creating configuration files") (log "Creating configuration files")
(for-each (for-each
(lambda (name) (lambda (name)
(file-copy (in-srcdir (string-append name ".tmpl")) name) (file-copy (in-srcdir "tests" "openpgp" (string-append name ".tmpl")) name)
(let ((p (open-input-output-file name))) (let ((p (open-input-output-file name)))
(cond (cond
((string=? "gpg.conf" name) ((string=? "gpg.conf" name)
@ -349,7 +349,7 @@
(log "Unpacking samples") (log "Unpacking samples")
(for-each (for-each
(lambda (name) (lambda (name)
(dearmor (in-srcdir ".." "openpgp" (string-append name "o.asc")) name)) (dearmor (in-srcdir "tests" "openpgp" (string-append name "o.asc")) name))
plain-files)) plain-files))
(define (create-legacy-gpghome) (define (create-legacy-gpghome)
@ -358,7 +358,7 @@
(log "Storing private keys") (log "Storing private keys")
(for-each (for-each
(lambda (name) (lambda (name)
(dearmor (in-srcdir (string-append "/privkeys/" name ".asc")) (dearmor (in-srcdir "tests" "openpgp" "privkeys" (string-append name ".asc"))
(string-append "private-keys-v1.d/" name ".key"))) (string-append "private-keys-v1.d/" name ".key")))
'("50B2D4FA4122C212611048BC5FC31BD44393626E" '("50B2D4FA4122C212611048BC5FC31BD44393626E"
"7E201E28B6FEB2927B321F443205F4724EBE637E" "7E201E28B6FEB2927B321F443205F4724EBE637E"
@ -382,11 +382,11 @@
(log "Importing public demo and test keys") (log "Importing public demo and test keys")
(for-each (for-each
(lambda (file) (lambda (file)
(call-check `(,@GPG --yes --import ,(in-srcdir file)))) (call-check `(,@GPG --yes --import ,(in-srcdir "tests" "openpgp" file))))
(list "pubdemo.asc" "pubring.asc" key-file1)) (list "pubdemo.asc" "pubring.asc" key-file1))
(pipe:do (pipe:do
(pipe:open (in-srcdir "pubring.pkr.asc") (logior O_RDONLY O_BINARY)) (pipe:open (in-srcdir "tests" "openpgp" "pubring.pkr.asc") (logior O_RDONLY O_BINARY))
(pipe:spawn `(,@GPG --dearmor)) (pipe:spawn `(,@GPG --dearmor))
(pipe:spawn `(,@GPG --yes --import)))) (pipe:spawn `(,@GPG --yes --import))))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(let* ((key keys::alfa) (let* ((key keys::alfa)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define files (append plain-files data-files)) (define files (append plain-files data-files))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define keygrips '("8E06A180EFFE4C65B812150CAF19BF30C0689A4C" (define keygrips '("8E06A180EFFE4C65B812150CAF19BF30C0689A4C"
@ -48,7 +48,7 @@
(for-each (for-each
(lambda (n) (lambda (n)
(call-check `(,(tool 'gpg) --import (call-check `(,(tool 'gpg) --import
,(in-srcdir (string-append ,(in-srcdir "tests" "openpgp" (string-append
"samplekeys/ecc-sample-" "samplekeys/ecc-sample-"
(number->string n) (number->string n)
"-pub.asc"))))) "-pub.asc")))))
@ -117,7 +117,7 @@ Ic1RdzgeCfosMF+l/zVRchcLKzenEQA=
(lambda (n) (lambda (n)
(call-check `(,(tool 'gpg) --import (call-check `(,(tool 'gpg) --import
,@(if (> n 1) '(--allow-non-selfsigned-uid) '()) ,@(if (> n 1) '(--allow-non-selfsigned-uid) '())
,(in-srcdir (string-append ,(in-srcdir "tests" "openpgp" (string-append
"samplekeys/ecc-sample-" "samplekeys/ecc-sample-"
(number->string n) (number->string n)
"-sec.asc"))))) "-sec.asc")))))
@ -242,7 +242,7 @@ Rg==
(lambda (n) (lambda (n)
(call-check `(,(tool 'gpg) --import (call-check `(,(tool 'gpg) --import
,@(if (> n 1) '(--allow-non-selfsigned-uid) '()) ,@(if (> n 1) '(--allow-non-selfsigned-uid) '())
,(in-srcdir (string-append ,(in-srcdir "tests" "openpgp" (string-append
"samplekeys/ecc-sample-" "samplekeys/ecc-sample-"
(number->string n) (number->string n)
"-sec.asc"))))) "-sec.asc")))))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define files (append plain-files data-files)) (define files (append plain-files data-files))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p
@ -54,8 +54,8 @@
(tr:do (tr:do
(tr:open source) (tr:open source)
(tr:gpg "" `(--yes -v --no-keyring --encrypt (tr:gpg "" `(--yes -v --no-keyring --encrypt
--recipient-file ,(in-srcdir key-file1) --recipient-file ,(in-srcdir "tests" "openpgp" key-file1)
--hidden-recipient-file ,(in-srcdir key-file2))) --hidden-recipient-file ,(in-srcdir "tests" "openpgp" key-file2)))
(tr:gpg "" '(--yes --decrypt)) (tr:gpg "" '(--yes --decrypt))
(tr:assert-identity source))) (tr:assert-identity source)))
plain-files) plain-files)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define (check-for predicate lines message) (define (check-for predicate lines message)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(define (genkey config) (define (genkey config)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(for-each-p' (for-each-p'

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(catch (skip "gpgtar not built") (catch (skip "gpgtar not built")

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define msg_signed_asc " (define msg_signed_asc "
@ -63,6 +63,6 @@ N1Glbw1OJfP1q+QFPMPKoCsTYmZpuugq2b5gV/eH0Abvk2pG4Fo/YTDPHhec7Jk=
(catch '() (catch '()
(pipe:do (pipe:do
(pipe:echo (eval armored-file (current-environment))) (pipe:echo (eval armored-file (current-environment)))
(pipe:spawn `(,@GPGV --keyring ,(in-srcdir "forged-keyring.gpg")))) (pipe:spawn `(,@GPGV --keyring ,(in-srcdir "tests" "openpgp" "forged-keyring.gpg"))))
(fail "verification succeeded but should not"))) (fail "verification succeeded but should not")))
'(msg_signed_asc)) '(msg_signed_asc))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
;; XXX because of --always-trust, the trustdb is not created. ;; XXX because of --always-trust, the trustdb is not created.
@ -25,7 +25,7 @@
(define gpg `(,(tool 'gpg) --no-permission-warning)) (define gpg `(,(tool 'gpg) --no-permission-warning))
(info "Checking key revocation.") (info "Checking key revocation.")
(call-check `(,@gpg --import ,(in-srcdir "samplemsgs" (call-check `(,@gpg --import ,(in-srcdir "tests" "openpgp" "samplemsgs"
"revoke-2D727CC768697734.asc"))) "revoke-2D727CC768697734.asc")))
(let loop ((output (gpg-with-colons '(--list-secret-keys "2D727CC768697734")))) (let loop ((output (gpg-with-colons '(--list-secret-keys "2D727CC768697734"))))
(unless (null? output) (unless (null? output)

View File

@ -17,17 +17,17 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(info "Checking bug 894: segv importing certain keys.") (info "Checking bug 894: segv importing certain keys.")
(call-check `(,(tool 'gpg) --import ,(in-srcdir "bug894-test.asc"))) (call-check `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "bug894-test.asc")))
(define keyid "0xC108E83A") (define keyid "0xC108E83A")
(info "Checking bug 1223: designated revoker sigs are not properly merged.") (info "Checking bug 1223: designated revoker sigs are not properly merged.")
(call `(,(tool 'gpg) --delete-key --batch --yes ,keyid)) (call `(,(tool 'gpg) --delete-key --batch --yes ,keyid))
(call `(,(tool 'gpg) --import ,(in-srcdir "bug1223-bogus.asc"))) (call `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "bug1223-bogus.asc")))
(call `(,(tool 'gpg) --import ,(in-srcdir "bug1223-good.asc"))) (call `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "bug1223-good.asc")))
(tr:do (tr:do
(tr:pipe-do (tr:pipe-do
(pipe:gpg `(--list-keys --with-colons ,keyid))) (pipe:gpg `(--list-keys --with-colons ,keyid)))
@ -44,8 +44,8 @@
(define fpr2 "A55120427374F3F7AA5F1166DDA252EBB8EBE1AF") (define fpr2 "A55120427374F3F7AA5F1166DDA252EBB8EBE1AF")
(info "Checking import of two keys with colliding long key ids.") (info "Checking import of two keys with colliding long key ids.")
(call `(,(tool 'gpg) --delete-key --batch --yes ,fpr1 ,fpr2)) (call `(,(tool 'gpg) --delete-key --batch --yes ,fpr1 ,fpr2))
(call `(,(tool 'gpg) --import ,(in-srcdir "samplekeys/dda252ebb8ebe1af-1.asc"))) (call `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "samplekeys/dda252ebb8ebe1af-1.asc")))
(call `(,(tool 'gpg) --import ,(in-srcdir "samplekeys/dda252ebb8ebe1af-2.asc"))) (call `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "samplekeys/dda252ebb8ebe1af-2.asc")))
(tr:do (tr:do
(tr:pipe-do (tr:pipe-do
(pipe:gpg `(--list-keys --with-colons ,fpr1 ,fpr2))) (pipe:gpg `(--list-keys --with-colons ,fpr1 ,fpr2)))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(info "Checking passphrase cache (issue2015)...") (info "Checking passphrase cache (issue2015)...")

View File

@ -17,10 +17,10 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(define key (in-srcdir "samplekeys/issue2346.gpg")) (define key (in-srcdir "tests" "openpgp" "samplekeys/issue2346.gpg"))
(info "Checking import statistics (issue2346)...") (info "Checking import statistics (issue2346)...")
(let ((status (call-popen `(,@GPG --status-fd=1 --import ,key) ""))) (let ((status (call-popen `(,@GPG --status-fd=1 --import ,key) "")))

View File

@ -17,10 +17,10 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(define keyfile (in-srcdir "samplekeys" "rsa-rsa-sample-1.asc")) (define keyfile (in-srcdir "tests" "openpgp" "samplekeys" "rsa-rsa-sample-1.asc"))
(define (touch file-name) (define (touch file-name)
(close (open file-name (logior O_WRONLY O_BINARY O_CREAT) #o600))) (close (open file-name (logior O_WRONLY O_BINARY O_CREAT) #o600)))

View File

@ -17,13 +17,13 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(info "Checking iobuf_peek corner case (issue2419)...") (info "Checking iobuf_peek corner case (issue2419)...")
(lettmp (lettmp
(onebyte) (onebyte)
(dearmor (in-srcdir "samplemsgs/issue2419.asc") onebyte) (dearmor (in-srcdir "tests" "openpgp" "samplemsgs/issue2419.asc") onebyte)
(catch (assert (string-contains? (car *error*) "invalid packet")) (catch (assert (string-contains? (car *error*) "invalid packet"))
(call-popen `(,@GPG --list-packets ,onebyte) "") (call-popen `(,@GPG --list-packets ,onebyte) "")
(fail "Expected an error but got none"))) (fail "Expected an error but got none")))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(catch (skip "Tofu not supported") (catch (skip "Tofu not supported")

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define (check-failure options) (define (check-failure options)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
;; This test assumes a fixed time of 2004-01-01. ;; This test assumes a fixed time of 2004-01-01.
@ -52,7 +52,7 @@
(define :comment cadr) (define :comment cadr)
(define :number caddr) (define :number caddr)
(define (:filename key) (define (:filename key)
(in-srcdir "key-selection" (in-srcdir "tests" "openpgp" "key-selection"
(string-append (number->string (:number key)) ".asc"))) (string-append (number->string (:number key)) ".asc")))
(define (delete-keys which) (define (delete-keys which)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(define empty-string-hashes (define empty-string-hashes

View File

@ -23,7 +23,7 @@
;; Note: We do not support multiple signatures anymore thus this test is ;; Note: We do not support multiple signatures anymore thus this test is
;; not really needed because verify could do the same. We keep it anyway. ;; not really needed because verify could do the same. We keep it anyway.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define sig-1ls1ls-valid " (define sig-1ls1ls-valid "

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(load (with-path "time.scm")) (load (with-path "time.scm"))
(setup-environment) (setup-environment)

View File

@ -17,9 +17,9 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(if (string=? "" (getenv "srcdir")) (if (string=? "" (getenv "abs_top_srcdir"))
(begin (begin
(echo "Environment variable 'srcdir' not set. Please point it to" (echo "Environment variable 'abs_top_srcdir' not set. Please point it to"
"tests/openpgp.") "tests/openpgp.")
(exit 2))) (exit 2)))
@ -27,9 +27,15 @@
(setenv "objdir" (getcwd) #f) (setenv "objdir" (getcwd) #f)
(let* ((tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*)) (let* ((tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))
(setup (make-environment-cache (test::scm #f "setup.scm" "setup.scm"))) (setup (make-environment-cache (test::scm
#f
(path-join "tests" "openpgp" "setup.scm")
(in-srcdir "tests" "openpgp" "setup.scm"))))
(runner (if (and (member "--parallel" *args*) (runner (if (and (member "--parallel" *args*)
(> (length tests) 1)) (> (length tests) 1))
run-tests-parallel run-tests-parallel
run-tests-sequential))) run-tests-sequential)))
(runner (map (lambda (t) (test::scm setup t t)) tests)))) (runner (map (lambda (name)
(test::scm setup
(path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name))) tests)))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(unless (member "--create-tarball" *args*) (unless (member "--create-tarball" *args*)
(fail "Usage: setup.scm --create-tarball <file>")) (fail "Usage: setup.scm --create-tarball <file>"))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
;; This is not a test, but can be used to inspect the test ;; This is not a test, but can be used to inspect the test

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p
@ -33,7 +33,8 @@
(info "Checking bug 537: MDC problem with old style compressed packets.") (info "Checking bug 537: MDC problem with old style compressed packets.")
(lettmp (tmp) (lettmp (tmp)
(call-popen `(,@GPG --yes --passphrase-fd "0" (call-popen `(,@GPG --yes --passphrase-fd "0"
--output ,tmp --decrypt ,(in-srcdir "bug537-test.data.asc")) --output ,tmp --decrypt ,(in-srcdir "tests" "openpgp"
"bug537-test.data.asc"))
usrpass1) usrpass1)
(if (not (string=? "4336AE2A528FAE091E73E59E325B588FEE795F9B" (if (not (string=? "4336AE2A528FAE091E73E59E325B588FEE795F9B"
(cadar (gpg-hash-string `(--print-md SHA1 ,tmp) "")))) (cadar (gpg-hash-string `(--print-md SHA1 ,tmp) ""))))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(for-each-p (for-each-p

View File

@ -17,11 +17,11 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(define key (define key
`(,(in-srcdir "samplekeys" "authenticate-only.sec.asc") `(,(in-srcdir "tests" "openpgp" "samplekeys" "authenticate-only.sec.asc")
"927EF377FD1A1B6F795E40C02A87917D8FFBA49F" "927EF377FD1A1B6F795E40C02A87917D8FFBA49F"
"72360FDB6380212D5DAF2FA9E51185A9253C496D" "72360FDB6380212D5DAF2FA9E51185A9253C496D"
"ssh-rsa")) "ssh-rsa"))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(setenv "SSH_AUTH_SOCK" (setenv "SSH_AUTH_SOCK"
@ -76,7 +76,7 @@
(for-each-p' (for-each-p'
"Importing ssh keys..." "Importing ssh keys..."
(lambda (key) (lambda (key)
(let ((file (path-join (in-srcdir "samplekeys") (let ((file (path-join (in-srcdir "tests" "openpgp" "samplekeys")
(string-append "ssh-" (car key) ".key"))) (string-append "ssh-" (car key) ".key")))
(hash (cadr key))) (hash (cadr key)))
;; We pipe the key to ssh-add so that it won't complain about ;; We pipe the key to ssh-add so that it won't complain about
@ -91,7 +91,7 @@
(info "Checking for issue2316...") (info "Checking for issue2316...")
(unlink (path-join GNUPGHOME "sshcontrol")) (unlink (path-join GNUPGHOME "sshcontrol"))
(pipe:do (pipe:do
(pipe:open (path-join (in-srcdir "samplekeys") (pipe:open (path-join (in-srcdir "tests" "openpgp" "samplekeys")
(string-append "ssh-rsa.key")) (string-append "ssh-rsa.key"))
(logior O_RDONLY O_BINARY)) (logior O_RDONLY O_BINARY))
(pipe:spawn `(,SSH-ADD -))) (pipe:spawn `(,SSH-ADD -)))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(load (with-path "time.scm")) (load (with-path "time.scm"))
(setup-environment) (setup-environment)
@ -41,7 +41,7 @@
;; Import the test keys. ;; Import the test keys.
(for-each (lambda (keyid) (for-each (lambda (keyid)
(call-check `(,@GPG --import (call-check `(,@GPG --import
,(in-srcdir "tofu/conflicting/" ,(in-srcdir "tests" "openpgp" "tofu" "conflicting"
(string-append keyid ".gpg")))) (string-append keyid ".gpg"))))
(catch (fail "Missing key" keyid) (catch (fail "Missing key" keyid)
(call-check `(,@GPG --list-keys ,keyid)))) (call-check `(,@GPG --list-keys ,keyid))))
@ -108,7 +108,7 @@
;; Verify a message. There should be no conflict and the trust ;; Verify a message. There should be no conflict and the trust
;; policy should be set to auto. ;; policy should be set to auto.
(call-check `(,@GPG --verify ,(in-srcdir "tofu/conflicting/1C005AF3-1.txt"))) (call-check `(,@GPG --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "1C005AF3-1.txt")))
(checkpolicy "1C005AF3" "auto") (checkpolicy "1C005AF3" "auto")
;; Check default trust. ;; Check default trust.
@ -163,7 +163,7 @@
;; auto), but not affect 1C005AF3's policy. ;; auto), but not affect 1C005AF3's policy.
(setpolicy "BE04EB2B" "auto") (setpolicy "BE04EB2B" "auto")
(checkpolicy "BE04EB2B" "ask") (checkpolicy "BE04EB2B" "ask")
(call-check `(,@GPG --verify ,(in-srcdir "tofu/conflicting/B662E42F-1.txt"))) (call-check `(,@GPG --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "B662E42F-1.txt")))
(checkpolicy "BE04EB2B" "ask") (checkpolicy "BE04EB2B" "ask")
(checkpolicy "1C005AF3" "bad") (checkpolicy "1C005AF3" "bad")
(checkpolicy "B662E42F" "ask") (checkpolicy "B662E42F" "ask")
@ -208,26 +208,26 @@
(check-counts "B662E42F" 0 0 0 0) (check-counts "B662E42F" 0 0 0 0)
;; Verify a message. The signature count should increase by 1. ;; Verify a message. The signature count should increase by 1.
(call-check `(,@GPG --verify ,(in-srcdir "tofu/conflicting/1C005AF3-1.txt"))) (call-check `(,@GPG --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "1C005AF3-1.txt")))
(check-counts "1C005AF3" 1 1 0 0) (check-counts "1C005AF3" 1 1 0 0)
;; Verify the same message. The signature count should remain the ;; Verify the same message. The signature count should remain the
;; same. ;; same.
(call-check `(,@GPG --verify ,(in-srcdir "tofu/conflicting/1C005AF3-1.txt"))) (call-check `(,@GPG --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "1C005AF3-1.txt")))
(check-counts "1C005AF3" 1 1 0 0) (check-counts "1C005AF3" 1 1 0 0)
;; Verify another message. ;; Verify another message.
(call-check `(,@GPG --verify ,(in-srcdir "tofu/conflicting/1C005AF3-2.txt"))) (call-check `(,@GPG --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "1C005AF3-2.txt")))
(check-counts "1C005AF3" 2 1 0 0) (check-counts "1C005AF3" 2 1 0 0)
;; Verify another message. ;; Verify another message.
(call-check `(,@GPG --verify ,(in-srcdir "tofu/conflicting/1C005AF3-3.txt"))) (call-check `(,@GPG --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "1C005AF3-3.txt")))
(check-counts "1C005AF3" 3 1 0 0) (check-counts "1C005AF3" 3 1 0 0)
;; Verify a message from a different sender. The signature count ;; Verify a message from a different sender. The signature count
;; should increase by 1 for that key. ;; should increase by 1 for that key.
(call-check `(,@GPG --verify ,(in-srcdir "tofu/conflicting/BE04EB2B-1.txt"))) (call-check `(,@GPG --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "BE04EB2B-1.txt")))
(check-counts "1C005AF3" 3 1 0 0) (check-counts "1C005AF3" 3 1 0 0)
(check-counts "BE04EB2B" 1 1 0 0) (check-counts "BE04EB2B" 1 1 0 0)
(check-counts "B662E42F" 0 0 0 0) (check-counts "B662E42F" 0 0 0 0)
@ -236,34 +236,34 @@
;; when the message was first verified, not when the signer claimed ;; when the message was first verified, not when the signer claimed
;; that it was signed.) ;; that it was signed.)
(call-check `(,@GPG ,(faketime (days->seconds 2)) (call-check `(,@GPG ,(faketime (days->seconds 2))
--verify ,(in-srcdir "tofu/conflicting/1C005AF3-4.txt"))) --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "1C005AF3-4.txt")))
(check-counts "1C005AF3" 4 2 0 0) (check-counts "1C005AF3" 4 2 0 0)
(check-counts "BE04EB2B" 1 1 0 0) (check-counts "BE04EB2B" 1 1 0 0)
(check-counts "B662E42F" 0 0 0 0) (check-counts "B662E42F" 0 0 0 0)
;; And another. ;; And another.
(call-check `(,@GPG ,(faketime (days->seconds 2)) (call-check `(,@GPG ,(faketime (days->seconds 2))
--verify ,(in-srcdir "tofu/conflicting/1C005AF3-5.txt"))) --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "1C005AF3-5.txt")))
(check-counts "1C005AF3" 5 2 0 0) (check-counts "1C005AF3" 5 2 0 0)
(check-counts "BE04EB2B" 1 1 0 0) (check-counts "BE04EB2B" 1 1 0 0)
(check-counts "B662E42F" 0 0 0 0) (check-counts "B662E42F" 0 0 0 0)
;; Another, but for a different key. ;; Another, but for a different key.
(call-check `(,@GPG ,(faketime (days->seconds 2)) (call-check `(,@GPG ,(faketime (days->seconds 2))
--verify ,(in-srcdir "tofu/conflicting/BE04EB2B-2.txt"))) --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "BE04EB2B-2.txt")))
(check-counts "1C005AF3" 5 2 0 0) (check-counts "1C005AF3" 5 2 0 0)
(check-counts "BE04EB2B" 2 2 0 0) (check-counts "BE04EB2B" 2 2 0 0)
(check-counts "B662E42F" 0 0 0 0) (check-counts "B662E42F" 0 0 0 0)
;; And add a third day. ;; And add a third day.
(call-check `(,@GPG ,(faketime (days->seconds 4)) (call-check `(,@GPG ,(faketime (days->seconds 4))
--verify ,(in-srcdir "tofu/conflicting/BE04EB2B-3.txt"))) --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "BE04EB2B-3.txt")))
(check-counts "1C005AF3" 5 2 0 0) (check-counts "1C005AF3" 5 2 0 0)
(check-counts "BE04EB2B" 3 3 0 0) (check-counts "BE04EB2B" 3 3 0 0)
(check-counts "B662E42F" 0 0 0 0) (check-counts "B662E42F" 0 0 0 0)
(call-check `(,@GPG ,(faketime (days->seconds 4)) (call-check `(,@GPG ,(faketime (days->seconds 4))
--verify ,(in-srcdir "tofu/conflicting/BE04EB2B-4.txt"))) --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "BE04EB2B-4.txt")))
(check-counts "1C005AF3" 5 2 0 0) (check-counts "1C005AF3" 5 2 0 0)
(check-counts "BE04EB2B" 4 3 0 0) (check-counts "BE04EB2B" 4 3 0 0)
(check-counts "B662E42F" 0 0 0 0) (check-counts "B662E42F" 0 0 0 0)
@ -293,15 +293,15 @@
(lambda (key) (lambda (key)
(for-each (for-each
(lambda (i) (lambda (i)
(let ((fn (in-srcdir DIR (string-append key "-" i ".txt")))) (let ((fn (in-srcdir "tests" "openpgp" DIR (string-append key "-" i ".txt"))))
(call-check `(,@GPG --verify ,fn)))) (call-check `(,@GPG --verify ,fn))))
(list "1" "2"))) (list "1" "2")))
(list KEYIDA KEYIDB))) (list KEYIDA KEYIDB)))
;; Import the public keys. ;; Import the public keys.
(display " > Two keys. ") (display " > Two keys. ")
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDA "-1.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDA "-1.gpg"))))
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDB "-1.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-1.gpg"))))
;; Make sure the tofu engine registers the keys. ;; Make sure the tofu engine registers the keys.
(verify-messages) (verify-messages)
(display "<\n") (display "<\n")
@ -312,8 +312,8 @@
;; Import the cross sigs. ;; Import the cross sigs.
(display " > Adding cross signatures. ") (display " > Adding cross signatures. ")
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDA "-2.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDA "-2.gpg"))))
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDB "-2.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-2.gpg"))))
(verify-messages) (verify-messages)
(display "<\n") (display "<\n")
@ -323,7 +323,7 @@
;; Import the conflicting user id. ;; Import the conflicting user id.
(display " > Adding conflicting user id. ") (display " > Adding conflicting user id. ")
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDB "-3.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-3.gpg"))))
(verify-messages) (verify-messages)
(display "<\n") (display "<\n")
@ -333,7 +333,7 @@
;; Import Alice's signature on the conflicting user id. Since there ;; Import Alice's signature on the conflicting user id. Since there
;; is now a cross signature, we should revert to the default policy. ;; is now a cross signature, we should revert to the default policy.
(display " > Adding cross signature on user id. ") (display " > Adding cross signature on user id. ")
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDB "-4.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-4.gpg"))))
(verify-messages) (verify-messages)
(display "<\n") (display "<\n")
@ -385,15 +385,15 @@
(lambda (key) (lambda (key)
(for-each (for-each
(lambda (i) (lambda (i)
(let ((fn (in-srcdir DIR (string-append key "-" i ".txt")))) (let ((fn (in-srcdir "tests" "openpgp" DIR (string-append key "-" i ".txt"))))
(call-check `(,@GPG --verify ,fn)))) (call-check `(,@GPG --verify ,fn))))
(list "1" "2"))) (list "1" "2")))
(list KEYIDA KEYIDB))) (list KEYIDA KEYIDB)))
;; Import the public keys. ;; Import the public keys.
(display " > Two keys. ") (display " > Two keys. ")
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDA "-1.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDA "-1.gpg"))))
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDB "-1.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-1.gpg"))))
(display "<\n") (display "<\n")
(checkpolicy KEYA "auto") (checkpolicy KEYA "auto")
@ -401,8 +401,8 @@
;; Import the cross sigs. ;; Import the cross sigs.
(display " > Adding cross signatures. ") (display " > Adding cross signatures. ")
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDA "-2.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDA "-2.gpg"))))
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDB "-2.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-2.gpg"))))
(display "<\n") (display "<\n")
(checkpolicy KEYA "auto") (checkpolicy KEYA "auto")
@ -423,7 +423,7 @@
;; Import the conflicting user id. ;; Import the conflicting user id.
(display " > Adding conflicting user id. ") (display " > Adding conflicting user id. ")
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDB "-3.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-3.gpg"))))
(verify-messages) (verify-messages)
(display "<\n") (display "<\n")
@ -432,7 +432,7 @@
;; Import Alice's signature on the conflicting user id. ;; Import Alice's signature on the conflicting user id.
(display " > Adding cross signature on user id. ") (display " > Adding cross signature on user id. ")
(call-check `(,@GPG --import ,(in-srcdir DIR (string-append KEYIDB "-4.gpg")))) (call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-4.gpg"))))
(verify-messages) (verify-messages)
(display "<\n") (display "<\n")

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
;; Import the sample key ;; Import the sample key
@ -33,7 +33,7 @@
(info "Importing public key.") (info "Importing public key.")
(call-check (call-check
`(,(tool 'gpg) --import `(,(tool 'gpg) --import
,(in-srcdir "samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc"))) ,(in-srcdir "tests" "openpgp" "samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc")))
;; By default, the most recent, valid signing subkey (1EA97479). ;; By default, the most recent, valid signing subkey (1EA97479).
(for-each-p (for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
(define files '("clearsig-1-key-1.asc" "signed-1-key-1.asc")) (define files '("clearsig-1-key-1.asc" "signed-1-key-1.asc"))
@ -27,7 +27,7 @@
(let* ((status (let* ((status
(call-popen (call-popen
`(,@gpg --verify --multifile --status-fd=1 `(,@gpg --verify --multifile --status-fd=1
,@(map (lambda (name) (in-srcdir "samplemsgs" name)) files)) ,@(map (lambda (name) (in-srcdir "tests" "openpgp" "samplemsgs" name)) files))
"")) ""))
(lines (map (lambda (l) (lines (map (lambda (l)
(assert (string-prefix? l "[GNUPG:] ")) (assert (string-prefix? l "[GNUPG:] "))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-legacy-environment) (setup-legacy-environment)
;; ;;
@ -343,7 +343,7 @@ GisM
;;; Need to import the ed25519 sample key used for ;;; Need to import the ed25519 sample key used for
;;; the next two tests. ;;; the next two tests.
(call-check `(,@GPG --quiet --yes --import ,(in-srcdir key-file2))) (call-check `(,@GPG --quiet --yes --import ,(in-srcdir "tests" "openpgp" key-file2)))
(for-each-p (for-each-p
"Checking that a valid Ed25519 signature is verified as such" "Checking that a valid Ed25519 signature is verified as such"
(lambda (armored-file) (lambda (armored-file)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License ;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>. ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm")) (load (in-srcdir "tests" "openpgp" "defs.scm"))
(setup-environment) (setup-environment)
(info "Printing the GPG version") (info "Printing the GPG version")