[Pkg-gnupg-commit] [gnupg2] 85/132: tests: Locate resources and scripts relative to top source dir.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 17 03:07:45 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit ed4d23d75e8ba89e998b88a4f862661c81f665a3
Author: Justus Winter <justus at g10code.com>
Date:   Wed Mar 22 12:40:42 2017 +0100

    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 at g10code.com>
---
 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 +-
 tests/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 f1d2d17..4b806ec 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 f4a9a59..8fe242d 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 734458a..375f361 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 0d0edc0..daf7572 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 486d1a1..1e215b1 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 <http://www.gnu.org/licenses/>.
 
-(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 be70f17..df5f548 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 <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...")
 
@@ -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 0116a74..d1173d8 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 <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*))
 (unless (and tarball (not (null? tarball)))
diff --git a/tests/gpgme/wrap.scm b/tests/gpgme/wrap.scm
index eb416f4..9a20d50 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 <http://www.gnu.org/licenses/>.
 
-(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 4107889..e8cea85 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 28db501..214c3b2 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 e7f3baa..c328ba8 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 <http://www.gnu.org/licenses/>.
 
-(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 fd23ac5..bb90c8e 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 <http://www.gnu.org/licenses/>.
 
-(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 47fb06e..d29b6cc 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 <http://www.gnu.org/licenses/>.
 
-(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 5f9be7f..c978c32 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 <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
 ;; 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 `(, at gpgsm --import ,(in-srcdir "cert_g10code_test1.der")))
+  (call-check `(, at 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 85e5107..be555da 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 <http://www.gnu.org/licenses/>.
 
-(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 `(, at gpgsm --import ,(in-srcdir (:name test))))
+   (call-check `(, at 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 e444245..bf129a1 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 <http://www.gnu.org/licenses/>.
 
-(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 aa1ab41..c241b38 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 <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*))
 (unless (and tarball (not (null? tarball)))
diff --git a/tests/gpgsm/shell.scm b/tests/gpgsm/shell.scm
index fe39fec..606e388 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 <http://www.gnu.org/licenses/>.
 
-(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 9b4f7fe..48b7b06 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 <http://www.gnu.org/licenses/>.
 
-(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 28210a9..40dbd48 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 <http://www.gnu.org/licenses/>.
 
-(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 0895aff..e548723 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 cba6590..54d33b9 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 <http://www.gnu.org/licenses/>.
 
-(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 1317cd4..cc1a074 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 <http://www.gnu.org/licenses/>.
 
-(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 ace458e..b473d70 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 <http://www.gnu.org/licenses/>.
 
-(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 9a0c160..8ea3f43 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 <http://www.gnu.org/licenses/>.
 
-(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 b4ad260..1e4bb70 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 109e61d..e1c5ba5 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 `(, at GPG --list-packets ,(in-srcdir "4gb-packet.asc")))
+(call-check `(, at GPG --list-packets ,(in-srcdir "tests" "openpgp" "4gb-packet.asc")))
diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am
index 40f947b..354dff9 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 3bae28b..105f52d 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 <http://www.gnu.org/licenses/>.
 
-(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 6812263..27038a0 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 <http://www.gnu.org/licenses/>.
 
-(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 21131ea..6d6ec4d 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 <http://www.gnu.org/licenses/>.
 
-(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 4a00166..4bcc058 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 <http://www.gnu.org/licenses/>.
 
-(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 6f57c78..3c117dd 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 <http://www.gnu.org/licenses/>.
 
-(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 49eea07..97595f0 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 <http://www.gnu.org/licenses/>.
 
-(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 2fab729..ccab816 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 <http://www.gnu.org/licenses/>.
 
-(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 a9f20f2..b1c72c2 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 <http://www.gnu.org/licenses/>.
 
-(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 bab7572..d2e46cc 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 <http://www.gnu.org/licenses/>.
 
-(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 af27fad..bb8327a 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 <http://www.gnu.org/licenses/>.
 
-(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 4bca3c9..c480400 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 <http://www.gnu.org/licenses/>.
 
-(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 640dfd2..9f39732 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 <http://www.gnu.org/licenses/>.
 
-(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 a7695b1..304ca49 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 <http://www.gnu.org/licenses/>.
 
-(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 989ce30..35aa7f3 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 <http://www.gnu.org/licenses/>.
 
-(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 ef9a99a..bf7d14d 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 <http://www.gnu.org/licenses/>.
 
-(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 8dac38a..aae4c96 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 <http://www.gnu.org/licenses/>.
 
-(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 a90cca8..3580cad 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 <http://www.gnu.org/licenses/>.
 
-(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 c4b321c..38d25d8 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 `(, at GPG --yes --import ,(in-srcdir file))))
+     (call-check `(, at 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 `(, at GPG --dearmor))
    (pipe:spawn `(, at GPG --yes --import))))
 
diff --git a/tests/openpgp/delete-keys.scm b/tests/openpgp/delete-keys.scm
index 9a187a2..76cd424 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 <http://www.gnu.org/licenses/>.
 
-(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 ac2bc36..12ed167 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 <http://www.gnu.org/licenses/>.
 
-(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 0b64458..75faab7 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 <http://www.gnu.org/licenses/>.
 
-(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 2ea8c39..d7c02a5 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 <http://www.gnu.org/licenses/>.
 
-(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 a301ccd..1fe3256 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 <http://www.gnu.org/licenses/>.
 
-(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 0c5a2fd..1658973 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 <http://www.gnu.org/licenses/>.
 
-(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 d55971c..1b69ff5 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 <http://www.gnu.org/licenses/>.
 
-(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 1888a00..f59a1f0 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 <http://www.gnu.org/licenses/>.
 
-(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 ccd5c7b..0f09a1e 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 <http://www.gnu.org/licenses/>.
 
-(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 c10fc81..aa6fa78 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 <http://www.gnu.org/licenses/>.
 
-(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 60eba0b..4edf490 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 <http://www.gnu.org/licenses/>.
 
-(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 33d04d8..a940b45 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 <http://www.gnu.org/licenses/>.
 
-(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 c88589f..906707f 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 <http://www.gnu.org/licenses/>.
 
-(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 6885cd9..886d265 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 <http://www.gnu.org/licenses/>.
 
-(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 `(, at GPGV --keyring ,(in-srcdir "forged-keyring.gpg"))))
+	   (pipe:spawn `(, at 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 9231afc..c685dc5 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 <http://www.gnu.org/licenses/>.
 
-(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 `(, at gpg --import ,(in-srcdir "samplemsgs"
+(call-check `(, at 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 3b41746..1f4cb2e 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 <http://www.gnu.org/licenses/>.
 
-(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 39df333..2f0672d 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 <http://www.gnu.org/licenses/>.
 
-(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 9765453..9c29516 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 <http://www.gnu.org/licenses/>.
 
-(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 `(, at GPG --status-fd=1 --import ,key) "")))
diff --git a/tests/openpgp/issue2417.scm b/tests/openpgp/issue2417.scm
index f584000..32fe47f 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 <http://www.gnu.org/licenses/>.
 
-(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 e397a88..641fb32 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 <http://www.gnu.org/licenses/>.
 
-(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 `(, at GPG --list-packets ,onebyte) "")
 	(fail "Expected an error but got none")))
diff --git a/tests/openpgp/issue2929.scm b/tests/openpgp/issue2929.scm
index 121103b..d5c94cf 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 <http://www.gnu.org/licenses/>.
 
-(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 d7220e0..8f625eb 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 <http://www.gnu.org/licenses/>.
 
-(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 020c9b4..511c2e2 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 <http://www.gnu.org/licenses/>.
 
-(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 fb468e5..50761d0 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 <http://www.gnu.org/licenses/>.
 
-(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 c643ac8..75682eb 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 85e56ca..8d14ae1 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 <http://www.gnu.org/licenses/>.
 
-(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 139f618..d443d1f 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 <http://www.gnu.org/licenses/>.
 
-(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 31bd71a..5cbfbe1 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 <http://www.gnu.org/licenses/>.
 
-(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 a7d14e7..00eed53 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 <http://www.gnu.org/licenses/>.
 
-(load (with-path "defs.scm"))
+(load (in-srcdir "tests" "openpgp" "defs.scm"))
 
 (unless (member "--create-tarball" *args*)
 	(fail "Usage: setup.scm --create-tarball <file>"))
diff --git a/tests/openpgp/shell.scm b/tests/openpgp/shell.scm
index ea4b540..bd6059a 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 <http://www.gnu.org/licenses/>.
 
-(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 00ce625..1a8f9df 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 <http://www.gnu.org/licenses/>.
 
-(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 3021eb4..c00e370 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 <http://www.gnu.org/licenses/>.
 
-(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 `(, at 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 d8494d5..82dc624 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 <http://www.gnu.org/licenses/>.
 
-(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 c2298f9..2b1cf3c 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 <http://www.gnu.org/licenses/>.
 
-(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 322620e..7f51447 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 <http://www.gnu.org/licenses/>.
 
-(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 d210056..555f198 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 <http://www.gnu.org/licenses/>.
 
-(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 aeeef07..58b2a03 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 <http://www.gnu.org/licenses/>.
 
-(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 `(, at GPG --import
-                                ,(in-srcdir "tofu/conflicting/"
+                                ,(in-srcdir "tests" "openpgp" "tofu" "conflicting"
                                             (string-append keyid ".gpg"))))
 	    (catch (fail "Missing key" keyid)
 		   (call-check `(, at 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 `(, at GPG --verify ,(in-srcdir "tofu/conflicting/1C005AF3-1.txt")))
+(call-check `(, at 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 `(, at GPG --verify ,(in-srcdir "tofu/conflicting/B662E42F-1.txt")))
+(call-check `(, at 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 `(, at GPG --verify ,(in-srcdir "tofu/conflicting/1C005AF3-1.txt")))
+(call-check `(, at 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 `(, at GPG --verify ,(in-srcdir "tofu/conflicting/1C005AF3-1.txt")))
+(call-check `(, at GPG --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "1C005AF3-1.txt")))
 (check-counts "1C005AF3" 1 1 0 0)
 
 ;; Verify another message.
-(call-check `(, at GPG --verify ,(in-srcdir "tofu/conflicting/1C005AF3-2.txt")))
+(call-check `(, at GPG --verify ,(in-srcdir "tests" "openpgp" "tofu" "conflicting" "1C005AF3-2.txt")))
 (check-counts "1C005AF3" 2 1 0 0)
 
 ;; Verify another message.
-(call-check `(, at GPG --verify ,(in-srcdir "tofu/conflicting/1C005AF3-3.txt")))
+(call-check `(, at 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 `(, at GPG --verify ,(in-srcdir "tofu/conflicting/BE04EB2B-1.txt")))
+(call-check `(, at 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 `(, at 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 `(, at 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 `(, at 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 `(, at 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 `(, at 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 `(, at GPG --verify ,fn))))
       (list "1" "2")))
    (list KEYIDA KEYIDB)))
 
 ;; Import the public keys.
 (display "    > Two keys. ")
-(call-check `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDA "-1.gpg"))))
-(call-check `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-1.gpg"))))
+(call-check `(, at GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDA "-1.gpg"))))
+(call-check `(, at 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 `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDA "-2.gpg"))))
-(call-check `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-2.gpg"))))
+(call-check `(, at GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDA "-2.gpg"))))
+(call-check `(, at 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 `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-3.gpg"))))
+(call-check `(, at 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 `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-4.gpg"))))
+(call-check `(, at 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 `(, at GPG --verify ,fn))))
       (list "1" "2")))
    (list KEYIDA KEYIDB)))
 
 ;; Import the public keys.
 (display "    > Two keys. ")
-(call-check `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDA "-1.gpg"))))
-(call-check `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-1.gpg"))))
+(call-check `(, at GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDA "-1.gpg"))))
+(call-check `(, at 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 `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDA "-2.gpg"))))
-(call-check `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-2.gpg"))))
+(call-check `(, at GPG --import ,(in-srcdir "tests" "openpgp" DIR (string-append KEYIDA "-2.gpg"))))
+(call-check `(, at 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 `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-3.gpg"))))
+(call-check `(, at 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 `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-4.gpg"))))
+(call-check `(, at 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 18851da..8bff9af 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 <http://www.gnu.org/licenses/>.
 
-(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 f1cbe99..9ebb672 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 <http://www.gnu.org/licenses/>.
 
-(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
 	 `(, at 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 d3bd763..cb6eb59 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 <http://www.gnu.org/licenses/>.
 
-(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 `(, at GPG --quiet --yes --import ,(in-srcdir key-file2)))
+(call-check `(, at 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 2b211d8..c2252c5 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 <http://www.gnu.org/licenses/>.
 
-(load (with-path "defs.scm"))
+(load (in-srcdir "tests" "openpgp" "defs.scm"))
 (setup-environment)
 
 (info "Printing the GPG version")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list