summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-07-01 15:37:58 +0200
committerLudovic Courtès <ludo@gnu.org>2012-07-02 01:35:39 +0200
commit4b1786aa2c2e21e5b0c439cf6ad91f157376af5e (patch)
tree9954de1a8f96a374a6210c1db8e40f608c49e4d1 /tests
parent062c6927adf60d369ae00f8e191168c0b19b093a (diff)
downloadguix-4b1786aa2c2e21e5b0c439cf6ad91f157376af5e.tar.gz
Fix `derivation-hash' for outputs not sorted alphabetically.
* guix/derivations.scm (derivation-hash): Reorder OUTPUTS.
* tests/derivations.scm ("multiple-output derivation, non-alphabetic
  order"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/derivations.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index b6bd4dab0d..cdb1942539 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -145,6 +145,24 @@
            (and (eq? 'one (call-with-input-file one read))
                 (eq? 'two (call-with-input-file two read)))))))
 
+(test-assert "multiple-output derivation, non-alphabetic order"
+  ;; Here, the outputs are not listed in alphabetic order.  Yet, the store
+  ;; path computation must reorder them first.
+  (let* ((builder    (add-text-to-store %store "my-fixed-builder.sh"
+                                        "echo one > $out ; echo two > $AAA"
+                                        '()))
+         (drv-path   (derivation %store "fixed" (%current-system)
+                                 "/bin/sh" `(,builder)
+                                 '()
+                                 `((,builder))
+                                 #:outputs '("out" "AAA")))
+         (succeeded? (build-derivations %store (list drv-path))))
+    (and succeeded?
+         (let ((one (derivation-path->output-path drv-path "out"))
+               (two (derivation-path->output-path drv-path "AAA")))
+           (and (eq? 'one (call-with-input-file one read))
+                (eq? 'two (call-with-input-file two read)))))))
+
 
 (define %coreutils
   (false-if-exception (nixpkgs-derivation "coreutils")))