profiles: Output in 'package->manifest-entry' defaults to "out".
[jackhill/guix/guix.git] / tests / derivations.scm
index 4d3b82f..d8553b2 100644 (file)
            (and (eq? 'one (call-with-input-file one read))
                 (eq? 'two (call-with-input-file two read)))))))
 
+(test-assert "read-derivation vs. derivation"
+  ;; Make sure 'derivation' and 'read-derivation' return objects that are
+  ;; identical.
+  (let* ((sources (unfold (cut >= <> 10)
+                          (lambda (n)
+                            (add-text-to-store %store
+                                               (format #f "input~a" n)
+                                               (random-text)))
+                          1+
+                          0))
+         (inputs  (map (lambda (file)
+                         (derivation %store "derivation-input"
+                                     %bash '()
+                                     #:inputs `((,%bash) (,file))))
+                       sources))
+         (builder (add-text-to-store %store "builder.sh"
+                                     "echo one > $one ; echo two > $two"
+                                     '()))
+         (drv     (derivation %store "derivation"
+                              %bash `(,builder)
+                              #:inputs `((,%bash) (,builder)
+                                         ,@(map list (append sources inputs)))
+                              #:outputs '("two" "one")))
+         (drv*    (call-with-input-file (derivation-file-name drv)
+                    read-derivation)))
+    (equal? drv* drv)))
+
 (test-assert "multiple-output derivation, derivation-path->output-path"
   (let* ((builder    (add-text-to-store %store "builder.sh"
                                         "echo one > $out ; echo two > $second"
 
 (test-skip (if (%guile-for-build) 0 8))
 
+(test-equal "build-expression->derivation and invalid module name"
+  '(file-search-error "guix/module/that/does/not/exist.scm")
+  (guard (c ((file-search-error? c)
+             (list 'file-search-error
+                   (file-search-error-file-name c))))
+    (build-expression->derivation %store "foo" #t
+                                  #:modules '((guix module that
+                                                    does not exist)))))
+
 (test-assert "build-expression->derivation and derivation-prerequisites"
   (let ((drv (build-expression->derivation %store "fail" #f)))
     (any (match-lambda
          (call-with-input-file out get-string-all))))
 
 (test-end)
-
-\f
-(exit (= (test-runner-fail-count (test-runner-current)) 0))