diff options
author | Mark H Weaver <mhw@netris.org> | 2019-08-22 15:53:27 -0400 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2019-08-22 15:53:27 -0400 |
commit | 893c2df00daa4e6dd6a7ff3813d7df5329877f9e (patch) | |
tree | acd0db459464acae47083b66d5ce12cc656e2f10 /tests/derivations.scm | |
parent | 04b9b7bb05aff4c41f46cd79aa7bc953ace16e86 (diff) | |
parent | 0ccc9a0f5bb89b239d56157ea66f8420fcec5ba6 (diff) |
Merge branch 'master' into core-updates
Diffstat (limited to 'tests/derivations.scm')
-rw-r--r-- | tests/derivations.scm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm index 36558fe1dd..56b2775248 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -409,6 +409,38 @@ (equal? (derivation->output-path final1) (derivation->output-path final2))))) +(test-assert "derivation with duplicate fixed-output inputs" + ;; Here we create a derivation that has two inputs, both of which are + ;; fixed-output leading to the same result. This test ensures the hash of + ;; that derivation is correctly computed, namely that duplicate inputs are + ;; coalesced. See <https://bugs.gnu.org/36777>. + (let* ((builder1 (add-text-to-store %store "fixed-builder1.sh" + "echo -n hello > $out" '())) + (builder2 (add-text-to-store %store "fixed-builder2.sh" + "echo hey; echo -n hello > $out" '())) + (hash (sha256 (string->utf8 "hello"))) + (fixed1 (derivation %store "fixed" + %bash `(,builder1) + #:hash hash #:hash-algo 'sha256)) + (fixed2 (derivation %store "fixed" + %bash `(,builder2) + #:hash hash #:hash-algo 'sha256)) + (builder3 (add-text-to-store %store "builder.sh" + "echo fake builder")) + (final (derivation %store "final" + %bash `(,builder3) + #:sources (list %bash builder3) + #:inputs (list (derivation-input fixed1) + (derivation-input fixed2))))) + (and (derivation? final) + (match (derivation-inputs final) + (((= derivation-input-derivation one) + (= derivation-input-derivation two)) + (and (not (string=? (derivation-file-name one) + (derivation-file-name two))) + (string=? (derivation->output-path one) + (derivation->output-path two)))))))) + (test-assert "multiple-output derivation" (let* ((builder (add-text-to-store %store "my-fixed-builder.sh" "echo one > $out ; echo two > $second" |