From ed4d23d75e8ba89e998b88a4f862661c81f665a3 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 22 Mar 2017 12:40:42 +0100 Subject: [PATCH] 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 --- g10/Makefile.am | 2 + g10/t-stutter.c | 14 ++--- g10/test.c | 6 +- tests/gpgme/Makefile.am | 4 +- tests/gpgme/gpgme-defs.scm | 2 +- tests/gpgme/run-tests.scm | 21 +++++-- tests/gpgme/setup.scm | 2 +- tests/gpgme/wrap.scm | 3 +- tests/gpgscm/tests.scm | 2 +- tests/gpgsm/Makefile.am | 4 +- tests/gpgsm/decrypt.scm | 4 +- tests/gpgsm/encrypt.scm | 2 +- tests/gpgsm/export.scm | 2 +- tests/gpgsm/gpgsm-defs.scm | 6 +- tests/gpgsm/import.scm | 4 +- tests/gpgsm/run-tests.scm | 14 +++-- tests/gpgsm/setup.scm | 2 +- tests/gpgsm/shell.scm | 2 +- tests/gpgsm/sign.scm | 2 +- tests/gpgsm/verify.scm | 2 +- tests/migrations/Makefile.am | 6 +- tests/migrations/common.scm | 2 +- tests/migrations/extended-pkf.scm | 4 +- tests/migrations/from-classic.scm | 8 +-- tests/migrations/issue2276.scm | 4 +- tests/migrations/run-tests.scm | 5 +- tests/openpgp/4gb-packet.scm | 4 +- tests/openpgp/Makefile.am | 6 +- tests/openpgp/armdetach.scm | 2 +- tests/openpgp/armdetachm.scm | 2 +- tests/openpgp/armencrypt.scm | 2 +- tests/openpgp/armencryptp.scm | 2 +- tests/openpgp/armor.scm | 2 +- tests/openpgp/armsignencrypt.scm | 2 +- tests/openpgp/armsigs.scm | 2 +- tests/openpgp/clearsig.scm | 2 +- tests/openpgp/compression.scm | 2 +- tests/openpgp/conventional-mdc.scm | 2 +- tests/openpgp/conventional.scm | 2 +- tests/openpgp/decrypt-dsa.scm | 4 +- tests/openpgp/decrypt-multifile.scm | 4 +- tests/openpgp/decrypt-session-key.scm | 4 +- tests/openpgp/decrypt-unwrap-verify.scm | 4 +- tests/openpgp/decrypt.scm | 4 +- tests/openpgp/default-key.scm | 4 +- tests/openpgp/defs.scm | 10 ++-- tests/openpgp/delete-keys.scm | 2 +- tests/openpgp/detach.scm | 2 +- tests/openpgp/detachm.scm | 2 +- tests/openpgp/ecc.scm | 8 +-- tests/openpgp/enarmor.scm | 2 +- tests/openpgp/encrypt-dsa.scm | 2 +- tests/openpgp/encrypt-multifile.scm | 2 +- tests/openpgp/encrypt.scm | 6 +- tests/openpgp/encryptp.scm | 2 +- tests/openpgp/export.scm | 2 +- tests/openpgp/genkey1024.scm | 2 +- tests/openpgp/gpgconf.scm | 2 +- tests/openpgp/gpgtar.scm | 2 +- tests/openpgp/gpgv-forged-keyring.scm | 4 +- .../openpgp/import-revocation-certificate.scm | 4 +- tests/openpgp/import.scm | 12 ++-- tests/openpgp/issue2015.scm | 2 +- tests/openpgp/issue2346.scm | 4 +- tests/openpgp/issue2417.scm | 4 +- tests/openpgp/issue2419.scm | 4 +- tests/openpgp/issue2929.scm | 2 +- tests/openpgp/issue2941.scm | 2 +- tests/openpgp/key-selection.scm | 4 +- tests/openpgp/mds.scm | 2 +- tests/openpgp/multisig.scm | 2 +- tests/openpgp/quick-key-manipulation.scm | 2 +- tests/openpgp/run-tests.scm | 14 +++-- tests/openpgp/seat.scm | 2 +- tests/openpgp/setup.scm | 2 +- tests/openpgp/shell.scm | 2 +- tests/openpgp/signencrypt-dsa.scm | 2 +- tests/openpgp/signencrypt.scm | 5 +- tests/openpgp/sigs-dsa.scm | 2 +- tests/openpgp/sigs.scm | 2 +- tests/openpgp/ssh-export.scm | 4 +- tests/openpgp/ssh-import.scm | 6 +- tests/openpgp/tofu.scm | 56 +++++++++---------- tests/openpgp/use-exact-key.scm | 4 +- tests/openpgp/verify-multifile.scm | 4 +- tests/openpgp/verify.scm | 4 +- tests/openpgp/version.scm | 2 +- 87 files changed, 208 insertions(+), 182 deletions(-) diff --git a/g10/Makefile.am b/g10/Makefile.am index f1d2d1734..4b806ec02 100644 --- a/g10/Makefile.am +++ b/g10/Makefile.am @@ -54,6 +54,8 @@ noinst_PROGRAMS += gpgcompose endif noinst_PROGRAMS += $(module_tests) TESTS = $(module_tests) +TESTS_ENVIRONMENT = \ + abs_top_srcdir=$(abs_top_srcdir) if ENABLE_BZIP2_SUPPORT bzip2_source = compress-bz2.c diff --git a/g10/t-stutter.c b/g10/t-stutter.c index f4a9a5988..8fe242d53 100644 --- a/g10/t-stutter.c +++ b/g10/t-stutter.c @@ -58,6 +58,8 @@ #include "dek.h" #include "../common/logging.h" +#include "test.c" + static void 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; } -int -main (int argc, char *argv[]) +static void +do_test (int argc, char *argv[]) { int i; int debug = 0; @@ -379,8 +381,6 @@ main (int argc, char *argv[]) byte *raw_data; int raw_data_len; - int failed = 0; - for (i = 1; i < argc; i ++) { 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. */ { parse_session_key ("9:9274A8EC128E850C6DDDF9EAC68BFA84FC7BC05F340DA41D78C93D0640C7C503"); - filename = xasprintf ("%s/t-stutter-data.asc", filename); } if (help || ! blocksize || ! filename) @@ -601,7 +600,7 @@ main (int argc, char *argv[]) isprint (pt[0]) ? pt[0] : '?', isprint (pt[1]) ? pt[1] : '?', hexstr (m)); - failed = 1; + tests_failed++; } } @@ -610,5 +609,4 @@ main (int argc, char *argv[]) } xfree (filename); - return failed; } diff --git a/g10/test.c b/g10/test.c index 734458af3..375f361a7 100644 --- a/g10/test.c +++ b/g10/test.c @@ -154,12 +154,12 @@ prepend_srcdir (const char *fname) static const char *srcdir; char *result; - if (!srcdir && !(srcdir = getenv ("srcdir"))) + if (!srcdir && !(srcdir = getenv ("abs_top_srcdir"))) srcdir = "."; - result = malloc (strlen (srcdir) + 1 + strlen (fname) + 1); + result = malloc (strlen (srcdir) + strlen ("/g10/") + strlen (fname) + 1); strcpy (result, srcdir); - strcat (result, "/"); + strcat (result, "/g10/"); strcat (result, fname); return result; } diff --git a/tests/gpgme/Makefile.am b/tests/gpgme/Makefile.am index 0d0edc03c..daf757283 100644 --- a/tests/gpgme/Makefile.am +++ b/tests/gpgme/Makefile.am @@ -31,9 +31,9 @@ AM_CFLAGS = TESTS_ENVIRONMENT = LC_ALL=C \ EXEEXT=$(EXEEXT) \ PATH=../gpgscm:$(PATH) \ - srcdir=$(abs_srcdir) \ + abs_top_srcdir=$(abs_top_srcdir) \ 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 # workaround, we avoid defining 'TESTS', thus automake will not emit diff --git a/tests/gpgme/gpgme-defs.scm b/tests/gpgme/gpgme-defs.scm index 486d1a1de..1e215b1e3 100644 --- a/tests/gpgme/gpgme-defs.scm +++ b/tests/gpgme/gpgme-defs.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (define gpgme-srcdir (getenv "XTEST_GPGME_SRCDIR")) (when (string=? "" gpgme-srcdir) diff --git a/tests/gpgme/run-tests.scm b/tests/gpgme/run-tests.scm index be70f178d..df5f5482b 100644 --- a/tests/gpgme/run-tests.scm +++ b/tests/gpgme/run-tests.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgme-defs.scm")) +(load (in-srcdir "tests" "gpgme" "gpgme-defs.scm")) (info "Running GPGME's test suite...") @@ -40,11 +40,17 @@ run-tests-parallel run-tests-sequential)) (setup-c (make-environment-cache - (test::scm #f "setup.scm (tests/gpg)" (in-srcdir "setup.scm") - "--" "tests" "gpg"))) + (test::scm + #f + (path-join "tests" "gpgme" "setup.scm" "tests" "gpg") + (in-srcdir "tests" "gpgme" "setup.scm") + "--" "tests" "gpg"))) (setup-py (make-environment-cache - (test::scm #f "setup.scm (lang/python/tests)" (in-srcdir "setup.scm") - "--" "lang" "python" "tests"))) + (test::scm + #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*))) (runner (apply @@ -66,7 +72,10 @@ (map (lambda (name) (apply test::scm `(,(: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) -- ,@(:path cmpnts)))) (if (null? tests) (all-tests makefile (:key cmpnts)) tests)))) diff --git a/tests/gpgme/setup.scm b/tests/gpgme/setup.scm index 0116a7424..d1173d853 100644 --- a/tests/gpgme/setup.scm +++ b/tests/gpgme/setup.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgme-defs.scm")) +(load (in-srcdir "tests" "gpgme" "gpgme-defs.scm")) (define tarball (flag "--create-tarball" *args*)) (unless (and tarball (not (null? tarball))) diff --git a/tests/gpgme/wrap.scm b/tests/gpgme/wrap.scm index eb416f499..9a20d5003 100644 --- a/tests/gpgme/wrap.scm +++ b/tests/gpgme/wrap.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgme-defs.scm")) +(load (in-srcdir "tests" "gpgme" "gpgme-defs.scm")) (define executable (flag "--executable" *args*)) (unless (and executable (not (null? executable))) @@ -28,6 +28,7 @@ (setenv "abs_builddir" (getcwd) #t) (setenv "top_srcdir" gpgme-srcdir #t) (setenv "srcdir" (path-join gpgme-srcdir "tests" "gpg") #t) +(setenv "abs_top_srcdir" (path-join gpgme-srcdir "tests" "gpg") #t) (define (run what) (if (string-suffix? (car what) ".py") diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm index 4107889b7..e8cea854f 100644 --- a/tests/gpgscm/tests.scm +++ b/tests/gpgscm/tests.scm @@ -189,7 +189,7 @@ (if (absolute-path? path) path (path-join (getcwd) path))) (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, ;; or raises an error. diff --git a/tests/gpgsm/Makefile.am b/tests/gpgsm/Makefile.am index 28db50133..214c3b246 100644 --- a/tests/gpgsm/Makefile.am +++ b/tests/gpgsm/Makefile.am @@ -31,9 +31,9 @@ AM_CFLAGS = TESTS_ENVIRONMENT = LC_ALL=C \ EXEEXT=$(EXEEXT) \ PATH=../gpgscm:$(PATH) \ - srcdir=$(abs_srcdir) \ + abs_top_srcdir=$(abs_top_srcdir) \ 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 = \ import.scm \ diff --git a/tests/gpgsm/decrypt.scm b/tests/gpgsm/decrypt.scm index e7f3baa29..c328ba89d 100644 --- a/tests/gpgsm/decrypt.scm +++ b/tests/gpgsm/decrypt.scm @@ -17,14 +17,14 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgsm-defs.scm")) +(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm")) (setup-gpgsm-environment) (for-each-p "Checking decryption of supplied files." (lambda (name) (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:assert-identity name))) plain-files) diff --git a/tests/gpgsm/encrypt.scm b/tests/gpgsm/encrypt.scm index fd23ac5c5..bb90c8e73 100644 --- a/tests/gpgsm/encrypt.scm +++ b/tests/gpgsm/encrypt.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgsm-defs.scm")) +(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm")) (setup-gpgsm-environment) (for-each-p diff --git a/tests/gpgsm/export.scm b/tests/gpgsm/export.scm index 47fb06e20..d29b6cc48 100644 --- a/tests/gpgsm/export.scm +++ b/tests/gpgsm/export.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgsm-defs.scm")) +(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm")) (setup-gpgsm-environment) (for-each-p' diff --git a/tests/gpgsm/gpgsm-defs.scm b/tests/gpgsm/gpgsm-defs.scm index 5f9be7f0f..c978c32b3 100644 --- a/tests/gpgsm/gpgsm-defs.scm +++ b/tests/gpgsm/gpgsm-defs.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) ;; This is the list of certificates that we install in the test ;; environment. @@ -83,13 +83,13 @@ (log "Storing private keys") (for-each (lambda (name) - (file-copy (in-srcdir name) + (file-copy (in-srcdir "tests" "gpgsm" name) (path-join "private-keys-v1.d" (string-append name ".key")))) '("32100C27173EF6E9C4E9A25D3D69F86D37A4F939")) (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) (stop-agent)) diff --git a/tests/gpgsm/import.scm b/tests/gpgsm/import.scm index 85e5107ad..be555da8a 100644 --- a/tests/gpgsm/import.scm +++ b/tests/gpgsm/import.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgsm-defs.scm")) +(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm")) (setup-gpgsm-environment) (define certs-for-import @@ -47,7 +47,7 @@ "Checking certificate import." (lambda (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)))) (lambda (test) (:name test)) certs-for-import) diff --git a/tests/gpgsm/run-tests.scm b/tests/gpgsm/run-tests.scm index e44424513..bf129a1cb 100644 --- a/tests/gpgsm/run-tests.scm +++ b/tests/gpgsm/run-tests.scm @@ -17,16 +17,22 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(if (string=? "" (getenv "srcdir")) +(if (string=? "" (getenv "abs_top_srcdir")) (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.") (exit 2))) (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*) (> (length tests) 1)) run-tests-parallel 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))) diff --git a/tests/gpgsm/setup.scm b/tests/gpgsm/setup.scm index aa1ab4132..c241b38fe 100644 --- a/tests/gpgsm/setup.scm +++ b/tests/gpgsm/setup.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgsm-defs.scm")) +(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm")) (define tarball (flag "--create-tarball" *args*)) (unless (and tarball (not (null? tarball))) diff --git a/tests/gpgsm/shell.scm b/tests/gpgsm/shell.scm index fe39fec33..606e3880b 100644 --- a/tests/gpgsm/shell.scm +++ b/tests/gpgsm/shell.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgsm-defs.scm")) +(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm")) (setup-gpgsm-environment) ;; This is not a test, but can be used to inspect the test diff --git a/tests/gpgsm/sign.scm b/tests/gpgsm/sign.scm index 9b4f7fe90..48b7b0669 100644 --- a/tests/gpgsm/sign.scm +++ b/tests/gpgsm/sign.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgsm-defs.scm")) +(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm")) (setup-gpgsm-environment) (for-each-p diff --git a/tests/gpgsm/verify.scm b/tests/gpgsm/verify.scm index 28210a9a3..40dbd4898 100644 --- a/tests/gpgsm/verify.scm +++ b/tests/gpgsm/verify.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "gpgsm-defs.scm")) +(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm")) (setup-gpgsm-environment) ;; diff --git a/tests/migrations/Makefile.am b/tests/migrations/Makefile.am index 0895aff04..e548723a7 100644 --- a/tests/migrations/Makefile.am +++ b/tests/migrations/Makefile.am @@ -31,9 +31,9 @@ AM_CFLAGS = TESTS_ENVIRONMENT = GPG_AGENT_INFO= LC_ALL=C \ EXEEXT=$(EXEEXT) \ PATH=../gpgscm:$(PATH) \ - srcdir=$(abs_srcdir) \ + abs_top_srcdir=$(abs_top_srcdir) \ 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 \ extended-pkf.scm \ @@ -54,7 +54,7 @@ check: xcheck .PHONY: xcheck xcheck: $(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) diff --git a/tests/migrations/common.scm b/tests/migrations/common.scm index cba659024..54d33b987 100644 --- a/tests/migrations/common.scm +++ b/tests/migrations/common.scm @@ -15,7 +15,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(if (string=? "" (getenv "srcdir")) +(if (string=? "" (getenv "abs_top_srcdir")) (error "not called from make")) (let ((verbose (string->number (getenv "verbose")))) diff --git a/tests/migrations/extended-pkf.scm b/tests/migrations/extended-pkf.scm index 1317cd4f8..cc1a074db 100755 --- a/tests/migrations/extended-pkf.scm +++ b/tests/migrations/extended-pkf.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "common.scm")) +(load (in-srcdir "tests" "migrations" "common.scm")) (catch (skip "gpgtar not built") (call-check `(,GPGTAR --help))) @@ -31,7 +31,7 @@ (run-test "Testing the extended private key format ..." - (in-srcdir "extended-pkf.tar.asc") + (in-srcdir "tests" "migrations" "extended-pkf.tar.asc") (lambda (gpghome) (assert-keys-usable))) diff --git a/tests/migrations/from-classic.scm b/tests/migrations/from-classic.scm index ace458e22..b473d702a 100755 --- a/tests/migrations/from-classic.scm +++ b/tests/migrations/from-classic.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "common.scm")) +(load (in-srcdir "tests" "migrations" "common.scm")) (catch (skip "gpgtar not built") (call-check `(,GPGTAR --help))) @@ -37,14 +37,14 @@ (run-test "Testing a clean migration ..." - (in-srcdir "from-classic.tar.asc") + (in-srcdir "tests" "migrations" "from-classic.tar.asc") (lambda (gpghome) (trigger-migration) (assert-migrated))) (run-test "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) (mkdir "private-keys-v1.d" "-rwx") (trigger-migration) @@ -52,7 +52,7 @@ (run-test "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) (mkdir "private-keys-v1.d" "") (trigger-migration) diff --git a/tests/migrations/issue2276.scm b/tests/migrations/issue2276.scm index 9a0c160d4..8ea3f430e 100755 --- a/tests/migrations/issue2276.scm +++ b/tests/migrations/issue2276.scm @@ -17,12 +17,12 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "common.scm")) +(load (in-srcdir "tests" "migrations" "common.scm")) (run-test "Checking migration with legacy key (issue2276)..." ;; This tarball contains a keyring with a legacy key. - (in-srcdir "issue2276.tar.asc") + (in-srcdir "tests" "migrations" "issue2276.tar.asc") (lambda (gpghome) ;; GnuPG up to 2.1.14 failed to skip the legacy key when updating ;; the trust database and thereby rebuilding the keyring cache. diff --git a/tests/migrations/run-tests.scm b/tests/migrations/run-tests.scm index b4ad260bb..1e4bb704b 100644 --- a/tests/migrations/run-tests.scm +++ b/tests/migrations/run-tests.scm @@ -22,4 +22,7 @@ (> (length tests) 1)) run-tests-parallel 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))) diff --git a/tests/openpgp/4gb-packet.scm b/tests/openpgp/4gb-packet.scm index 109e61dc9..e1c5ba589 100755 --- a/tests/openpgp/4gb-packet.scm +++ b/tests/openpgp/4gb-packet.scm @@ -20,10 +20,10 @@ ;; GnuPG through 2.1.7 would incorrect mark packets whose size is ;; 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) (unless (have-compression-algo? "BZIP2") (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"))) diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index 40f947b5a..354dff97c 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -36,9 +36,9 @@ fake_pinentry_SOURCES = fake-pinentry.c TESTS_ENVIRONMENT = LC_ALL=C \ EXEEXT=$(EXEEXT) \ PATH=../gpgscm:$(PATH) \ - srcdir=$(abs_srcdir) \ + abs_top_srcdir=$(abs_top_srcdir) \ objdir=$(abs_top_builddir) \ - GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm:$(abs_top_srcdir)/tests/openpgp + GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm XTESTS = \ version.scm \ @@ -109,7 +109,7 @@ check: xcheck .PHONY: xcheck xcheck: $(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 \ plain-1.asc plain-2.asc plain-3.asc plain-1-pgp.asc \ diff --git a/tests/openpgp/armdetach.scm b/tests/openpgp/armdetach.scm index 3bae28b98..105f52d59 100755 --- a/tests/openpgp/armdetach.scm +++ b/tests/openpgp/armdetach.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/armdetachm.scm b/tests/openpgp/armdetachm.scm index 68122630e..27038a0f9 100755 --- a/tests/openpgp/armdetachm.scm +++ b/tests/openpgp/armdetachm.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define files (append plain-files data-files)) diff --git a/tests/openpgp/armencrypt.scm b/tests/openpgp/armencrypt.scm index 21131eac0..6d6ec4d64 100755 --- a/tests/openpgp/armencrypt.scm +++ b/tests/openpgp/armencrypt.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/armencryptp.scm b/tests/openpgp/armencryptp.scm index 4a001660a..4bcc0581a 100755 --- a/tests/openpgp/armencryptp.scm +++ b/tests/openpgp/armencryptp.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/armor.scm b/tests/openpgp/armor.scm index 6f57c7853..3c117dd10 100755 --- a/tests/openpgp/armor.scm +++ b/tests/openpgp/armor.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define armored_key_8192 "-----BEGIN PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/armsignencrypt.scm b/tests/openpgp/armsignencrypt.scm index 49eea07cf..97595f0fa 100755 --- a/tests/openpgp/armsignencrypt.scm +++ b/tests/openpgp/armsignencrypt.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/armsigs.scm b/tests/openpgp/armsigs.scm index 2fab729e1..ccab81683 100755 --- a/tests/openpgp/armsigs.scm +++ b/tests/openpgp/armsigs.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/clearsig.scm b/tests/openpgp/clearsig.scm index a9f20f233..b1c72c2ec 100755 --- a/tests/openpgp/clearsig.scm +++ b/tests/openpgp/clearsig.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define (check-signing args input) diff --git a/tests/openpgp/compression.scm b/tests/openpgp/compression.scm index bab7572c1..d2e46cc00 100755 --- a/tests/openpgp/compression.scm +++ b/tests/openpgp/compression.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/conventional-mdc.scm b/tests/openpgp/conventional-mdc.scm index af27fad07..bb8327aca 100755 --- a/tests/openpgp/conventional-mdc.scm +++ b/tests/openpgp/conventional-mdc.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define s2k '--s2k-count=65536) diff --git a/tests/openpgp/conventional.scm b/tests/openpgp/conventional.scm index 4bca3c92f..c4804000e 100755 --- a/tests/openpgp/conventional.scm +++ b/tests/openpgp/conventional.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define s2k '--s2k-count=65536) diff --git a/tests/openpgp/decrypt-dsa.scm b/tests/openpgp/decrypt-dsa.scm index 640dfd23f..9f39732c9 100755 --- a/tests/openpgp/decrypt-dsa.scm +++ b/tests/openpgp/decrypt-dsa.scm @@ -17,14 +17,14 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p "Checking decryption of supplied DSA encrypted file" (lambda (name) (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:assert-identity name))) (list (car plain-files))) diff --git a/tests/openpgp/decrypt-multifile.scm b/tests/openpgp/decrypt-multifile.scm index a7695b1f0..304ca491b 100755 --- a/tests/openpgp/decrypt-multifile.scm +++ b/tests/openpgp/decrypt-multifile.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (info "Checking decryption of supplied files using --multifile.") @@ -31,7 +31,7 @@ ;; First, copy the files so that GnuPG writes the decrypted files here ;; and not into the source directory. (for-each (lambda (name) - (file-copy (in-srcdir name) name)) + (file-copy (in-srcdir "tests" "openpgp" name) name)) encrypted-files) ;; Now decrypt all files. diff --git a/tests/openpgp/decrypt-session-key.scm b/tests/openpgp/decrypt-session-key.scm index 989ce304d..35aa7f36b 100755 --- a/tests/openpgp/decrypt-session-key.scm +++ b/tests/openpgp/decrypt-session-key.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define (get-session-key filename) @@ -35,7 +35,7 @@ (for-each-p "Checking decryption of supplied files using the session key." (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))) (with-ephemeral-home-directory setup-environment (tr:do diff --git a/tests/openpgp/decrypt-unwrap-verify.scm b/tests/openpgp/decrypt-unwrap-verify.scm index ef9a99a2c..bf7d14d41 100755 --- a/tests/openpgp/decrypt-unwrap-verify.scm +++ b/tests/openpgp/decrypt-unwrap-verify.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (lettmp (steve's-key) @@ -29,7 +29,7 @@ ;; First, unwrap the encrypted message using Steve's secret key. (lettmp (unwrapped) (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:write-to unwrapped)) diff --git a/tests/openpgp/decrypt.scm b/tests/openpgp/decrypt.scm index 8dac38aec..aae4c96e2 100755 --- a/tests/openpgp/decrypt.scm +++ b/tests/openpgp/decrypt.scm @@ -17,14 +17,14 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p "Checking decryption of supplied files" (lambda (name) (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:assert-identity name))) plain-files) diff --git a/tests/openpgp/default-key.scm b/tests/openpgp/default-key.scm index a90cca894..3580cad0f 100755 --- a/tests/openpgp/default-key.scm +++ b/tests/openpgp/default-key.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) ;; Import the sample key @@ -33,7 +33,7 @@ (info "Importing public key.") (call-check `(,(tool 'gpg) --import - ,(in-srcdir "samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc"))) + ,(in-srcdir "tests" "openpgp" "samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc"))) ;; By default, the most recent, valid signing subkey (1EA97479). (for-each-p diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm index c4b321ca0..38d25d8de 100644 --- a/tests/openpgp/defs.scm +++ b/tests/openpgp/defs.scm @@ -318,7 +318,7 @@ (log "Creating configuration files") (for-each (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))) (cond ((string=? "gpg.conf" name) @@ -349,7 +349,7 @@ (log "Unpacking samples") (for-each (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)) (define (create-legacy-gpghome) @@ -358,7 +358,7 @@ (log "Storing private keys") (for-each (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"))) '("50B2D4FA4122C212611048BC5FC31BD44393626E" "7E201E28B6FEB2927B321F443205F4724EBE637E" @@ -382,11 +382,11 @@ (log "Importing public demo and test keys") (for-each (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)) (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 --yes --import)))) diff --git a/tests/openpgp/delete-keys.scm b/tests/openpgp/delete-keys.scm index 9a187a2f9..76cd424e5 100755 --- a/tests/openpgp/delete-keys.scm +++ b/tests/openpgp/delete-keys.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (let* ((key keys::alfa) diff --git a/tests/openpgp/detach.scm b/tests/openpgp/detach.scm index ac2bc361a..12ed16766 100755 --- a/tests/openpgp/detach.scm +++ b/tests/openpgp/detach.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/detachm.scm b/tests/openpgp/detachm.scm index 0b6445829..75faab717 100755 --- a/tests/openpgp/detachm.scm +++ b/tests/openpgp/detachm.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define files (append plain-files data-files)) diff --git a/tests/openpgp/ecc.scm b/tests/openpgp/ecc.scm index 2ea8c3910..d7c02a5e2 100755 --- a/tests/openpgp/ecc.scm +++ b/tests/openpgp/ecc.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define keygrips '("8E06A180EFFE4C65B812150CAF19BF30C0689A4C" @@ -48,7 +48,7 @@ (for-each (lambda (n) (call-check `(,(tool 'gpg) --import - ,(in-srcdir (string-append + ,(in-srcdir "tests" "openpgp" (string-append "samplekeys/ecc-sample-" (number->string n) "-pub.asc"))))) @@ -117,7 +117,7 @@ Ic1RdzgeCfosMF+l/zVRchcLKzenEQA= (lambda (n) (call-check `(,(tool 'gpg) --import ,@(if (> n 1) '(--allow-non-selfsigned-uid) '()) - ,(in-srcdir (string-append + ,(in-srcdir "tests" "openpgp" (string-append "samplekeys/ecc-sample-" (number->string n) "-sec.asc"))))) @@ -242,7 +242,7 @@ Rg== (lambda (n) (call-check `(,(tool 'gpg) --import ,@(if (> n 1) '(--allow-non-selfsigned-uid) '()) - ,(in-srcdir (string-append + ,(in-srcdir "tests" "openpgp" (string-append "samplekeys/ecc-sample-" (number->string n) "-sec.asc"))))) diff --git a/tests/openpgp/enarmor.scm b/tests/openpgp/enarmor.scm index a301ccda4..1fe325606 100755 --- a/tests/openpgp/enarmor.scm +++ b/tests/openpgp/enarmor.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/encrypt-dsa.scm b/tests/openpgp/encrypt-dsa.scm index 0c5a2fdcf..165897334 100755 --- a/tests/openpgp/encrypt-dsa.scm +++ b/tests/openpgp/encrypt-dsa.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/encrypt-multifile.scm b/tests/openpgp/encrypt-multifile.scm index d55971c52..1b69ff524 100755 --- a/tests/openpgp/encrypt-multifile.scm +++ b/tests/openpgp/encrypt-multifile.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define files (append plain-files data-files)) diff --git a/tests/openpgp/encrypt.scm b/tests/openpgp/encrypt.scm index 1888a0034..f59a1f0c1 100755 --- a/tests/openpgp/encrypt.scm +++ b/tests/openpgp/encrypt.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p @@ -54,8 +54,8 @@ (tr:do (tr:open source) (tr:gpg "" `(--yes -v --no-keyring --encrypt - --recipient-file ,(in-srcdir key-file1) - --hidden-recipient-file ,(in-srcdir key-file2))) + --recipient-file ,(in-srcdir "tests" "openpgp" key-file1) + --hidden-recipient-file ,(in-srcdir "tests" "openpgp" key-file2))) (tr:gpg "" '(--yes --decrypt)) (tr:assert-identity source))) plain-files) diff --git a/tests/openpgp/encryptp.scm b/tests/openpgp/encryptp.scm index ccd5c7ba3..0f09a1e46 100755 --- a/tests/openpgp/encryptp.scm +++ b/tests/openpgp/encryptp.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/export.scm b/tests/openpgp/export.scm index c10fc81cb..aa6fa7828 100755 --- a/tests/openpgp/export.scm +++ b/tests/openpgp/export.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define (check-for predicate lines message) diff --git a/tests/openpgp/genkey1024.scm b/tests/openpgp/genkey1024.scm index 60eba0bed..4edf4901a 100755 --- a/tests/openpgp/genkey1024.scm +++ b/tests/openpgp/genkey1024.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) (define (genkey config) diff --git a/tests/openpgp/gpgconf.scm b/tests/openpgp/gpgconf.scm index 33d04d86c..a940b4599 100644 --- a/tests/openpgp/gpgconf.scm +++ b/tests/openpgp/gpgconf.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) (for-each-p' diff --git a/tests/openpgp/gpgtar.scm b/tests/openpgp/gpgtar.scm index c88589f5f..906707fe7 100755 --- a/tests/openpgp/gpgtar.scm +++ b/tests/openpgp/gpgtar.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (catch (skip "gpgtar not built") diff --git a/tests/openpgp/gpgv-forged-keyring.scm b/tests/openpgp/gpgv-forged-keyring.scm index 6885cd9fc..886d2653f 100755 --- a/tests/openpgp/gpgv-forged-keyring.scm +++ b/tests/openpgp/gpgv-forged-keyring.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define msg_signed_asc " @@ -63,6 +63,6 @@ N1Glbw1OJfP1q+QFPMPKoCsTYmZpuugq2b5gV/eH0Abvk2pG4Fo/YTDPHhec7Jk= (catch '() (pipe:do (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"))) '(msg_signed_asc)) diff --git a/tests/openpgp/import-revocation-certificate.scm b/tests/openpgp/import-revocation-certificate.scm index 9231afc0d..c685dc5f1 100644 --- a/tests/openpgp/import-revocation-certificate.scm +++ b/tests/openpgp/import-revocation-certificate.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) ;; XXX because of --always-trust, the trustdb is not created. @@ -25,7 +25,7 @@ (define gpg `(,(tool 'gpg) --no-permission-warning)) (info "Checking key revocation.") -(call-check `(,@gpg --import ,(in-srcdir "samplemsgs" +(call-check `(,@gpg --import ,(in-srcdir "tests" "openpgp" "samplemsgs" "revoke-2D727CC768697734.asc"))) (let loop ((output (gpg-with-colons '(--list-secret-keys "2D727CC768697734")))) (unless (null? output) diff --git a/tests/openpgp/import.scm b/tests/openpgp/import.scm index 3b41746eb..1f4cb2e01 100755 --- a/tests/openpgp/import.scm +++ b/tests/openpgp/import.scm @@ -17,17 +17,17 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) (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") (info "Checking bug 1223: designated revoker sigs are not properly merged.") (call `(,(tool 'gpg) --delete-key --batch --yes ,keyid)) -(call `(,(tool 'gpg) --import ,(in-srcdir "bug1223-bogus.asc"))) -(call `(,(tool 'gpg) --import ,(in-srcdir "bug1223-good.asc"))) +(call `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "bug1223-bogus.asc"))) +(call `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "bug1223-good.asc"))) (tr:do (tr:pipe-do (pipe:gpg `(--list-keys --with-colons ,keyid))) @@ -44,8 +44,8 @@ (define fpr2 "A55120427374F3F7AA5F1166DDA252EBB8EBE1AF") (info "Checking import of two keys with colliding long key ids.") (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 "samplekeys/dda252ebb8ebe1af-2.asc"))) +(call `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "samplekeys/dda252ebb8ebe1af-1.asc"))) +(call `(,(tool 'gpg) --import ,(in-srcdir "tests" "openpgp" "samplekeys/dda252ebb8ebe1af-2.asc"))) (tr:do (tr:pipe-do (pipe:gpg `(--list-keys --with-colons ,fpr1 ,fpr2))) diff --git a/tests/openpgp/issue2015.scm b/tests/openpgp/issue2015.scm index 39df3338b..2f0672df5 100755 --- a/tests/openpgp/issue2015.scm +++ b/tests/openpgp/issue2015.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) (info "Checking passphrase cache (issue2015)...") diff --git a/tests/openpgp/issue2346.scm b/tests/openpgp/issue2346.scm index 9765453ea..9c29516d6 100755 --- a/tests/openpgp/issue2346.scm +++ b/tests/openpgp/issue2346.scm @@ -17,10 +17,10 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) -(define key (in-srcdir "samplekeys/issue2346.gpg")) +(define key (in-srcdir "tests" "openpgp" "samplekeys/issue2346.gpg")) (info "Checking import statistics (issue2346)...") (let ((status (call-popen `(,@GPG --status-fd=1 --import ,key) ""))) diff --git a/tests/openpgp/issue2417.scm b/tests/openpgp/issue2417.scm index f58400079..32fe47f18 100755 --- a/tests/openpgp/issue2417.scm +++ b/tests/openpgp/issue2417.scm @@ -17,10 +17,10 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (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) (close (open file-name (logior O_WRONLY O_BINARY O_CREAT) #o600))) diff --git a/tests/openpgp/issue2419.scm b/tests/openpgp/issue2419.scm index e397a8877..641fb32b5 100755 --- a/tests/openpgp/issue2419.scm +++ b/tests/openpgp/issue2419.scm @@ -17,13 +17,13 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) (info "Checking iobuf_peek corner case (issue2419)...") (lettmp (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")) (call-popen `(,@GPG --list-packets ,onebyte) "") (fail "Expected an error but got none"))) diff --git a/tests/openpgp/issue2929.scm b/tests/openpgp/issue2929.scm index 121103b2c..d5c94cfd5 100644 --- a/tests/openpgp/issue2929.scm +++ b/tests/openpgp/issue2929.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) (catch (skip "Tofu not supported") diff --git a/tests/openpgp/issue2941.scm b/tests/openpgp/issue2941.scm index d7220e098..8f625ebe3 100755 --- a/tests/openpgp/issue2941.scm +++ b/tests/openpgp/issue2941.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define (check-failure options) diff --git a/tests/openpgp/key-selection.scm b/tests/openpgp/key-selection.scm index 020c9b422..511c2e260 100644 --- a/tests/openpgp/key-selection.scm +++ b/tests/openpgp/key-selection.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) ;; This test assumes a fixed time of 2004-01-01. @@ -52,7 +52,7 @@ (define :comment cadr) (define :number caddr) (define (:filename key) - (in-srcdir "key-selection" + (in-srcdir "tests" "openpgp" "key-selection" (string-append (number->string (:number key)) ".asc"))) (define (delete-keys which) diff --git a/tests/openpgp/mds.scm b/tests/openpgp/mds.scm index fb468e5de..50761d0c9 100755 --- a/tests/openpgp/mds.scm +++ b/tests/openpgp/mds.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) (define empty-string-hashes diff --git a/tests/openpgp/multisig.scm b/tests/openpgp/multisig.scm index c643ac88d..75682eb03 100755 --- a/tests/openpgp/multisig.scm +++ b/tests/openpgp/multisig.scm @@ -23,7 +23,7 @@ ;; 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. -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define sig-1ls1ls-valid " diff --git a/tests/openpgp/quick-key-manipulation.scm b/tests/openpgp/quick-key-manipulation.scm index 85e56ca60..8d14ae166 100755 --- a/tests/openpgp/quick-key-manipulation.scm +++ b/tests/openpgp/quick-key-manipulation.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (load (with-path "time.scm")) (setup-environment) diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm index 139f61837..d443d1fb8 100644 --- a/tests/openpgp/run-tests.scm +++ b/tests/openpgp/run-tests.scm @@ -17,9 +17,9 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(if (string=? "" (getenv "srcdir")) +(if (string=? "" (getenv "abs_top_srcdir")) (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.") (exit 2))) @@ -27,9 +27,15 @@ (setenv "objdir" (getcwd) #f) (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*) (> (length tests) 1)) run-tests-parallel 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))) diff --git a/tests/openpgp/seat.scm b/tests/openpgp/seat.scm index 31bd71a3b..5cbfbe16b 100755 --- a/tests/openpgp/seat.scm +++ b/tests/openpgp/seat.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm index a7d14e71c..00eed53fc 100755 --- a/tests/openpgp/setup.scm +++ b/tests/openpgp/setup.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (unless (member "--create-tarball" *args*) (fail "Usage: setup.scm --create-tarball ")) diff --git a/tests/openpgp/shell.scm b/tests/openpgp/shell.scm index ea4b540d1..bd6059a86 100644 --- a/tests/openpgp/shell.scm +++ b/tests/openpgp/shell.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) ;; This is not a test, but can be used to inspect the test diff --git a/tests/openpgp/signencrypt-dsa.scm b/tests/openpgp/signencrypt-dsa.scm index 00ce625de..1a8f9df1b 100755 --- a/tests/openpgp/signencrypt-dsa.scm +++ b/tests/openpgp/signencrypt-dsa.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/signencrypt.scm b/tests/openpgp/signencrypt.scm index 3021eb43b..c00e370e4 100755 --- a/tests/openpgp/signencrypt.scm +++ b/tests/openpgp/signencrypt.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p @@ -33,7 +33,8 @@ (info "Checking bug 537: MDC problem with old style compressed packets.") (lettmp (tmp) (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) (if (not (string=? "4336AE2A528FAE091E73E59E325B588FEE795F9B" (cadar (gpg-hash-string `(--print-md SHA1 ,tmp) "")))) diff --git a/tests/openpgp/sigs-dsa.scm b/tests/openpgp/sigs-dsa.scm index d8494d52a..82dc624d2 100755 --- a/tests/openpgp/sigs-dsa.scm +++ b/tests/openpgp/sigs-dsa.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/sigs.scm b/tests/openpgp/sigs.scm index c2298f985..2b1cf3c31 100755 --- a/tests/openpgp/sigs.scm +++ b/tests/openpgp/sigs.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (for-each-p diff --git a/tests/openpgp/ssh-export.scm b/tests/openpgp/ssh-export.scm index 322620eed..7f51447f1 100755 --- a/tests/openpgp/ssh-export.scm +++ b/tests/openpgp/ssh-export.scm @@ -17,11 +17,11 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) (define key - `(,(in-srcdir "samplekeys" "authenticate-only.sec.asc") + `(,(in-srcdir "tests" "openpgp" "samplekeys" "authenticate-only.sec.asc") "927EF377FD1A1B6F795E40C02A87917D8FFBA49F" "72360FDB6380212D5DAF2FA9E51185A9253C496D" "ssh-rsa")) diff --git a/tests/openpgp/ssh-import.scm b/tests/openpgp/ssh-import.scm index d210056b8..555f19862 100755 --- a/tests/openpgp/ssh-import.scm +++ b/tests/openpgp/ssh-import.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) (setenv "SSH_AUTH_SOCK" @@ -76,7 +76,7 @@ (for-each-p' "Importing ssh keys..." (lambda (key) - (let ((file (path-join (in-srcdir "samplekeys") + (let ((file (path-join (in-srcdir "tests" "openpgp" "samplekeys") (string-append "ssh-" (car key) ".key"))) (hash (cadr key))) ;; We pipe the key to ssh-add so that it won't complain about @@ -91,7 +91,7 @@ (info "Checking for issue2316...") (unlink (path-join GNUPGHOME "sshcontrol")) (pipe:do - (pipe:open (path-join (in-srcdir "samplekeys") + (pipe:open (path-join (in-srcdir "tests" "openpgp" "samplekeys") (string-append "ssh-rsa.key")) (logior O_RDONLY O_BINARY)) (pipe:spawn `(,SSH-ADD -))) diff --git a/tests/openpgp/tofu.scm b/tests/openpgp/tofu.scm index aeeef07d9..58b2a03ff 100755 --- a/tests/openpgp/tofu.scm +++ b/tests/openpgp/tofu.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (load (with-path "time.scm")) (setup-environment) @@ -41,7 +41,7 @@ ;; Import the test keys. (for-each (lambda (keyid) (call-check `(,@GPG --import - ,(in-srcdir "tofu/conflicting/" + ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" (string-append keyid ".gpg")))) (catch (fail "Missing key" keyid) (call-check `(,@GPG --list-keys ,keyid)))) @@ -108,7 +108,7 @@ ;; Verify a message. There should be no conflict and the trust ;; 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") ;; Check default trust. @@ -163,7 +163,7 @@ ;; auto), but not affect 1C005AF3's policy. (setpolicy "BE04EB2B" "auto") (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 "1C005AF3" "bad") (checkpolicy "B662E42F" "ask") @@ -208,26 +208,26 @@ (check-counts "B662E42F" 0 0 0 0) ;; 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) ;; Verify the same message. The signature count should remain the ;; 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) ;; 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) ;; 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) ;; Verify a message from a different sender. The signature count ;; 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 "BE04EB2B" 1 1 0 0) (check-counts "B662E42F" 0 0 0 0) @@ -236,34 +236,34 @@ ;; when the message was first verified, not when the signer claimed ;; that it was signed.) (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 "BE04EB2B" 1 1 0 0) (check-counts "B662E42F" 0 0 0 0) ;; And another. (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 "BE04EB2B" 1 1 0 0) (check-counts "B662E42F" 0 0 0 0) ;; Another, but for a different key. (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 "BE04EB2B" 2 2 0 0) (check-counts "B662E42F" 0 0 0 0) ;; And add a third day. (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 "BE04EB2B" 3 3 0 0) (check-counts "B662E42F" 0 0 0 0) (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 "BE04EB2B" 4 3 0 0) (check-counts "B662E42F" 0 0 0 0) @@ -293,15 +293,15 @@ (lambda (key) (for-each (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)))) (list "1" "2"))) (list KEYIDA KEYIDB))) ;; Import the public keys. (display " > Two keys. ") -(call-check `(,@GPG --import ,(in-srcdir 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 KEYIDA "-1.gpg")))) +(call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-1.gpg")))) ;; Make sure the tofu engine registers the keys. (verify-messages) (display "<\n") @@ -312,8 +312,8 @@ ;; Import the cross sigs. (display " > Adding cross signatures. ") -(call-check `(,@GPG --import ,(in-srcdir 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 KEYIDA "-2.gpg")))) +(call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-2.gpg")))) (verify-messages) (display "<\n") @@ -323,7 +323,7 @@ ;; Import the 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) (display "<\n") @@ -333,7 +333,7 @@ ;; Import Alice's signature on the conflicting user id. Since there ;; is now a cross signature, we should revert to the default policy. (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) (display "<\n") @@ -385,15 +385,15 @@ (lambda (key) (for-each (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)))) (list "1" "2"))) (list KEYIDA KEYIDB))) ;; Import the public keys. (display " > Two keys. ") -(call-check `(,@GPG --import ,(in-srcdir 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 KEYIDA "-1.gpg")))) +(call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-1.gpg")))) (display "<\n") (checkpolicy KEYA "auto") @@ -401,8 +401,8 @@ ;; Import the cross sigs. (display " > Adding cross signatures. ") -(call-check `(,@GPG --import ,(in-srcdir 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 KEYIDA "-2.gpg")))) +(call-check `(,@GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDB "-2.gpg")))) (display "<\n") (checkpolicy KEYA "auto") @@ -423,7 +423,7 @@ ;; Import the 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) (display "<\n") @@ -432,7 +432,7 @@ ;; Import Alice's signature on the conflicting 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) (display "<\n") diff --git a/tests/openpgp/use-exact-key.scm b/tests/openpgp/use-exact-key.scm index 18851da65..8bff9af16 100755 --- a/tests/openpgp/use-exact-key.scm +++ b/tests/openpgp/use-exact-key.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) ;; Import the sample key @@ -33,7 +33,7 @@ (info "Importing public key.") (call-check `(,(tool 'gpg) --import - ,(in-srcdir "samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc"))) + ,(in-srcdir "tests" "openpgp" "samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc"))) ;; By default, the most recent, valid signing subkey (1EA97479). (for-each-p diff --git a/tests/openpgp/verify-multifile.scm b/tests/openpgp/verify-multifile.scm index f1cbe99ba..9ebb672f0 100755 --- a/tests/openpgp/verify-multifile.scm +++ b/tests/openpgp/verify-multifile.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) (define files '("clearsig-1-key-1.asc" "signed-1-key-1.asc")) @@ -27,7 +27,7 @@ (let* ((status (call-popen `(,@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) (assert (string-prefix? l "[GNUPG:] ")) diff --git a/tests/openpgp/verify.scm b/tests/openpgp/verify.scm index d3bd7633c..cb6eb59e4 100755 --- a/tests/openpgp/verify.scm +++ b/tests/openpgp/verify.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-legacy-environment) ;; @@ -343,7 +343,7 @@ GisM ;;; Need to import the ed25519 sample key used for ;;; 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 "Checking that a valid Ed25519 signature is verified as such" (lambda (armored-file) diff --git a/tests/openpgp/version.scm b/tests/openpgp/version.scm index 2b211d80d..c2252c5a2 100755 --- a/tests/openpgp/version.scm +++ b/tests/openpgp/version.scm @@ -17,7 +17,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, see . -(load (with-path "defs.scm")) +(load (in-srcdir "tests" "openpgp" "defs.scm")) (setup-environment) (info "Printing the GPG version")