Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / tests / derivations.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (unsetenv "http_proxy")
20
21 (define-module (test-derivations)
22 #:use-module (guix derivations)
23 #:use-module (guix grafts)
24 #:use-module (guix store)
25 #:use-module (guix utils)
26 #:use-module (gcrypt hash)
27 #:use-module (guix base32)
28 #:use-module (guix tests)
29 #:use-module (guix tests http)
30 #:use-module ((guix packages) #:select (package-derivation base32))
31 #:use-module ((guix build utils) #:select (executable-file?))
32 #:use-module (gnu packages bootstrap)
33 #:use-module ((gnu packages guile) #:select (guile-1.8))
34 #:use-module (srfi srfi-1)
35 #:use-module (srfi srfi-11)
36 #:use-module (srfi srfi-26)
37 #:use-module (srfi srfi-34)
38 #:use-module (srfi srfi-64)
39 #:use-module (rnrs io ports)
40 #:use-module (rnrs bytevectors)
41 #:use-module (web uri)
42 #:use-module (ice-9 rdelim)
43 #:use-module (ice-9 regex)
44 #:use-module (ice-9 ftw)
45 #:use-module (ice-9 match))
46
47 (define %store
48 (open-connection-for-tests))
49
50 ;; Globally disable grafts because they can trigger early builds.
51 (%graft? #f)
52
53 (define (bootstrap-binary name)
54 (let ((bin (search-bootstrap-binary name (%current-system))))
55 (and %store
56 (add-to-store %store name #t "sha256" bin))))
57
58 (define %bash
59 (bootstrap-binary "bash"))
60 (define %mkdir
61 (bootstrap-binary "mkdir"))
62
63 (define* (directory-contents dir #:optional (slurp get-bytevector-all))
64 "Return an alist representing the contents of DIR."
65 (define prefix-len (string-length dir))
66 (sort (file-system-fold (const #t) ; enter?
67 (lambda (path stat result) ; leaf
68 (alist-cons (string-drop path prefix-len)
69 (call-with-input-file path slurp)
70 result))
71 (lambda (path stat result) result) ; down
72 (lambda (path stat result) result) ; up
73 (lambda (path stat result) result) ; skip
74 (lambda (path stat errno result) result) ; error
75 '()
76 dir)
77 (lambda (e1 e2)
78 (string<? (car e1) (car e2)))))
79
80 ;; Avoid collisions with other tests.
81 (%http-server-port 10500)
82
83 \f
84 (test-begin "derivations")
85
86 (test-assert "parse & export"
87 (let* ((f (search-path %load-path "tests/test.drv"))
88 (b1 (call-with-input-file f get-bytevector-all))
89 (d1 (read-derivation (open-bytevector-input-port b1)
90 identity))
91 (b2 (call-with-bytevector-output-port (cut write-derivation d1 <>)))
92 (d2 (read-derivation (open-bytevector-input-port b2)
93 identity)))
94 (and (equal? b1 b2)
95 (equal? d1 d2))))
96
97 (test-skip (if %store 0 12))
98
99 (test-assert "add-to-store, flat"
100 ;; Use 'readlink*' in case spec.scm is a symlink, as is the case when Guile
101 ;; was installed with Stow.
102 (let* ((file (readlink*
103 (search-path %load-path "language/tree-il/spec.scm")))
104 (drv (add-to-store %store "flat-test" #f "sha256" file)))
105 (and (eq? 'regular (stat:type (stat drv)))
106 (valid-path? %store drv)
107 (equal? (call-with-input-file file get-bytevector-all)
108 (call-with-input-file drv get-bytevector-all)))))
109
110 (test-assert "add-to-store, recursive"
111 (let* ((dir (dirname
112 (readlink* (search-path %load-path
113 "language/tree-il/spec.scm"))))
114 (drv (add-to-store %store "dir-tree-test" #t "sha256" dir)))
115 (and (eq? 'directory (stat:type (stat drv)))
116 (valid-path? %store drv)
117 (equal? (directory-contents dir)
118 (directory-contents drv)))))
119
120 (test-assert "derivation with no inputs"
121 (let* ((builder (add-text-to-store %store "my-builder.sh"
122 "echo hello, world\n"
123 '()))
124 (drv (derivation %store "foo"
125 %bash `("-e" ,builder)
126 #:env-vars '(("HOME" . "/homeless")))))
127 (and (store-path? (derivation-file-name drv))
128 (valid-path? %store (derivation-file-name drv)))))
129
130 (test-assert "build derivation with 1 source"
131 (let* ((builder (add-text-to-store %store "my-builder.sh"
132 "echo hello, world > \"$out\"\n"
133 '()))
134 (drv (derivation %store "foo"
135 %bash `(,builder)
136 #:env-vars '(("HOME" . "/homeless")
137 ("zzz" . "Z!")
138 ("AAA" . "A!"))
139 #:sources `(,%bash ,builder)))
140 (succeeded?
141 (build-derivations %store (list drv))))
142 (and succeeded?
143 (let ((path (derivation->output-path drv)))
144 (and (valid-path? %store path)
145 (string=? (call-with-input-file path read-line)
146 "hello, world"))))))
147
148 (test-assert "derivation fails but keep going"
149 ;; In keep-going mode, 'build-derivations' should fail because of D1, but it
150 ;; must return only after D2 has succeeded.
151 (with-store store
152 (let* ((d1 (derivation %store "fails"
153 %bash `("-c" "false")
154 #:sources (list %bash)))
155 (d2 (build-expression->derivation %store "sleep-then-succeed"
156 `(begin
157 ,(random-text)
158 ;; XXX: Hopefully that's long
159 ;; enough that D1 has already
160 ;; failed.
161 (sleep 2)
162 (mkdir %output)))))
163 (set-build-options %store
164 #:use-substitutes? #f
165 #:keep-going? #t)
166 (guard (c ((store-protocol-error? c)
167 (and (= 100 (store-protocol-error-status c))
168 (string-contains (store-protocol-error-message c)
169 (derivation-file-name d1))
170 (not (valid-path? %store (derivation->output-path d1)))
171 (valid-path? %store (derivation->output-path d2)))))
172 (build-derivations %store (list d1 d2))
173 #f))))
174
175 (test-assert "identical files are deduplicated"
176 (let* ((build1 (add-text-to-store %store "one.sh"
177 "echo hello, world > \"$out\"\n"
178 '()))
179 (build2 (add-text-to-store %store "two.sh"
180 "# Hey!\necho hello, world > \"$out\"\n"
181 '()))
182 (drv1 (derivation %store "foo"
183 %bash `(,build1)
184 #:sources `(,%bash ,build1)))
185 (drv2 (derivation %store "bar"
186 %bash `(,build2)
187 #:sources `(,%bash ,build2))))
188 (and (build-derivations %store (list drv1 drv2))
189 (let ((file1 (derivation->output-path drv1))
190 (file2 (derivation->output-path drv2)))
191 (and (valid-path? %store file1) (valid-path? %store file2)
192 (string=? (call-with-input-file file1 get-string-all)
193 "hello, world\n")
194 (= (stat:ino (lstat file1))
195 (stat:ino (lstat file2))))))))
196
197 (test-equal "built-in-builders"
198 '("download")
199 (built-in-builders %store))
200
201 (test-assert "unknown built-in builder"
202 (let ((drv (derivation %store "ohoh" "builtin:does-not-exist" '())))
203 (guard (c ((store-protocol-error? c)
204 (string-contains (store-protocol-error-message c) "failed")))
205 (build-derivations %store (list drv))
206 #f)))
207
208 (unless (http-server-can-listen?)
209 (test-skip 1))
210 (test-assert "'download' built-in builder"
211 (let ((text (random-text)))
212 (with-http-server 200 text
213 (let* ((drv (derivation %store "world"
214 "builtin:download" '()
215 #:env-vars `(("url"
216 . ,(object->string (%local-url))))
217 #:hash-algo 'sha256
218 #:hash (sha256 (string->utf8 text)))))
219 (and (build-derivations %store (list drv))
220 (string=? (call-with-input-file (derivation->output-path drv)
221 get-string-all)
222 text))))))
223
224 (unless (http-server-can-listen?)
225 (test-skip 1))
226 (test-assert "'download' built-in builder, invalid hash"
227 (with-http-server 200 "hello, world!"
228 (let* ((drv (derivation %store "world"
229 "builtin:download" '()
230 #:env-vars `(("url"
231 . ,(object->string (%local-url))))
232 #:hash-algo 'sha256
233 #:hash (sha256 (random-bytevector 100))))) ;wrong
234 (guard (c ((store-protocol-error? c)
235 (string-contains (store-protocol-error-message c) "failed")))
236 (build-derivations %store (list drv))
237 #f))))
238
239 (unless (http-server-can-listen?)
240 (test-skip 1))
241 (test-assert "'download' built-in builder, not found"
242 (with-http-server 404 "not found"
243 (let* ((drv (derivation %store "will-never-be-found"
244 "builtin:download" '()
245 #:env-vars `(("url"
246 . ,(object->string (%local-url))))
247 #:hash-algo 'sha256
248 #:hash (sha256 (random-bytevector 100)))))
249 (guard (c ((store-protocol-error? c)
250 (string-contains (store-protocol-error-message (pk c)) "failed")))
251 (build-derivations %store (list drv))
252 #f))))
253
254 (test-assert "'download' built-in builder, not fixed-output"
255 (let* ((source (add-text-to-store %store "hello" "hi!"))
256 (url (string-append "file://" source))
257 (drv (derivation %store "world"
258 "builtin:download" '()
259 #:env-vars `(("url" . ,(object->string url))))))
260 (guard (c ((store-protocol-error? c)
261 (string-contains (store-protocol-error-message c) "failed")))
262 (build-derivations %store (list drv))
263 #f)))
264
265 (unless (http-server-can-listen?)
266 (test-skip 1))
267 (test-assert "'download' built-in builder, check mode"
268 ;; Make sure rebuilding the 'builtin:download' derivation in check mode
269 ;; works. See <http://bugs.gnu.org/25089>.
270 (let* ((text (random-text))
271 (drv (derivation %store "world"
272 "builtin:download" '()
273 #:env-vars `(("url"
274 . ,(object->string (%local-url))))
275 #:hash-algo 'sha256
276 #:hash (sha256 (string->utf8 text)))))
277 (and (with-http-server 200 text
278 (build-derivations %store (list drv)))
279 (with-http-server 200 text
280 (build-derivations %store (list drv)
281 (build-mode check)))
282 (string=? (call-with-input-file (derivation->output-path drv)
283 get-string-all)
284 text))))
285
286 (test-equal "derivation-name"
287 "foo-0.0"
288 (let ((drv (derivation %store "foo-0.0" %bash '())))
289 (derivation-name drv)))
290
291 (test-equal "derivation-output-names"
292 '(("out") ("bar" "chbouib"))
293 (let ((drv1 (derivation %store "foo-0.0" %bash '()))
294 (drv2 (derivation %store "foo-0.0" %bash '()
295 #:outputs '("bar" "chbouib"))))
296 (list (derivation-output-names drv1)
297 (derivation-output-names drv2))))
298
299 (test-assert "offloadable-derivation?"
300 (and (offloadable-derivation? (derivation %store "foo" %bash '()))
301 (offloadable-derivation? ;see <http://bugs.gnu.org/18747>
302 (derivation %store "foo" %bash '()
303 #:substitutable? #f))
304 (not (offloadable-derivation?
305 (derivation %store "foo" %bash '()
306 #:local-build? #t)))))
307
308 (test-assert "substitutable-derivation?"
309 (and (substitutable-derivation? (derivation %store "foo" %bash '()))
310 (substitutable-derivation? ;see <http://bugs.gnu.org/18747>
311 (derivation %store "foo" %bash '()
312 #:local-build? #t))
313 (not (substitutable-derivation?
314 (derivation %store "foo" %bash '()
315 #:substitutable? #f)))))
316
317 (test-assert "fixed-output-derivation?"
318 (let* ((builder (add-text-to-store %store "my-fixed-builder.sh"
319 "echo -n hello > $out" '()))
320 (hash (sha256 (string->utf8 "hello")))
321 (drv (derivation %store "fixed"
322 %bash `(,builder)
323 #:sources (list builder)
324 #:hash hash #:hash-algo 'sha256)))
325 (fixed-output-derivation? drv)))
326
327 (test-assert "fixed-output derivation"
328 (let* ((builder (add-text-to-store %store "my-fixed-builder.sh"
329 "echo -n hello > $out" '()))
330 (hash (sha256 (string->utf8 "hello")))
331 (drv (derivation %store "fixed"
332 %bash `(,builder)
333 #:sources `(,builder) ;optional
334 #:hash hash #:hash-algo 'sha256))
335 (succeeded? (build-derivations %store (list drv))))
336 (and succeeded?
337 (let ((p (derivation->output-path drv)))
338 (and (equal? (string->utf8 "hello")
339 (call-with-input-file p get-bytevector-all))
340 (bytevector? (query-path-hash %store p)))))))
341
342 (test-assert "fixed-output derivation: output paths are equal"
343 (let* ((builder1 (add-text-to-store %store "fixed-builder1.sh"
344 "echo -n hello > $out" '()))
345 (builder2 (add-text-to-store %store "fixed-builder2.sh"
346 "echo hey; echo -n hello > $out" '()))
347 (hash (sha256 (string->utf8 "hello")))
348 (drv1 (derivation %store "fixed"
349 %bash `(,builder1)
350 #:hash hash #:hash-algo 'sha256))
351 (drv2 (derivation %store "fixed"
352 %bash `(,builder2)
353 #:hash hash #:hash-algo 'sha256))
354 (succeeded? (build-derivations %store (list drv1 drv2))))
355 (and succeeded?
356 (equal? (derivation->output-path drv1)
357 (derivation->output-path drv2)))))
358
359 (test-assert "fixed-output derivation, recursive"
360 (let* ((builder (add-text-to-store %store "my-fixed-builder.sh"
361 "echo -n hello > $out" '()))
362 (hash (sha256 (string->utf8 "hello")))
363 (drv (derivation %store "fixed-rec"
364 %bash `(,builder)
365 #:sources (list builder)
366 #:hash (base32 "0sg9f58l1jj88w6pdrfdpj5x9b1zrwszk84j81zvby36q9whhhqa")
367 #:hash-algo 'sha256
368 #:recursive? #t))
369 (succeeded? (build-derivations %store (list drv))))
370 (and succeeded?
371 (let ((p (derivation->output-path drv)))
372 (and (equal? (string->utf8 "hello")
373 (call-with-input-file p get-bytevector-all))
374 (bytevector? (query-path-hash %store p)))))))
375
376 (test-assert "derivation with a fixed-output input"
377 ;; A derivation D using a fixed-output derivation F doesn't has the same
378 ;; output path when passed F or F', as long as F and F' have the same output
379 ;; path.
380 (let* ((builder1 (add-text-to-store %store "fixed-builder1.sh"
381 "echo -n hello > $out" '()))
382 (builder2 (add-text-to-store %store "fixed-builder2.sh"
383 "echo hey; echo -n hello > $out" '()))
384 (hash (sha256 (string->utf8 "hello")))
385 (fixed1 (derivation %store "fixed"
386 %bash `(,builder1)
387 #:hash hash #:hash-algo 'sha256))
388 (fixed2 (derivation %store "fixed"
389 %bash `(,builder2)
390 #:hash hash #:hash-algo 'sha256))
391 (fixed-out (derivation->output-path fixed1))
392 (builder3 (add-text-to-store
393 %store "final-builder.sh"
394 ;; Use Bash hackery to avoid Coreutils.
395 "echo $in ; (read -u 3 c; echo $c) 3< $in > $out" '()))
396 (final1 (derivation %store "final"
397 %bash `(,builder3)
398 #:env-vars `(("in" . ,fixed-out))
399 #:sources (list %bash builder3)
400 #:inputs (list (derivation-input fixed1))))
401 (final2 (derivation %store "final"
402 %bash `(,builder3)
403 #:env-vars `(("in" . ,fixed-out))
404 #:sources (list %bash builder3)
405 #:inputs (list (derivation-input fixed2))))
406 (succeeded? (build-derivations %store
407 (list final1 final2))))
408 (and succeeded?
409 (equal? (derivation->output-path final1)
410 (derivation->output-path final2)))))
411
412 (test-assert "multiple-output derivation"
413 (let* ((builder (add-text-to-store %store "my-fixed-builder.sh"
414 "echo one > $out ; echo two > $second"
415 '()))
416 (drv (derivation %store "fixed"
417 %bash `(,builder)
418 #:env-vars '(("HOME" . "/homeless")
419 ("zzz" . "Z!")
420 ("AAA" . "A!"))
421 #:sources `(,%bash ,builder)
422 #:outputs '("out" "second")))
423 (succeeded? (build-derivations %store (list drv))))
424 (and succeeded?
425 (let ((one (derivation->output-path drv "out"))
426 (two (derivation->output-path drv "second")))
427 (and (lset= equal?
428 (derivation->output-paths drv)
429 `(("out" . ,one) ("second" . ,two)))
430 (eq? 'one (call-with-input-file one read))
431 (eq? 'two (call-with-input-file two read)))))))
432
433 (test-assert "multiple-output derivation, non-alphabetic order"
434 ;; Here, the outputs are not listed in alphabetic order. Yet, the store
435 ;; path computation must reorder them first.
436 (let* ((builder (add-text-to-store %store "my-fixed-builder.sh"
437 "echo one > $out ; echo two > $AAA"
438 '()))
439 (drv (derivation %store "fixed"
440 %bash `(,builder)
441 #:sources `(,%bash ,builder)
442 #:outputs '("out" "AAA")))
443 (succeeded? (build-derivations %store (list drv))))
444 (and succeeded?
445 (let ((one (derivation->output-path drv "out"))
446 (two (derivation->output-path drv "AAA")))
447 (and (eq? 'one (call-with-input-file one read))
448 (eq? 'two (call-with-input-file two read)))))))
449
450 (test-assert "read-derivation vs. derivation"
451 ;; Make sure 'derivation' and 'read-derivation' return objects that are
452 ;; identical.
453 (let* ((sources (unfold (cut >= <> 10)
454 (lambda (n)
455 (add-text-to-store %store
456 (format #f "input~a" n)
457 (random-text)))
458 1+
459 0))
460 (inputs (map (lambda (file)
461 (derivation %store "derivation-input"
462 %bash '()
463 #:sources `(,%bash ,file)))
464 sources))
465 (builder (add-text-to-store %store "builder.sh"
466 "echo one > $one ; echo two > $two"
467 '()))
468 (drv (derivation %store "derivation"
469 %bash `(,builder)
470 #:sources `(,%bash ,builder ,@sources)
471 #:inputs (map derivation-input inputs)
472 #:outputs '("two" "one")))
473 (drv* (call-with-input-file (derivation-file-name drv)
474 read-derivation)))
475 (equal? drv* drv)))
476
477 (test-assert "multiple-output derivation, derivation-path->output-path"
478 (let* ((builder (add-text-to-store %store "builder.sh"
479 "echo one > $out ; echo two > $second"
480 '()))
481 (drv (derivation %store "multiple"
482 %bash `(,builder)
483 #:outputs '("out" "second")))
484 (drv-file (derivation-file-name drv))
485 (one (derivation->output-path drv "out"))
486 (two (derivation->output-path drv "second"))
487 (first (derivation-path->output-path drv-file "out"))
488 (second (derivation-path->output-path drv-file "second")))
489 (and (not (string=? one two))
490 (string-suffix? "-second" two)
491 (string=? first one)
492 (string=? second two))))
493
494 (test-assert "user of multiple-output derivation"
495 ;; Check whether specifying several inputs coming from the same
496 ;; multiple-output derivation works.
497 (let* ((builder1 (add-text-to-store %store "my-mo-builder.sh"
498 "echo one > $out ; echo two > $two"
499 '()))
500 (mdrv (derivation %store "multiple-output"
501 %bash `(,builder1)
502 #:sources (list %bash builder1)
503 #:outputs '("out" "two")))
504 (builder2 (add-text-to-store %store "my-mo-user-builder.sh"
505 "read x < $one;
506 read y < $two;
507 echo \"($x $y)\" > $out"
508 '()))
509 (udrv (derivation %store "multiple-output-user"
510 %bash `(,builder2)
511 #:env-vars `(("one"
512 . ,(derivation->output-path
513 mdrv "out"))
514 ("two"
515 . ,(derivation->output-path
516 mdrv "two")))
517 #:sources (list %bash builder2)
518 ;; two occurrences of MDRV:
519 #:inputs
520 (list (derivation-input mdrv)
521 (derivation-input mdrv '("two"))))))
522 (and (build-derivations %store (list (pk 'udrv udrv)))
523 (let ((p (derivation->output-path udrv)))
524 (and (valid-path? %store p)
525 (equal? '(one two) (call-with-input-file p read)))))))
526
527 (test-assert "derivation with #:references-graphs"
528 (let* ((input1 (add-text-to-store %store "foo" "hello"
529 (list %bash)))
530 (input2 (add-text-to-store %store "bar"
531 (number->string (random 7777))
532 (list input1)))
533 (builder (add-text-to-store %store "build-graph"
534 (format #f "
535 ~a $out
536 (while read l ; do echo $l ; done) < bash > $out/bash
537 (while read l ; do echo $l ; done) < input1 > $out/input1
538 (while read l ; do echo $l ; done) < input2 > $out/input2"
539 %mkdir)
540 (list %mkdir)))
541 (drv (derivation %store "closure-graphs"
542 %bash `(,builder)
543 #:references-graphs
544 `(("bash" . ,%bash)
545 ("input1" . ,input1)
546 ("input2" . ,input2))
547 #:sources (list %bash builder)))
548 (out (derivation->output-path drv)))
549 (define (deps path . deps)
550 (let ((count (length deps)))
551 (string-append path "\n\n" (number->string count) "\n"
552 (string-join (sort deps string<?) "\n")
553 (if (zero? count) "" "\n"))))
554
555 (and (build-derivations %store (list drv))
556 (equal? (directory-contents out get-string-all)
557 `(("/bash" . ,(string-append %bash "\n\n0\n"))
558 ("/input1" . ,(if (string>? input1 %bash)
559 (string-append (deps %bash)
560 (deps input1 %bash))
561 (string-append (deps input1 %bash)
562 (deps %bash))))
563 ("/input2" . ,(string-concatenate
564 (map cdr
565 (sort
566 (map (lambda (p d)
567 (cons p (apply deps p d)))
568 (list %bash input1 input2)
569 (list '() (list %bash) (list input1)))
570 (lambda (x y)
571 (match x
572 ((p1 . _)
573 (match y
574 ((p2 . _)
575 (string<? p1 p2)))))))))))))))
576
577 (test-assert "derivation #:allowed-references, ok"
578 (let ((drv (derivation %store "allowed" %bash
579 '("-c" "echo hello > $out")
580 #:sources (list %bash)
581 #:allowed-references '())))
582 (build-derivations %store (list drv))))
583
584 (test-assert "derivation #:allowed-references, not allowed"
585 (let* ((txt (add-text-to-store %store "foo" "Hello, world."))
586 (drv (derivation %store "disallowed" %bash
587 `("-c" ,(string-append "echo " txt "> $out"))
588 #:sources (list %bash txt)
589 #:allowed-references '())))
590 (guard (c ((store-protocol-error? c)
591 ;; There's no specific error message to check for.
592 #t))
593 (build-derivations %store (list drv))
594 #f)))
595
596 (test-assert "derivation #:allowed-references, self allowed"
597 (let ((drv (derivation %store "allowed" %bash
598 '("-c" "echo $out > $out")
599 #:sources (list %bash)
600 #:allowed-references '("out"))))
601 (build-derivations %store (list drv))))
602
603 (test-assert "derivation #:allowed-references, self not allowed"
604 (let ((drv (derivation %store "disallowed" %bash
605 `("-c" ,"echo $out > $out")
606 #:sources (list %bash)
607 #:allowed-references '())))
608 (guard (c ((store-protocol-error? c)
609 ;; There's no specific error message to check for.
610 #t))
611 (build-derivations %store (list drv))
612 #f)))
613
614 (test-assert "derivation #:disallowed-references, ok"
615 (let ((drv (derivation %store "disallowed" %bash
616 '("-c" "echo hello > $out")
617 #:sources (list %bash)
618 #:disallowed-references '("out"))))
619 (build-derivations %store (list drv))))
620
621 (test-assert "derivation #:disallowed-references, not ok"
622 (let* ((txt (add-text-to-store %store "foo" "Hello, world."))
623 (drv (derivation %store "disdisallowed" %bash
624 `("-c" ,(string-append "echo " txt "> $out"))
625 #:sources (list %bash txt)
626 #:disallowed-references (list txt))))
627 (guard (c ((store-protocol-error? c)
628 ;; There's no specific error message to check for.
629 #t))
630 (build-derivations %store (list drv))
631 #f)))
632
633 ;; Here we should get the value of $GUIX_STATE_DIRECTORY that the daemon sees,
634 ;; which is a unique value for each test process; this value is the same as
635 ;; the one we see in the process executing this file since it is set by
636 ;; 'test-env'.
637 (test-equal "derivation #:leaked-env-vars"
638 (getenv "GUIX_STATE_DIRECTORY")
639 (let* ((value (getenv "GUIX_STATE_DIRECTORY"))
640 (drv (derivation %store "leaked-env-vars" %bash
641 '("-c" "echo -n $GUIX_STATE_DIRECTORY > $out")
642 #:hash (sha256 (string->utf8 value))
643 #:hash-algo 'sha256
644 #:sources (list %bash)
645 #:leaked-env-vars '("GUIX_STATE_DIRECTORY"))))
646 (and (build-derivations %store (list drv))
647 (call-with-input-file (derivation->output-path drv)
648 get-string-all))))
649
650 \f
651 (define %coreutils
652 (false-if-exception
653 (and (network-reachable?)
654 (package-derivation %store %bootstrap-coreutils&co))))
655
656 (test-skip (if %coreutils 0 1))
657
658 (test-assert "build derivation with coreutils"
659 (let* ((builder
660 (add-text-to-store %store "build-with-coreutils.sh"
661 "echo $PATH ; mkdir --version ; mkdir $out ; touch $out/good"
662 '()))
663 (drv
664 (derivation %store "foo"
665 %bash `(,builder)
666 #:env-vars `(("PATH" .
667 ,(string-append
668 (derivation->output-path %coreutils)
669 "/bin")))
670 #:sources (list builder)
671 #:inputs (list (derivation-input %coreutils))))
672 (succeeded?
673 (build-derivations %store (list drv))))
674 (and succeeded?
675 (let ((p (derivation->output-path drv)))
676 (and (valid-path? %store p)
677 (file-exists? (string-append p "/good")))))))
678
679 (test-skip (if (%guile-for-build) 0 8))
680
681 (test-equal "build-expression->derivation and invalid module name"
682 '(file-search-error "guix/module/that/does/not/exist.scm")
683 (guard (c ((file-search-error? c)
684 (list 'file-search-error
685 (file-search-error-file-name c))))
686 (build-expression->derivation %store "foo" #t
687 #:modules '((guix module that
688 does not exist)))))
689
690 (test-equal "build-expression->derivation and builder encoding"
691 '("UTF-8" #t)
692 (let* ((exp '(λ (α) (+ α 1)))
693 (drv (build-expression->derivation %store "foo" exp)))
694 (match (derivation-builder-arguments drv)
695 ((... builder)
696 (with-fluids ((%default-port-encoding "UTF-8"))
697 (call-with-input-file builder
698 (lambda (port)
699 (list (port-encoding port)
700 (->bool
701 (string-contains (get-string-all port)
702 "(λ (α) (+ α 1))"))))))))))
703
704 (test-assert "build-expression->derivation and derivation-prerequisites"
705 (let ((drv (build-expression->derivation %store "fail" #f)))
706 (any (match-lambda
707 (($ <derivation-input> (= derivation-file-name path))
708 (string=? path (derivation-file-name (%guile-for-build)))))
709 (derivation-prerequisites drv))))
710
711 (test-assert "derivation-prerequisites and valid-derivation-input?"
712 (let* ((a (build-expression->derivation %store "a" '(mkdir %output)))
713 (b (build-expression->derivation %store "b" `(list ,(random-text))))
714 (c (build-expression->derivation %store "c" `(mkdir %output)
715 #:inputs `(("a" ,a) ("b" ,b)))))
716 ;; Make sure both A and %BOOTSTRAP-GUILE are built (the latter could have
717 ;; be removed by tests/guix-gc.sh.)
718 (build-derivations %store
719 (list a (package-derivation %store %bootstrap-guile)))
720
721 (match (derivation-prerequisites c
722 (cut valid-derivation-input? %store
723 <>))
724 ((($ <derivation-input> (= derivation-file-name file) ("out")))
725 (string=? file (derivation-file-name b)))
726 (x
727 (pk 'fail x #f)))))
728
729 (test-assert "build-expression->derivation without inputs"
730 (let* ((builder '(begin
731 (mkdir %output)
732 (call-with-output-file (string-append %output "/test")
733 (lambda (p)
734 (display '(hello guix) p)))))
735 (drv (build-expression->derivation %store "goo" builder))
736 (succeeded? (build-derivations %store (list drv))))
737 (and succeeded?
738 (let ((p (derivation->output-path drv)))
739 (equal? '(hello guix)
740 (call-with-input-file (string-append p "/test") read))))))
741
742 (test-assert "build-expression->derivation and max-silent-time"
743 (let* ((store (let ((s (open-connection)))
744 (set-build-options s #:max-silent-time 1)
745 s))
746 (builder '(begin (sleep 100) (mkdir %output) #t))
747 (drv (build-expression->derivation store "silent" builder))
748 (out-path (derivation->output-path drv)))
749 (guard (c ((store-protocol-error? c)
750 (and (string-contains (store-protocol-error-message c)
751 "failed")
752 (not (valid-path? store out-path)))))
753 (build-derivations store (list drv))
754 #f)))
755
756 (test-assert "build-expression->derivation and timeout"
757 (let* ((store (let ((s (open-connection)))
758 (set-build-options s #:timeout 1)
759 s))
760 (builder '(begin (sleep 100) (mkdir %output) #t))
761 (drv (build-expression->derivation store "slow" builder))
762 (out-path (derivation->output-path drv)))
763 (guard (c ((store-protocol-error? c)
764 (and (string-contains (store-protocol-error-message c)
765 "failed")
766 (not (valid-path? store out-path)))))
767 (build-derivations store (list drv))
768 #f)))
769
770 (test-assert "build-derivations with specific output"
771 (with-store store
772 (let* ((content (random-text)) ;contents of the output
773 (drv (build-expression->derivation
774 store "substitute-me"
775 `(begin ,content (exit 1)) ;would fail
776 #:outputs '("out" "one" "two")
777 #:guile-for-build
778 (package-derivation store %bootstrap-guile)))
779 (out (derivation->output-path drv)))
780 (with-derivation-substitute drv content
781 (set-build-options store #:use-substitutes? #t
782 #:substitute-urls (%test-substitute-urls))
783 (and (has-substitutes? store out)
784
785 ;; Ask for nothing but the "out" output of DRV.
786 (build-derivations store `((,drv . "out")))
787
788 ;; Synonymous:
789 (build-derivations store (list (derivation-input drv '("out"))))
790
791 (valid-path? store out)
792 (equal? (pk 'x content)
793 (pk 'y (call-with-input-file out get-string-all))))))))
794
795 (test-assert "build-expression->derivation and derivation-build-plan"
796 (let ((drv (build-expression->derivation %store "fail" #f)))
797 ;; The only direct dependency is (%guile-for-build) and it's already
798 ;; built.
799 (null? (derivation-build-plan %store (derivation-inputs drv)))))
800
801 (test-assert "derivation-build-plan when outputs already present"
802 (let* ((builder `(begin ,(random-text) (mkdir %output) #t))
803 (input-drv (build-expression->derivation %store "input" builder))
804 (input-path (derivation->output-path input-drv))
805 (drv (build-expression->derivation %store "something" builder
806 #:inputs
807 `(("i" ,input-drv))))
808 (output (derivation->output-path drv)))
809 ;; Assume these things are not already built.
810 (when (or (valid-path? %store input-path)
811 (valid-path? %store output))
812 (error "things already built" input-drv))
813
814 (and (lset= equal?
815 (map derivation-file-name
816 (derivation-build-plan %store
817 (list (derivation-input drv))))
818 (list (derivation-file-name input-drv)
819 (derivation-file-name drv)))
820
821 ;; Build DRV and delete its input.
822 (build-derivations %store (list drv))
823 (delete-paths %store (list input-path))
824 (not (valid-path? %store input-path))
825
826 ;; Now INPUT-PATH is missing, yet it shouldn't be listed as a
827 ;; prerequisite to build because DRV itself is already built.
828 (null? (derivation-build-plan %store
829 (list (derivation-input drv)))))))
830
831 (test-assert "derivation-build-plan and substitutes"
832 (let* ((store (open-connection))
833 (drv (build-expression->derivation store "prereq-subst"
834 (random 1000)))
835 (output (derivation->output-path drv)))
836
837 ;; Make sure substitutes are usable.
838 (set-build-options store #:use-substitutes? #t
839 #:substitute-urls (%test-substitute-urls))
840
841 (with-derivation-narinfo drv
842 (let-values (((build download)
843 (derivation-build-plan store
844 (list (derivation-input drv))))
845 ((build* download*)
846 (derivation-build-plan store
847 (list (derivation-input drv))
848 #:substitutable-info
849 (const #f))))
850 (and (null? build)
851 (equal? (map substitutable-path download) (list output))
852 (null? download*)
853 (equal? (list drv) build*))))))
854
855 (test-assert "derivation-build-plan and substitutes, non-substitutable build"
856 (let* ((store (open-connection))
857 (drv (build-expression->derivation store "prereq-no-subst"
858 (random 1000)
859 #:substitutable? #f))
860 (output (derivation->output-path drv)))
861
862 ;; Make sure substitutes are usable.
863 (set-build-options store #:use-substitutes? #t
864 #:substitute-urls (%test-substitute-urls))
865
866 (with-derivation-narinfo drv
867 (let-values (((build download)
868 (derivation-build-plan store
869 (list (derivation-input drv)))))
870 ;; Despite being available as a substitute, DRV will be built locally
871 ;; due to #:substitutable? #f.
872 (and (null? download)
873 (match build
874 (((= derivation-file-name build))
875 (string=? build (derivation-file-name drv)))))))))
876
877 (test-assert "derivation-build-plan and substitutes, non-substitutable dep"
878 (with-store store
879 (let* ((drv1 (build-expression->derivation store "prereq-no-subst"
880 (random 1000)
881 #:substitutable? #f))
882 (drv2 (build-expression->derivation store "substitutable"
883 (random 1000)
884 #:inputs `(("dep" ,drv1)))))
885
886 ;; Make sure substitutes are usable.
887 (set-build-options store #:use-substitutes? #t
888 #:substitute-urls (%test-substitute-urls))
889
890 (with-derivation-narinfo drv2
891 (sha256 => (make-bytevector 32 0))
892 (references => (list (derivation->output-path drv1)))
893
894 (let-values (((build download)
895 (derivation-build-plan store
896 (list (derivation-input drv2)))))
897 ;; Although DRV2 is available as a substitute, we must build its
898 ;; dependency, DRV1, due to #:substitutable? #f.
899 (and (match download
900 (((= substitutable-path item))
901 (string=? item (derivation->output-path drv2))))
902 (match build
903 (((= derivation-file-name build))
904 (string=? build (derivation-file-name drv1))))))))))
905
906 (test-assert "derivation-build-plan and substitutes, local build"
907 (with-store store
908 (let* ((drv (build-expression->derivation store "prereq-subst-local"
909 (random 1000)
910 #:local-build? #t))
911 (output (derivation->output-path drv)))
912
913 ;; Make sure substitutes are usable.
914 (set-build-options store #:use-substitutes? #t
915 #:substitute-urls (%test-substitute-urls))
916
917 (with-derivation-narinfo drv
918 (let-values (((build download)
919 (derivation-build-plan store
920 (list (derivation-input drv)))))
921 ;; #:local-build? is *not* synonymous with #:substitutable?, so we
922 ;; must be able to substitute DRV's output.
923 ;; See <http://bugs.gnu.org/18747>.
924 (and (null? build)
925 (match download
926 (((= substitutable-path item))
927 (string=? item (derivation->output-path drv))))))))))
928
929 (test-assert "derivation-build-plan in 'check' mode"
930 (with-store store
931 (let* ((dep (build-expression->derivation store "dep"
932 `(begin ,(random-text)
933 (mkdir %output))))
934 (drv (build-expression->derivation store "to-check"
935 '(mkdir %output)
936 #:inputs `(("dep" ,dep)))))
937 (build-derivations store (list drv))
938 (delete-paths store (list (derivation->output-path dep)))
939
940 ;; In 'check' mode, DEP must be rebuilt.
941 (and (null? (derivation-build-plan store
942 (list (derivation-input drv))))
943 (lset= equal?
944 (derivation-build-plan store
945 (list (derivation-input drv))
946 #:mode (build-mode check))
947 (list drv dep))))))
948
949 (test-assert "substitution-oracle and #:substitute? #f"
950 (with-store store
951 (let* ((dep (build-expression->derivation store "dep"
952 `(begin ,(random-text)
953 (mkdir %output))))
954 (drv (build-expression->derivation store "not-subst"
955 `(begin ,(random-text)
956 (mkdir %output))
957 #:substitutable? #f
958 #:inputs `(("dep" ,dep))))
959 (query #f))
960 (define (record-substitutable-path-query store paths)
961 (when query
962 (error "already called!" query))
963 (set! query paths)
964 '())
965
966 (mock ((guix store) substitutable-path-info
967 record-substitutable-path-query)
968
969 (let ((pred (substitution-oracle store (list drv))))
970 (pred (derivation->output-path drv))))
971
972 ;; Make sure the oracle didn't try to get substitute info for DRV since
973 ;; DRV is mark as non-substitutable. Assume that GUILE-FOR-BUILD is
974 ;; already in store and thus not part of QUERY.
975 (equal? (pk 'query query)
976 (list (derivation->output-path dep))))))
977
978 (test-assert "build-expression->derivation with expression returning #f"
979 (let* ((builder '(begin
980 (mkdir %output)
981 #f)) ; fail!
982 (drv (build-expression->derivation %store "fail" builder))
983 (out-path (derivation->output-path drv)))
984 (guard (c ((store-protocol-error? c)
985 ;; Note that the output path may exist at this point, but it
986 ;; is invalid.
987 (and (string-match "build .* failed"
988 (store-protocol-error-message c))
989 (not (valid-path? %store out-path)))))
990 (build-derivations %store (list drv))
991 #f)))
992
993 (test-assert "build-expression->derivation with two outputs"
994 (let* ((builder '(begin
995 (call-with-output-file (assoc-ref %outputs "out")
996 (lambda (p)
997 (display '(hello) p)))
998 (call-with-output-file (assoc-ref %outputs "second")
999 (lambda (p)
1000 (display '(world) p)))))
1001 (drv (build-expression->derivation %store "double" builder
1002 #:outputs '("out"
1003 "second")))
1004 (succeeded? (build-derivations %store (list drv))))
1005 (and succeeded?
1006 (let ((one (derivation->output-path drv))
1007 (two (derivation->output-path drv "second")))
1008 (and (equal? '(hello) (call-with-input-file one read))
1009 (equal? '(world) (call-with-input-file two read)))))))
1010
1011 (test-skip (if %coreutils 0 1))
1012 (test-assert "build-expression->derivation with one input"
1013 (let* ((builder '(call-with-output-file %output
1014 (lambda (p)
1015 (let ((cu (assoc-ref %build-inputs "cu")))
1016 (close 1)
1017 (dup2 (port->fdes p) 1)
1018 (execl (string-append cu "/bin/uname")
1019 "uname" "-a")))))
1020 (drv (build-expression->derivation %store "uname" builder
1021 #:inputs
1022 `(("cu" ,%coreutils))))
1023 (succeeded? (build-derivations %store (list drv))))
1024 (and succeeded?
1025 (let ((p (derivation->output-path drv)))
1026 (string-contains (call-with-input-file p read-line) "GNU")))))
1027
1028 (test-assert "build-expression->derivation with modules"
1029 (let* ((builder `(begin
1030 (use-modules (guix build utils))
1031 (let ((out (assoc-ref %outputs "out")))
1032 (mkdir-p (string-append out "/guile/guix/nix"))
1033 #t)))
1034 (drv (build-expression->derivation %store "test-with-modules"
1035 builder
1036 #:modules
1037 '((guix build utils)))))
1038 (and (build-derivations %store (list drv))
1039 (let* ((p (derivation->output-path drv))
1040 (s (stat (string-append p "/guile/guix/nix"))))
1041 (eq? (stat:type s) 'directory)))))
1042
1043 (test-assert "build-expression->derivation: same fixed-output path"
1044 (let* ((builder1 '(call-with-output-file %output
1045 (lambda (p)
1046 (write "hello" p))))
1047 (builder2 '(call-with-output-file (pk 'difference-here! %output)
1048 (lambda (p)
1049 (write "hello" p))))
1050 (hash (sha256 (string->utf8 "hello")))
1051 (input1 (build-expression->derivation %store "fixed" builder1
1052 #:hash hash
1053 #:hash-algo 'sha256))
1054 (input2 (build-expression->derivation %store "fixed" builder2
1055 #:hash hash
1056 #:hash-algo 'sha256))
1057 (succeeded? (build-derivations %store (list input1 input2))))
1058 (and succeeded?
1059 (not (string=? (derivation-file-name input1)
1060 (derivation-file-name input2)))
1061 (string=? (derivation->output-path input1)
1062 (derivation->output-path input2)))))
1063
1064 (test-assert "build-expression->derivation with a fixed-output input"
1065 (let* ((builder1 '(call-with-output-file %output
1066 (lambda (p)
1067 (write "hello" p))))
1068 (builder2 '(call-with-output-file (pk 'difference-here! %output)
1069 (lambda (p)
1070 (write "hello" p))))
1071 (hash (sha256 (string->utf8 "hello")))
1072 (input1 (build-expression->derivation %store "fixed" builder1
1073 #:hash hash
1074 #:hash-algo 'sha256))
1075 (input2 (build-expression->derivation %store "fixed" builder2
1076 #:hash hash
1077 #:hash-algo 'sha256))
1078 (builder3 '(let ((input (assoc-ref %build-inputs "input")))
1079 (call-with-output-file %output
1080 (lambda (out)
1081 (format #f "My input is ~a.~%" input)))))
1082 (final1 (build-expression->derivation %store "final" builder3
1083 #:inputs
1084 `(("input" ,input1))))
1085 (final2 (build-expression->derivation %store "final" builder3
1086 #:inputs
1087 `(("input" ,input2)))))
1088 (and (string=? (derivation->output-path final1)
1089 (derivation->output-path final2))
1090 (string=? (derivation->output-path final1)
1091 (derivation-path->output-path
1092 (derivation-file-name final1)))
1093 (build-derivations %store (list final1 final2)))))
1094
1095 (test-assert "build-expression->derivation produces recursive fixed-output"
1096 (let* ((builder '(begin
1097 (use-modules (srfi srfi-26))
1098 (mkdir %output)
1099 (chdir %output)
1100 (call-with-output-file "exe"
1101 (cut display "executable" <>))
1102 (chmod "exe" #o777)
1103 (symlink "exe" "symlink")
1104 (mkdir "subdir")))
1105 (drv (build-expression->derivation %store "fixed-rec" builder
1106 #:hash-algo 'sha256
1107 #:hash (base32
1108 "10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p")
1109 #:recursive? #t)))
1110 (and (build-derivations %store (list drv))
1111 (let* ((dir (derivation->output-path drv))
1112 (exe (string-append dir "/exe"))
1113 (link (string-append dir "/symlink"))
1114 (subdir (string-append dir "/subdir")))
1115 (and (executable-file? exe)
1116 (string=? "executable"
1117 (call-with-input-file exe get-string-all))
1118 (string=? "exe" (readlink link))
1119 (file-is-directory? subdir))))))
1120
1121 (test-assert "build-expression->derivation uses recursive fixed-output"
1122 (let* ((builder '(call-with-output-file %output
1123 (lambda (port)
1124 (display "hello" port))))
1125 (fixed (build-expression->derivation %store "small-fixed-rec"
1126 builder
1127 #:hash-algo 'sha256
1128 #:hash (base32
1129 "0sg9f58l1jj88w6pdrfdpj5x9b1zrwszk84j81zvby36q9whhhqa")
1130 #:recursive? #t))
1131 (in (derivation->output-path fixed))
1132 (builder `(begin
1133 (mkdir %output)
1134 (chdir %output)
1135 (symlink ,in "symlink")))
1136 (drv (build-expression->derivation %store "fixed-rec-user"
1137 builder
1138 #:inputs `(("fixed" ,fixed)))))
1139 (and (build-derivations %store (list drv))
1140 (let ((out (derivation->output-path drv)))
1141 (string=? (readlink (string-append out "/symlink")) in)))))
1142
1143 (test-assert "build-expression->derivation with #:references-graphs"
1144 (let* ((input (add-text-to-store %store "foo" "hello"
1145 (list %bash %mkdir)))
1146 (builder '(copy-file "input" %output))
1147 (drv (build-expression->derivation %store "references-graphs"
1148 builder
1149 #:references-graphs
1150 `(("input" . ,input))))
1151 (out (derivation->output-path drv)))
1152 (define (deps path . deps)
1153 (let ((count (length deps)))
1154 (string-append path "\n\n" (number->string count) "\n"
1155 (string-join (sort deps string<?) "\n")
1156 (if (zero? count) "" "\n"))))
1157
1158 (and (build-derivations %store (list drv))
1159 (equal? (call-with-input-file out get-string-all)
1160 (string-concatenate
1161 (map cdr
1162 (sort (map (lambda (p d)
1163 (cons p (apply deps p d)))
1164 (list input %bash %mkdir)
1165 (list (list %bash %mkdir)
1166 '() '()))
1167 (lambda (x y)
1168 (match x
1169 ((p1 . _)
1170 (match y
1171 ((p2 . _)
1172 (string<? p1 p2)))))))))))))
1173
1174 (test-equal "derivation-properties"
1175 (list '() '((type . test)))
1176 (let ((drv1 (build-expression->derivation %store "bar"
1177 '(mkdir %output)))
1178 (drv2 (build-expression->derivation %store "foo"
1179 '(mkdir %output)
1180 #:properties '((type . test)))))
1181 (list (derivation-properties drv1)
1182 (derivation-properties drv2))))
1183
1184 (test-equal "map-derivation"
1185 "hello"
1186 (let* ((joke (package-derivation %store guile-1.8))
1187 (good (package-derivation %store %bootstrap-guile))
1188 (drv1 (build-expression->derivation %store "original-drv1"
1189 #f ; systematically fail
1190 #:guile-for-build joke))
1191 (drv2 (build-expression->derivation %store "original-drv2"
1192 '(call-with-output-file %output
1193 (lambda (p)
1194 (display "hello" p)))))
1195 (drv3 (build-expression->derivation %store "drv-to-remap"
1196 '(let ((in (assoc-ref
1197 %build-inputs "in")))
1198 (copy-file in %output))
1199 #:inputs `(("in" ,drv1))
1200 #:guile-for-build joke))
1201 (drv4 (map-derivation %store drv3 `((,drv1 . ,drv2)
1202 (,joke . ,good))))
1203 (out (derivation->output-path drv4)))
1204 (and (build-derivations %store (list (pk 'remapped drv4)))
1205 (call-with-input-file out get-string-all))))
1206
1207 (test-equal "map-derivation, sources"
1208 "hello"
1209 (let* ((script1 (add-text-to-store %store "fail.sh" "exit 1"))
1210 (script2 (add-text-to-store %store "hi.sh" "echo -n hello > $out"))
1211 (bash-full (package-derivation %store (@ (gnu packages bash) bash)))
1212 (drv1 (derivation %store "drv-to-remap"
1213
1214 ;; XXX: This wouldn't work in practice, but if
1215 ;; we append "/bin/bash" then we can't replace
1216 ;; it with the bootstrap bash, which is a
1217 ;; single file.
1218 (derivation->output-path bash-full)
1219
1220 `("-e" ,script1)
1221 #:sources (list script1)
1222 #:inputs
1223 (list (derivation-input bash-full '("out")))))
1224 (drv2 (map-derivation %store drv1
1225 `((,bash-full . ,%bash)
1226 (,script1 . ,script2))))
1227 (out (derivation->output-path drv2)))
1228 (and (build-derivations %store (list (pk 'remapped* drv2)))
1229 (call-with-input-file out get-string-all))))
1230
1231 (test-end)
1232
1233 ;; Local Variables:
1234 ;; eval: (put 'with-http-server 'scheme-indent-function 2)
1235 ;; End: