summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/builders.scm8
-rw-r--r--tests/derivations.scm219
-rw-r--r--tests/packages.scm38
-rw-r--r--tests/store.scm31
-rw-r--r--tests/union.scm2
5 files changed, 141 insertions, 157 deletions
diff --git a/tests/builders.scm b/tests/builders.scm
index 1e6b62ee6a..0ed5d74a22 100644
--- a/tests/builders.scm
+++ b/tests/builders.scm
@@ -70,10 +70,10 @@
                      "ftp://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz"))
          (hash     (nix-base32-string->bytevector
                     "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"))
-         (drv-path (url-fetch %store url 'sha256 hash
+         (drv      (url-fetch %store url 'sha256 hash
                               #:guile %bootstrap-guile))
-         (out-path (derivation-path->output-path drv-path)))
-    (and (build-derivations %store (list drv-path))
+         (out-path (derivation->output-path drv)))
+    (and (build-derivations %store (list drv))
          (file-exists? out-path)
          (valid-path? %store out-path))))
 
@@ -93,7 +93,7 @@
                               #:implicit-inputs? #f
                               #:guile %bootstrap-guile
                               #:search-paths %bootstrap-search-paths))
-         (out      (derivation-path->output-path build)))
+         (out      (derivation->output-path build)))
     (and (build-derivations %store (list (pk 'hello-drv build)))
          (valid-path? %store out)
          (file-exists? (string-append out "/bin/hello")))))
diff --git a/tests/derivations.scm b/tests/derivations.scm
index e69dd0db31..4756fb9cba 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -110,31 +110,27 @@
   (let* ((builder  (add-text-to-store %store "my-builder.sh"
                                       "echo hello, world\n"
                                       '()))
-         (drv-path (derivation %store "foo"
+         (drv      (derivation %store "foo"
                                %bash `("-e" ,builder)
                                #:env-vars '(("HOME" . "/homeless")))))
-    (and (store-path? drv-path)
-         (valid-path? %store drv-path))))
+    (and (store-path? (derivation-file-name drv))
+         (valid-path? %store (derivation-file-name drv)))))
 
 (test-assert "build derivation with 1 source"
-  (let*-values (((builder)
-                 (add-text-to-store %store "my-builder.sh"
-                                    "echo hello, world > \"$out\"\n"
-                                    '()))
-                ((drv-path drv)
-                 (derivation %store "foo"
-                             %bash `(,builder)
-                             #:env-vars '(("HOME" . "/homeless")
-                                          ("zzz"  . "Z!")
-                                          ("AAA"  . "A!"))
-                             #:inputs `((,builder))))
-                ((succeeded?)
-                 (build-derivations %store (list drv-path))))
+  (let* ((builder (add-text-to-store %store "my-builder.sh"
+                                     "echo hello, world > \"$out\"\n"
+                                     '()))
+         (drv     (derivation %store "foo"
+                              %bash `(,builder)
+                              #:env-vars '(("HOME" . "/homeless")
+                                           ("zzz"  . "Z!")
+                                           ("AAA"  . "A!"))
+                              #:inputs `((,builder))))
+         (succeeded?
+          (build-derivations %store (list drv))))
     (and succeeded?
-         (let ((path (derivation-output-path
-                      (assoc-ref (derivation-outputs drv) "out"))))
+         (let ((path (derivation->output-path drv)))
            (and (valid-path? %store path)
-                (string=? (derivation-file-name drv) drv-path)
                 (string=? (call-with-input-file path read-line)
                           "hello, world"))))))
 
@@ -146,7 +142,7 @@
          (input      (search-path %load-path "ice-9/boot-9.scm"))
          (input*     (add-to-store %store (basename input)
                                    #t "sha256" input))
-         (drv-path   (derivation %store "derivation-with-input-file"
+         (drv        (derivation %store "derivation-with-input-file"
                                  %bash `(,builder)
 
                                  ;; Cheat to pass the actual file name to the
@@ -155,22 +151,22 @@
 
                                  #:inputs `((,builder)
                                             (,input))))) ; ← local file name
-    (and (build-derivations %store (list drv-path))
+    (and (build-derivations %store (list drv))
          ;; Note: we can't compare the files because the above trick alters
          ;; the contents.
-         (valid-path? %store (derivation-path->output-path drv-path)))))
+         (valid-path? %store (derivation->output-path drv)))))
 
 (test-assert "fixed-output derivation"
   (let* ((builder    (add-text-to-store %store "my-fixed-builder.sh"
                                         "echo -n hello > $out" '()))
          (hash       (sha256 (string->utf8 "hello")))
-         (drv-path   (derivation %store "fixed"
+         (drv        (derivation %store "fixed"
                                  %bash `(,builder)
                                  #:inputs `((,builder)) ; optional
                                  #:hash hash #:hash-algo 'sha256))
-         (succeeded? (build-derivations %store (list drv-path))))
+         (succeeded? (build-derivations %store (list drv))))
     (and succeeded?
-         (let ((p (derivation-path->output-path drv-path)))
+         (let ((p (derivation->output-path drv)))
            (and (equal? (string->utf8 "hello")
                         (call-with-input-file p get-bytevector-all))
                 (bytevector? (query-path-hash %store p)))))))
@@ -181,17 +177,16 @@
          (builder2   (add-text-to-store %store "fixed-builder2.sh"
                                         "echo hey; echo -n hello > $out" '()))
          (hash       (sha256 (string->utf8 "hello")))
-         (drv-path1  (derivation %store "fixed"
+         (drv1       (derivation %store "fixed"
                                  %bash `(,builder1)
                                  #:hash hash #:hash-algo 'sha256))
-         (drv-path2  (derivation %store "fixed"
+         (drv2       (derivation %store "fixed"
                                  %bash `(,builder2)
                                  #:hash hash #:hash-algo 'sha256))
-         (succeeded? (build-derivations %store
-                                        (list drv-path1 drv-path2))))
+         (succeeded? (build-derivations %store (list drv1 drv2))))
     (and succeeded?
-         (equal? (derivation-path->output-path drv-path1)
-                 (derivation-path->output-path drv-path2)))))
+         (equal? (derivation->output-path drv1)
+                 (derivation->output-path drv2)))))
 
 (test-assert "derivation with a fixed-output input"
   ;; A derivation D using a fixed-output derivation F doesn't has the same
@@ -208,7 +203,7 @@
          (fixed2     (derivation %store "fixed"
                                  %bash `(,builder2)
                                  #:hash hash #:hash-algo 'sha256))
-         (fixed-out  (derivation-path->output-path fixed1))
+         (fixed-out  (derivation->output-path fixed1))
          (builder3   (add-text-to-store
                       %store "final-builder.sh"
                       ;; Use Bash hackery to avoid Coreutils.
@@ -224,26 +219,26 @@
          (succeeded? (build-derivations %store
                                         (list final1 final2))))
     (and succeeded?
-         (equal? (derivation-path->output-path final1)
-                 (derivation-path->output-path final2)))))
+         (equal? (derivation->output-path final1)
+                 (derivation->output-path final2)))))
 
 (test-assert "multiple-output derivation"
   (let* ((builder    (add-text-to-store %store "my-fixed-builder.sh"
                                         "echo one > $out ; echo two > $second"
                                         '()))
-         (drv-path   (derivation %store "fixed"
+         (drv        (derivation %store "fixed"
                                  %bash `(,builder)
                                  #:env-vars '(("HOME" . "/homeless")
                                               ("zzz"  . "Z!")
                                               ("AAA"  . "A!"))
                                  #:inputs `((,builder))
                                  #:outputs '("out" "second")))
-         (succeeded? (build-derivations %store (list drv-path))))
+         (succeeded? (build-derivations %store (list drv))))
     (and succeeded?
-         (let ((one (derivation-path->output-path drv-path "out"))
-               (two (derivation-path->output-path drv-path "second")))
+         (let ((one (derivation->output-path drv "out"))
+               (two (derivation->output-path drv "second")))
            (and (lset= equal?
-                       (derivation-path->output-paths drv-path)
+                       (derivation->output-paths drv)
                        `(("out" . ,one) ("second" . ,two)))
                 (eq? 'one (call-with-input-file one read))
                 (eq? 'two (call-with-input-file two read)))))))
@@ -254,14 +249,14 @@
   (let* ((builder    (add-text-to-store %store "my-fixed-builder.sh"
                                         "echo one > $out ; echo two > $AAA"
                                         '()))
-         (drv-path   (derivation %store "fixed"
+         (drv        (derivation %store "fixed"
                                  %bash `(,builder)
                                  #:inputs `((,builder))
                                  #:outputs '("out" "AAA")))
-         (succeeded? (build-derivations %store (list drv-path))))
+         (succeeded? (build-derivations %store (list drv))))
     (and succeeded?
-         (let ((one (derivation-path->output-path drv-path "out"))
-               (two (derivation-path->output-path drv-path "AAA")))
+         (let ((one (derivation->output-path drv "out"))
+               (two (derivation->output-path drv "AAA")))
            (and (eq? 'one (call-with-input-file one read))
                 (eq? 'two (call-with-input-file two read)))))))
 
@@ -283,17 +278,17 @@
          (udrv       (derivation %store "multiple-output-user"
                                  %bash `(,builder2)
                                  #:env-vars `(("one"
-                                               . ,(derivation-path->output-path
+                                               . ,(derivation->output-path
                                                    mdrv "out"))
                                               ("two"
-                                               . ,(derivation-path->output-path
+                                               . ,(derivation->output-path
                                                    mdrv "two")))
                                  #:inputs `((,builder2)
                                             ;; two occurrences of MDRV:
                                             (,mdrv)
                                             (,mdrv "two")))))
     (and (build-derivations %store (list (pk 'udrv udrv)))
-         (let ((p (derivation-path->output-path udrv)))
+         (let ((p (derivation->output-path udrv)))
            (and (valid-path? %store p)
                 (equal? '(one two) (call-with-input-file p read)))))))
 
@@ -318,7 +313,7 @@
                                 ("input1" . ,input1)
                                 ("input2" . ,input2))
                               #:inputs `((,%bash) (,builder))))
-         (out     (derivation-path->output-path drv)))
+         (out     (derivation->output-path drv)))
     (define (deps path . deps)
       (let ((count (length deps)))
         (string-append path "\n\n" (number->string count) "\n"
@@ -361,31 +356,30 @@
           (add-text-to-store %store "build-with-coreutils.sh"
                              "echo $PATH ; mkdir --version ; mkdir $out ; touch $out/good"
                              '()))
-         (drv-path
+         (drv
           (derivation %store "foo"
                       %bash `(,builder)
                       #:env-vars `(("PATH" .
                                     ,(string-append
-                                      (derivation-path->output-path %coreutils)
+                                      (derivation->output-path %coreutils)
                                       "/bin")))
                       #:inputs `((,builder)
                                  (,%coreutils))))
          (succeeded?
-          (build-derivations %store (list drv-path))))
+          (build-derivations %store (list drv))))
     (and succeeded?
-         (let ((p (derivation-path->output-path drv-path)))
+         (let ((p (derivation->output-path drv)))
            (and (valid-path? %store p)
                 (file-exists? (string-append p "/good")))))))
 
 (test-skip (if (%guile-for-build) 0 8))
 
 (test-assert "build-expression->derivation and derivation-prerequisites"
-  (let-values (((drv-path drv)
-                (build-expression->derivation %store "fail" (%current-system)
-                                              #f '())))
+  (let ((drv (build-expression->derivation %store "fail" (%current-system)
+                                           #f '())))
     (any (match-lambda
           (($ <derivation-input> path)
-           (string=? path (%guile-for-build))))
+           (string=? path (derivation-file-name (%guile-for-build)))))
          (derivation-prerequisites drv))))
 
 (test-assert "build-expression->derivation without inputs"
@@ -394,11 +388,11 @@
                         (call-with-output-file (string-append %output "/test")
                           (lambda (p)
                             (display '(hello guix) p)))))
-         (drv-path   (build-expression->derivation %store "goo" (%current-system)
+         (drv       (build-expression->derivation %store "goo" (%current-system)
                                                    builder '()))
-         (succeeded? (build-derivations %store (list drv-path))))
+         (succeeded? (build-derivations %store (list drv))))
     (and succeeded?
-         (let ((p (derivation-path->output-path drv-path)))
+         (let ((p (derivation->output-path drv)))
            (equal? '(hello guix)
                    (call-with-input-file (string-append p "/test") read))))))
 
@@ -407,43 +401,35 @@
                        (set-build-options s #:max-silent-time 1)
                        s))
          (builder    '(sleep 100))
-         (drv-path   (build-expression->derivation %store "silent"
+         (drv        (build-expression->derivation %store "silent"
                                                    (%current-system)
                                                    builder '()))
-         (out-path   (derivation-path->output-path drv-path)))
+         (out-path   (derivation->output-path drv)))
     (guard (c ((nix-protocol-error? c)
                (and (string-contains (nix-protocol-error-message c)
                                      "failed")
                     (not (valid-path? store out-path)))))
-      (build-derivations %store (list drv-path)))))
+      (build-derivations %store (list drv)))))
 
 (test-assert "build-expression->derivation and derivation-prerequisites-to-build"
-  (let-values (((drv-path drv)
-                (build-expression->derivation %store "fail" (%current-system)
-                                              #f '())))
+  (let ((drv (build-expression->derivation %store "fail" (%current-system)
+                                           #f '())))
     ;; The only direct dependency is (%guile-for-build) and it's already
     ;; built.
     (null? (derivation-prerequisites-to-build %store drv))))
 
 (test-assert "derivation-prerequisites-to-build when outputs already present"
-  (let*-values (((builder)
-                 '(begin (mkdir %output) #t))
-                ((input-drv-path input-drv)
-                 (build-expression->derivation %store "input"
-                                               (%current-system)
-                                               builder '()))
-                ((input-path)
-                 (derivation-output-path
-                  (assoc-ref (derivation-outputs input-drv)
-                             "out")))
-                ((drv-path drv)
-                 (build-expression->derivation %store "something"
-                                               (%current-system)
-                                               builder
-                                               `(("i" ,input-drv-path))))
-                ((output)
-                 (derivation-output-path
-                  (assoc-ref (derivation-outputs drv) "out"))))
+  (let* ((builder    '(begin (mkdir %output) #t))
+         (input-drv  (build-expression->derivation %store "input"
+                                                   (%current-system)
+                                                   builder '()))
+         (input-path (derivation-output-path
+                      (assoc-ref (derivation-outputs input-drv)
+                                 "out")))
+         (drv        (build-expression->derivation %store "something"
+                                                   (%current-system) builder
+                                                   `(("i" ,input-drv))))
+         (output     (derivation->output-path drv)))
     ;; Make sure these things are not already built.
     (when (valid-path? %store input-path)
       (delete-paths %store (list input-path)))
@@ -452,10 +438,10 @@
 
     (and (equal? (map derivation-input-path
                       (derivation-prerequisites-to-build %store drv))
-                 (list input-drv-path))
+                 (list (derivation-file-name input-drv)))
 
          ;; Build DRV and delete its input.
-         (build-derivations %store (list drv-path))
+         (build-derivations %store (list drv))
          (delete-paths %store (list input-path))
          (not (valid-path? %store input-path))
 
@@ -465,17 +451,12 @@
 
 (test-skip (if (getenv "GUIX_BINARY_SUBSTITUTE_URL") 0 1))
 (test-assert "derivation-prerequisites-to-build and substitutes"
-  (let*-values (((store)
-                 (open-connection))
-                ((drv-path drv)
-                 (build-expression->derivation store "prereq-subst"
+  (let* ((store  (open-connection))
+         (drv    (build-expression->derivation store "prereq-subst"
                                                (%current-system)
                                                (random 1000) '()))
-                ((output)
-                 (derivation-output-path
-                  (assoc-ref (derivation-outputs drv) "out")))
-                ((dir)
-                 (and=> (getenv "GUIX_BINARY_SUBSTITUTE_URL")
+         (output (derivation->output-path drv))
+         (dir    (and=> (getenv "GUIX_BINARY_SUBSTITUTE_URL")
                         (compose uri-path string->uri))))
     ;; Create fake substituter data, to be read by `substitute-binary'.
     (call-with-output-file (string-append dir "/nix-cache-info")
@@ -495,7 +476,8 @@ Deriver: ~a~%"
                 output                              ; StorePath
                 (string-append dir "/example.nar")  ; URL
                 (%current-system)                   ; System
-                (basename drv-path))))              ; Deriver
+                (basename
+                 (derivation-file-name drv)))))     ; Deriver
 
     (let-values (((build download)
                   (derivation-prerequisites-to-build store drv))
@@ -512,16 +494,16 @@ Deriver: ~a~%"
   (let* ((builder  '(begin
                       (mkdir %output)
                       #f))                        ; fail!
-         (drv-path (build-expression->derivation %store "fail" (%current-system)
+         (drv      (build-expression->derivation %store "fail" (%current-system)
                                                  builder '()))
-         (out-path (derivation-path->output-path drv-path)))
+         (out-path (derivation->output-path drv)))
     (guard (c ((nix-protocol-error? c)
                ;; Note that the output path may exist at this point, but it
                ;; is invalid.
                (and (string-match "build .* failed"
                                   (nix-protocol-error-message c))
                     (not (valid-path? %store out-path)))))
-      (build-derivations %store (list drv-path))
+      (build-derivations %store (list drv))
       #f)))
 
 (test-assert "build-expression->derivation with two outputs"
@@ -532,15 +514,15 @@ Deriver: ~a~%"
                         (call-with-output-file (assoc-ref %outputs "second")
                           (lambda (p)
                             (display '(world) p)))))
-         (drv-path   (build-expression->derivation %store "double"
+         (drv        (build-expression->derivation %store "double"
                                                    (%current-system)
                                                    builder '()
                                                    #:outputs '("out"
                                                                "second")))
-         (succeeded? (build-derivations %store (list drv-path))))
+         (succeeded? (build-derivations %store (list drv))))
     (and succeeded?
-         (let ((one (derivation-path->output-path drv-path))
-               (two (derivation-path->output-path drv-path "second")))
+         (let ((one (derivation->output-path drv))
+               (two (derivation->output-path drv "second")))
            (and (equal? '(hello) (call-with-input-file one read))
                 (equal? '(world) (call-with-input-file two read)))))))
 
@@ -553,12 +535,12 @@ Deriver: ~a~%"
                             (dup2 (port->fdes p) 1)
                             (execl (string-append cu "/bin/uname")
                                    "uname" "-a")))))
-         (drv-path   (build-expression->derivation %store "uname" (%current-system)
+         (drv        (build-expression->derivation %store "uname" (%current-system)
                                                    builder
                                                    `(("cu" ,%coreutils))))
-         (succeeded? (build-derivations %store (list drv-path))))
+         (succeeded? (build-derivations %store (list drv))))
     (and succeeded?
-         (let ((p (derivation-path->output-path drv-path)))
+         (let ((p (derivation->output-path drv)))
            (string-contains (call-with-input-file p read-line) "GNU")))))
 
 (test-assert "imported-files"
@@ -567,9 +549,9 @@ Deriver: ~a~%"
                                               "guix/derivations.scm"))
                      ("p/q"   . ,(search-path %load-path "guix.scm"))
                      ("p/z"   . ,(search-path %load-path "guix/store.scm"))))
-         (drv-path (imported-files %store files)))
-    (and (build-derivations %store (list drv-path))
-         (let ((dir (derivation-path->output-path drv-path)))
+         (drv      (imported-files %store files)))
+    (and (build-derivations %store (list drv))
+         (let ((dir (derivation->output-path drv)))
            (every (match-lambda
                    ((path . source)
                     (equal? (call-with-input-file (string-append dir "/" path)
@@ -584,14 +566,13 @@ Deriver: ~a~%"
                       (let ((out (assoc-ref %outputs "out")))
                         (mkdir-p (string-append out "/guile/guix/nix"))
                         #t)))
-         (drv-path (build-expression->derivation %store
-                                                 "test-with-modules"
+         (drv      (build-expression->derivation %store "test-with-modules"
                                                  (%current-system)
                                                  builder '()
                                                  #:modules
                                                  '((guix build utils)))))
-    (and (build-derivations %store (list drv-path))
-         (let* ((p (derivation-path->output-path drv-path))
+    (and (build-derivations %store (list drv))
+         (let* ((p (derivation->output-path drv))
                 (s (stat (string-append p "/guile/guix/nix"))))
            (eq? (stat:type s) 'directory)))))
 
@@ -615,9 +596,10 @@ Deriver: ~a~%"
                                                    #:hash-algo 'sha256))
          (succeeded? (build-derivations %store (list input1 input2))))
     (and succeeded?
-         (not (string=? input1 input2))
-         (string=? (derivation-path->output-path input1)
-                   (derivation-path->output-path input2)))))
+         (not (string=? (derivation-file-name input1)
+                        (derivation-file-name input2)))
+         (string=? (derivation->output-path input1)
+                   (derivation->output-path input2)))))
 
 (test-assert "build-expression->derivation with a fixed-output input"
   (let* ((builder1   '(call-with-output-file %output
@@ -649,8 +631,11 @@ Deriver: ~a~%"
                                                   (%current-system)
                                                   builder3
                                                   `(("input" ,input2)))))
-    (and (string=? (derivation-path->output-path final1)
-                   (derivation-path->output-path final2))
+    (and (string=? (derivation->output-path final1)
+                   (derivation->output-path final2))
+         (string=? (derivation->output-path final1)
+                   (derivation-path->output-path
+                    (derivation-file-name final1)))
          (build-derivations %store (list final1 final2)))))
 
 (test-assert "build-expression->derivation with #:references-graphs"
@@ -662,7 +647,7 @@ Deriver: ~a~%"
                                                 builder '()
                                                 #:references-graphs
                                                 `(("input" . ,input))))
-         (out     (derivation-path->output-path drv)))
+         (out     (derivation->output-path drv)))
     (define (deps path . deps)
       (let ((count (length deps)))
         (string-append path "\n\n" (number->string count) "\n"
diff --git a/tests/packages.scm b/tests/packages.scm
index 8619011f59..706739fb70 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -121,17 +121,16 @@
                                              (package-source package))))
     (string=? file source)))
 
-(test-assert "return values"
-  (let-values (((drv-path drv)
-                (package-derivation %store (dummy-package "p"))))
-    (and (derivation-path? drv-path)
-         (derivation? drv))))
+(test-assert "return value"
+  (let ((drv (package-derivation %store (dummy-package "p"))))
+    (and (derivation? drv)
+         (file-exists? (derivation-file-name drv)))))
 
 (test-assert "package-output"
   (let* ((package  (dummy-package "p"))
-         (drv-path (package-derivation %store package)))
-    (and (derivation-path? drv-path)
-         (string=? (derivation-path->output-path drv-path)
+         (drv      (package-derivation %store package)))
+    (and (derivation? drv)
+         (string=? (derivation->output-path drv)
                    (package-output %store package "out")))))
 
 (test-assert "trivial"
@@ -148,7 +147,7 @@
                        (display '(hello guix) p))))))))
          (d (package-derivation %store p)))
     (and (build-derivations %store (list d))
-         (let ((p (pk 'drv d (derivation-path->output-path d))))
+         (let ((p (pk 'drv d (derivation->output-path d))))
            (equal? '(hello guix)
                    (call-with-input-file (string-append p "/test") read))))))
 
@@ -164,7 +163,7 @@
               (inputs `(("input" ,i)))))
          (d (package-derivation %store p)))
     (and (build-derivations %store (list d))
-         (let ((p (pk 'drv d (derivation-path->output-path d))))
+         (let ((p (pk 'drv d (derivation->output-path d))))
            (equal? (call-with-input-file p get-bytevector-all)
                    (call-with-input-file i get-bytevector-all))))))
 
@@ -183,7 +182,7 @@
                                                           (%current-system)))))))
          (d (package-derivation %store p)))
     (and (build-derivations %store (list d))
-         (let ((p (pk 'drv d (derivation-path->output-path d))))
+         (let ((p (pk 'drv d (derivation->output-path d))))
            (eq? 'hello (call-with-input-file p read))))))
 
 (test-assert "search paths"
@@ -222,20 +221,17 @@
            (equal? x (collect (package-derivation %store c)))))))
 
 (test-assert "package-cross-derivation"
-  (let-values (((drv-path drv)
-                (package-cross-derivation %store (dummy-package "p")
-                                          "mips64el-linux-gnu")))
-    (and (derivation-path? drv-path)
-         (derivation? drv))))
+  (let ((drv (package-cross-derivation %store (dummy-package "p")
+                                       "mips64el-linux-gnu")))
+    (and (derivation? drv)
+         (file-exists? (derivation-file-name drv)))))
 
 (test-assert "package-cross-derivation, trivial-build-system"
   (let ((p (package (inherit (dummy-package "p"))
              (build-system trivial-build-system)
              (arguments '(#:builder (exit 1))))))
-    (let-values (((drv-path drv)
-                  (package-cross-derivation %store p "mips64el-linux-gnu")))
-      (and (derivation-path? drv-path)
-           (derivation? drv)))))
+    (let ((drv (package-cross-derivation %store p "mips64el-linux-gnu")))
+      (derivation? drv))))
 
 (test-assert "package-cross-derivation, no cross builder"
   (let* ((b (build-system (inherit trivial-build-system)
@@ -257,7 +253,7 @@
          (or (location? (package-location gnu-make))
              (not (package-location gnu-make)))
          (let* ((drv (package-derivation %store gnu-make))
-                (out (derivation-path->output-path drv)))
+                (out (derivation->output-path drv)))
            (and (build-derivations %store (list drv))
                 (file-exists? (string-append out "/bin/make")))))))
 
diff --git a/tests/store.scm b/tests/store.scm
index 0280713191..b5e0cb0eab 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -82,7 +82,7 @@
 ;;          (d1 (derivation %store "link"
 ;;                          "/bin/sh" `("-e" ,b)
 ;;                          #:inputs `((,b) (,p1))))
-;;          (p2 (derivation-path->output-path d1)))
+;;          (p2 (derivation->output-path d1)))
 ;;     (and (add-temp-root %store p2)
 ;;          (build-derivations %store (list d1))
 ;;          (valid-path? %store p1)
@@ -133,21 +133,21 @@
                         s `("-e" ,b)
                         #:env-vars `(("foo" . ,(random-text)))
                         #:inputs `((,b) (,s))))
-         (o (derivation-path->output-path d)))
+         (o (derivation->output-path d)))
     (and (build-derivations %store (list d))
-         (equal? (query-derivation-outputs %store d)
+         (equal? (query-derivation-outputs %store (derivation-file-name d))
                  (list o))
          (equal? (valid-derivers %store o)
-                 (list d)))))
+                 (list (derivation-file-name d))))))
 
 (test-assert "no substitutes"
   (let* ((s  (open-connection))
          (d1 (package-derivation s %bootstrap-guile (%current-system)))
          (d2 (package-derivation s %bootstrap-glibc (%current-system)))
-         (o  (map derivation-path->output-path (list d1 d2))))
+         (o  (map derivation->output-path (list d1 d2))))
     (set-build-options s #:use-substitutes? #f)
-    (and (not (has-substitutes? s d1))
-         (not (has-substitutes? s d2))
+    (and (not (has-substitutes? s (derivation-file-name d1)))
+         (not (has-substitutes? s (derivation-file-name d2)))
          (null? (substitutable-paths s o))
          (null? (substitutable-path-info s o)))))
 
@@ -156,7 +156,7 @@
 (test-assert "substitute query"
   (let* ((s   (open-connection))
          (d   (package-derivation s %bootstrap-guile (%current-system)))
-         (o   (derivation-path->output-path d))
+         (o   (derivation->output-path d))
          (dir (and=> (getenv "GUIX_BINARY_SUBSTITUTE_URL")
                      (compose uri-path string->uri))))
     ;; Create fake substituter data, to be read by `substitute-binary'.
@@ -177,7 +177,8 @@ Deriver: ~a~%"
                 o                                   ; StorePath
                 (string-append dir "/example.nar")  ; URL
                 (%current-system)                   ; System
-                (basename d))))                     ; Deriver
+                (basename
+                 (derivation-file-name d)))))       ; Deriver
 
     ;; Remove entry from the local cache.
     (false-if-exception
@@ -191,7 +192,7 @@ Deriver: ~a~%"
          (equal? (list o) (substitutable-paths s (list o)))
          (match (pk 'spi (substitutable-path-info s (list o)))
            (((? substitutable? s))
-            (and (equal? (substitutable-deriver s) d)
+            (and (string=? (substitutable-deriver s) (derivation-file-name d))
                  (null? (substitutable-references s))
                  (equal? (substitutable-nar-size s) 1234)))))))
 
@@ -207,7 +208,7 @@ Deriver: ~a~%"
                '()
                #:guile-for-build
                (package-derivation s %bootstrap-guile (%current-system))))
-         (o   (derivation-path->output-path d))
+         (o   (derivation->output-path d))
          (dir (and=> (getenv "GUIX_BINARY_SUBSTITUTE_URL")
                      (compose uri-path string->uri))))
     ;; Create fake substituter data, to be read by `substitute-binary'.
@@ -238,7 +239,8 @@ Deriver: ~a~%"
                   (compose bytevector->nix-base32-string sha256
                            get-bytevector-all))
                 (%current-system)                   ; System
-                (basename d))))                     ; Deriver
+                (basename
+                 (derivation-file-name d)))))       ; Deriver
 
     ;; Make sure we use `substitute-binary'.
     (set-build-options s #:use-substitutes? #t)
@@ -257,7 +259,7 @@ Deriver: ~a~%"
                '()
                #:guile-for-build
                (package-derivation s %bootstrap-guile (%current-system))))
-         (o   (derivation-path->output-path d))
+         (o   (derivation->output-path d))
          (dir (and=> (getenv "GUIX_BINARY_SUBSTITUTE_URL")
                      (compose uri-path string->uri))))
     ;; Create fake substituter data, to be read by `substitute-binary'.
@@ -279,7 +281,8 @@ Deriver: ~a~%"
                 o                                   ; StorePath
                 "does-not-exist.nar"                ; relative URL
                 (%current-system)                   ; System
-                (basename d))))                     ; Deriver
+                (basename
+                 (derivation-file-name d)))))       ; Deriver
 
     ;; Make sure we use `substitute-binary'.
     (set-build-options s #:use-substitutes? #t)
diff --git a/tests/union.scm b/tests/union.scm
index 6287cffc38..cb110c3b1e 100644
--- a/tests/union.scm
+++ b/tests/union.scm
@@ -108,7 +108,7 @@
                                         builder inputs
                                         #:modules '((guix build union)))))
     (and (build-derivations %store (list (pk 'drv drv)))
-         (with-directory-excursion (derivation-path->output-path drv)
+         (with-directory-excursion (derivation->output-path drv)
            (and (file-exists? "bin/touch")
                 (file-exists? "bin/gcc")
                 (file-exists? "bin/ld")