aboutsummaryrefslogtreecommitdiff
path: root/tests/store.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-12-14 15:33:00 +0100
committerLudovic Courtès <ludo@gnu.org>2020-12-19 23:25:01 +0100
commit3c799ccb98ba2ea4c19747306289586e42ae493b (patch)
tree57c315a10b40afe049e59edc5c6a47b403e556e8 /tests/store.scm
parent15cf28fbb4672b05a0a0f430dc496c7eada18794 (diff)
downloadguix-3c799ccb98ba2ea4c19747306289586e42ae493b.tar
guix-3c799ccb98ba2ea4c19747306289586e42ae493b.tar.gz
tests: Make sure substituted items are deduplicated.
* tests/store.scm ("substitute, deduplication"): New test.
Diffstat (limited to 'tests/store.scm')
-rw-r--r--tests/store.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/store.scm b/tests/store.scm
index 4dc125bcb9..c9a08ac690 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -718,6 +718,30 @@
(canonical-file? o)
(equal? c (call-with-input-file o get-string-all)))))))
+(test-assert "substitute, deduplication"
+ (with-store s
+ (let* ((c (random-text)) ; contents of the output
+ (g (package-derivation s %bootstrap-guile))
+ (d1 (build-expression->derivation s "substitute-me"
+ `(begin ,c (exit 1))
+ #:guile-for-build g))
+ (d2 (build-expression->derivation s "build-me"
+ `(call-with-output-file %output
+ (lambda (p)
+ (display ,c p)))
+ #:guile-for-build g))
+ (o1 (derivation->output-path d1))
+ (o2 (derivation->output-path d2)))
+ (with-derivation-substitute d1 c
+ (set-build-options s #:use-substitutes? #t
+ #:substitute-urls (%test-substitute-urls))
+ (and (has-substitutes? s o1)
+ (build-derivations s (list d2)) ;build
+ (build-derivations s (list d1)) ;substitute
+ (canonical-file? o1)
+ (equal? c (call-with-input-file o1 get-string-all))
+ (= (stat:ino (stat o1)) (stat:ino (stat o2))))))))
+
(test-assert "substitute + build-things with output path"
(with-store s
(let* ((c (random-text)) ;contents of the output