test-name: parse & export location: /home/rsd/v/git/others/guix/tests/derivations.scm:81 source: + (test-assert + "parse & export" + (let* ((f (search-path %load-path "tests/test.drv")) + (b1 (call-with-input-file f get-bytevector-all)) + (d1 (read-derivation (open-bytevector-input-port b1))) + (b2 (call-with-bytevector-output-port + (cut write-derivation d1 <>))) + (d2 (read-derivation (open-bytevector-input-port b2)))) + (and (equal? b1 b2) (equal? d1 d2)))) actual-value: #t result: PASS test-name: add-to-store, flat location: /home/rsd/v/git/others/guix/tests/derivations.scm:92 source: + (test-assert + "add-to-store, flat" + (let* ((file (search-path + %load-path + "language/tree-il/spec.scm")) + (drv (add-to-store + %store + "flat-test" + #f + "sha256" + file))) + (and (eq? 'regular (stat:type (stat drv))) + (valid-path? %store drv) + (equal? + (call-with-input-file file get-bytevector-all) + (call-with-input-file drv get-bytevector-all))))) result: SKIP test-name: add-to-store, recursive location: /home/rsd/v/git/others/guix/tests/derivations.scm:100 source: + (test-assert + "add-to-store, recursive" + (let* ((dir (dirname + (search-path + %load-path + "language/tree-il/spec.scm"))) + (drv (add-to-store + %store + "dir-tree-test" + #t + "sha256" + dir))) + (and (eq? 'directory (stat:type (stat drv))) + (valid-path? %store drv) + (equal? + (directory-contents dir) + (directory-contents drv))))) result: SKIP test-name: derivation with no inputs location: /home/rsd/v/git/others/guix/tests/derivations.scm:108 source: + (test-assert + "derivation with no inputs" + (let* ((builder + (add-text-to-store + %store + "my-builder.sh" + "echo hello, world\n" + '())) + (drv (derivation + %store + "foo" + %bash + `("-e" ,builder) + #:env-vars + '(("HOME" . "/homeless"))))) + (and (store-path? (derivation-file-name drv)) + (valid-path? %store (derivation-file-name drv))))) result: SKIP test-name: build derivation with 1 source location: /home/rsd/v/git/others/guix/tests/derivations.scm:118 source: + (test-assert + "build derivation with 1 source" + (let* ((builder + (add-text-to-store + %store + "my-builder.sh" + "echo hello, world > \"$out\"\n" + '())) + (drv (derivation + %store + "foo" + %bash + `(,builder) + #:env-vars + '(("HOME" . "/homeless") + ("zzz" . "Z!") + ("AAA" . "A!")) + #:inputs + `((,%bash) (,builder)))) + (succeeded? + (build-derivations %store (list drv)))) + (and succeeded? + (let ((path (derivation->output-path drv))) + (and (valid-path? %store path) + (string=? + (call-with-input-file path read-line) + "hello, world")))))) result: SKIP test-name: derivation with local file as input location: /home/rsd/v/git/others/guix/tests/derivations.scm:136 source: + (test-assert + "derivation with local file as input" + (let* ((builder + (add-text-to-store + %store + "my-builder.sh" + "(while read line ; do echo \"$line\" ; done) < $in > $out" + '())) + (input (search-path %load-path "ice-9/boot-9.scm")) + (input* + (add-to-store + %store + (basename input) + #t + "sha256" + input)) + (drv (derivation + %store + "derivation-with-input-file" + %bash + `(,builder) + #:env-vars + `(("in" unquote input*)) + #:inputs + `((,%bash) (,builder) (,input))))) + (and (build-derivations %store (list drv)) + (valid-path? + %store + (derivation->output-path drv))))) result: SKIP test-name: derivation fails but keep going location: /home/rsd/v/git/others/guix/tests/derivations.scm:159 source: + (test-assert + "derivation fails but keep going" + (with-store + store + (let* ((d1 (derivation + %store + "fails" + %bash + `("-c" "false") + #:inputs + `((,%bash)))) + (d2 (build-expression->derivation + %store + "sleep-then-succeed" + `(begin ,(random-text) (sleep 2) (mkdir %output))))) + (set-build-options + %store + #:use-substitutes? + #f + #:keep-going? + #t) + (guard (c ((nix-protocol-error? c) + (and (= 100 (nix-protocol-error-status c)) + (string-contains + (nix-protocol-error-message c) + (derivation-file-name d1)) + (not (valid-path? %store (derivation->output-path d1))) + (valid-path? %store (derivation->output-path d2))))) + (build-derivations %store (list d1 d2)) + #f)))) result: SKIP test-name: identical files are deduplicated location: /home/rsd/v/git/others/guix/tests/derivations.scm:186 source: + (test-assert + "identical files are deduplicated" + (let* ((build1 + (add-text-to-store + %store + "one.sh" + "echo hello, world > \"$out\"\n" + '())) + (build2 + (add-text-to-store + %store + "two.sh" + "# Hey!\necho hello, world > \"$out\"\n" + '())) + (drv1 (derivation + %store + "foo" + %bash + `(,build1) + #:inputs + `((,%bash) (,build1)))) + (drv2 (derivation + %store + "bar" + %bash + `(,build2) + #:inputs + `((,%bash) (,build2))))) + (and (build-derivations %store (list drv1 drv2)) + (let ((file1 (derivation->output-path drv1)) + (file2 (derivation->output-path drv2))) + (and (valid-path? %store file1) + (valid-path? %store file2) + (string=? + (call-with-input-file file1 get-string-all) + "hello, world\n") + (= (stat:ino (lstat file1)) + (stat:ino (lstat file2)))))))) result: SKIP test-name: derivation-name location: /home/rsd/v/git/others/guix/tests/derivations.scm:208 source: + (test-equal + "derivation-name" + "foo-0.0" + (let ((drv (derivation %store "foo-0.0" %bash '()))) + (derivation-name drv))) result: SKIP test-name: derivation-output-names location: /home/rsd/v/git/others/guix/tests/derivations.scm:213 source: + (test-equal + "derivation-output-names" + '(("out") ("bar" "chbouib")) + (let ((drv1 (derivation %store "foo-0.0" %bash '())) + (drv2 (derivation + %store + "foo-0.0" + %bash + '() + #:outputs + '("bar" "chbouib")))) + (list (derivation-output-names drv1) + (derivation-output-names drv2)))) result: SKIP test-name: offloadable-derivation? location: /home/rsd/v/git/others/guix/tests/derivations.scm:221 source: + (test-assert + "offloadable-derivation?" + (and (offloadable-derivation? + (derivation %store "foo" %bash '())) + (offloadable-derivation? + (derivation + %store + "foo" + %bash + '() + #:substitutable? + #f)) + (not (offloadable-derivation? + (derivation + %store + "foo" + %bash + '() + #:local-build? + #t))))) result: SKIP test-name: substitutable-derivation? location: /home/rsd/v/git/others/guix/tests/derivations.scm:230 source: + (test-assert + "substitutable-derivation?" + (and (substitutable-derivation? + (derivation %store "foo" %bash '())) + (substitutable-derivation? + (derivation + %store + "foo" + %bash + '() + #:local-build? + #t)) + (not (substitutable-derivation? + (derivation + %store + "foo" + %bash + '() + #:substitutable? + #f))))) result: SKIP test-name: fixed-output-derivation? location: /home/rsd/v/git/others/guix/tests/derivations.scm:239 source: + (test-assert + "fixed-output-derivation?" + (let* ((builder + (add-text-to-store + %store + "my-fixed-builder.sh" + "echo -n hello > $out" + '())) + (hash (sha256 (string->utf8 "hello"))) + (drv (derivation + %store + "fixed" + %bash + `(,builder) + #:inputs + `((,builder)) + #:hash + hash + #:hash-algo + 'sha256))) + (fixed-output-derivation? drv))) result: SKIP test-name: fixed-output derivation location: /home/rsd/v/git/others/guix/tests/derivations.scm:249 source: + (test-assert + "fixed-output derivation" + (let* ((builder + (add-text-to-store + %store + "my-fixed-builder.sh" + "echo -n hello > $out" + '())) + (hash (sha256 (string->utf8 "hello"))) + (drv (derivation + %store + "fixed" + %bash + `(,builder) + #:inputs + `((,builder)) + #:hash + hash + #:hash-algo + 'sha256)) + (succeeded? + (build-derivations %store (list drv)))) + (and succeeded? + (let ((p (derivation->output-path drv))) + (and (equal? + (string->utf8 "hello") + (call-with-input-file p get-bytevector-all)) + (bytevector? (query-path-hash %store p))))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: fixed-output derivation: output paths are equal location: /home/rsd/v/git/others/guix/tests/derivations.scm:264 source: + (test-assert + "fixed-output derivation: output paths are equal" + (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"))) + (drv1 (derivation + %store + "fixed" + %bash + `(,builder1) + #:hash + hash + #:hash-algo + 'sha256)) + (drv2 (derivation + %store + "fixed" + %bash + `(,builder2) + #:hash + hash + #:hash-algo + 'sha256)) + (succeeded? + (build-derivations %store (list drv1 drv2)))) + (and succeeded? + (equal? + (derivation->output-path drv1) + (derivation->output-path drv2))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: fixed-output derivation, recursive location: /home/rsd/v/git/others/guix/tests/derivations.scm:281 source: + (test-assert + "fixed-output derivation, recursive" + (let* ((builder + (add-text-to-store + %store + "my-fixed-builder.sh" + "echo -n hello > $out" + '())) + (hash (sha256 (string->utf8 "hello"))) + (drv (derivation + %store + "fixed-rec" + %bash + `(,builder) + #:inputs + `((,builder)) + #:hash + (base32 + "0sg9f58l1jj88w6pdrfdpj5x9b1zrwszk84j81zvby36q9whhhqa") + #:hash-algo + 'sha256 + #:recursive? + #t)) + (succeeded? + (build-derivations %store (list drv)))) + (and succeeded? + (let ((p (derivation->output-path drv))) + (and (equal? + (string->utf8 "hello") + (call-with-input-file p get-bytevector-all)) + (bytevector? (query-path-hash %store p))))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: derivation with a fixed-output input location: /home/rsd/v/git/others/guix/tests/derivations.scm:298 source: + (test-assert + "derivation with a fixed-output input" + (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)) + (fixed-out (derivation->output-path fixed1)) + (builder3 + (add-text-to-store + %store + "final-builder.sh" + "echo $in ; (read -u 3 c; echo $c) 3< $in > $out" + '())) + (final1 + (derivation + %store + "final" + %bash + `(,builder3) + #:env-vars + `(("in" unquote fixed-out)) + #:inputs + `((,%bash) (,builder3) (,fixed1)))) + (final2 + (derivation + %store + "final" + %bash + `(,builder3) + #:env-vars + `(("in" unquote fixed-out)) + #:inputs + `((,%bash) (,builder3) (,fixed2)))) + (succeeded? + (build-derivations %store (list final1 final2)))) + (and succeeded? + (equal? + (derivation->output-path final1) + (derivation->output-path final2))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: multiple-output derivation location: /home/rsd/v/git/others/guix/tests/derivations.scm:332 source: + (test-assert + "multiple-output derivation" + (let* ((builder + (add-text-to-store + %store + "my-fixed-builder.sh" + "echo one > $out ; echo two > $second" + '())) + (drv (derivation + %store + "fixed" + %bash + `(,builder) + #:env-vars + '(("HOME" . "/homeless") + ("zzz" . "Z!") + ("AAA" . "A!")) + #:inputs + `((,%bash) (,builder)) + #:outputs + '("out" "second"))) + (succeeded? + (build-derivations %store (list drv)))) + (and succeeded? + (let ((one (derivation->output-path drv "out")) + (two (derivation->output-path drv "second"))) + (and (lset= equal? + (derivation->output-paths drv) + `(("out" unquote one) ("second" unquote two))) + (eq? 'one (call-with-input-file one read)) + (eq? 'two (call-with-input-file two read))))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: multiple-output derivation, non-alphabetic order location: /home/rsd/v/git/others/guix/tests/derivations.scm:353 source: + (test-assert + "multiple-output derivation, non-alphabetic order" + (let* ((builder + (add-text-to-store + %store + "my-fixed-builder.sh" + "echo one > $out ; echo two > $AAA" + '())) + (drv (derivation + %store + "fixed" + %bash + `(,builder) + #:inputs + `((,%bash) (,builder)) + #:outputs + '("out" "AAA"))) + (succeeded? + (build-derivations %store (list drv)))) + (and succeeded? + (let ((one (derivation->output-path drv "out")) + (two (derivation->output-path drv "AAA"))) + (and (eq? 'one (call-with-input-file one read)) + (eq? 'two (call-with-input-file two read))))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: read-derivation vs. derivation location: /home/rsd/v/git/others/guix/tests/derivations.scm:370 source: + (test-assert + "read-derivation vs. derivation" + (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))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: multiple-output derivation, derivation-path->output-path location: /home/rsd/v/git/others/guix/tests/derivations.scm:397 source: + (test-assert + "multiple-output derivation, derivation-path->output-path" + (let* ((builder + (add-text-to-store + %store + "builder.sh" + "echo one > $out ; echo two > $second" + '())) + (drv (derivation + %store + "multiple" + %bash + `(,builder) + #:outputs + '("out" "second"))) + (drv-file (derivation-file-name drv)) + (one (derivation->output-path drv "out")) + (two (derivation->output-path drv "second")) + (first (derivation-path->output-path drv-file "out")) + (second + (derivation-path->output-path drv-file "second"))) + (and (not (string=? one two)) + (string-suffix? "-second" two) + (string=? first one) + (string=? second two)))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: user of multiple-output derivation location: /home/rsd/v/git/others/guix/tests/derivations.scm:414 source: + (test-assert + "user of multiple-output derivation" + (let* ((builder1 + (add-text-to-store + %store + "my-mo-builder.sh" + "echo one > $out ; echo two > $two" + '())) + (mdrv (derivation + %store + "multiple-output" + %bash + `(,builder1) + #:inputs + `((,%bash) (,builder1)) + #:outputs + '("out" "two"))) + (builder2 + (add-text-to-store + %store + "my-mo-user-builder.sh" + "read x < $one;\n read y < $two;\n echo \"($x $y)\" > $out" + '())) + (udrv (derivation + %store + "multiple-output-user" + %bash + `(,builder2) + #:env-vars + `(("one" + unquote + (derivation->output-path mdrv "out")) + ("two" + unquote + (derivation->output-path mdrv "two"))) + #:inputs + `((,%bash) (,builder2) (,mdrv) (,mdrv "two"))))) + (and (build-derivations %store (list (pk 'udrv udrv))) + (let ((p (derivation->output-path udrv))) + (and (valid-path? %store p) + (equal? '(one two) (call-with-input-file p read))))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: derivation with #:references-graphs location: /home/rsd/v/git/others/guix/tests/derivations.scm:447 source: + (test-assert + "derivation with #:references-graphs" + (let* ((input1 + (add-text-to-store + %store + "foo" + "hello" + (list %bash))) + (input2 + (add-text-to-store + %store + "bar" + (number->string (random 7777)) + (list input1))) + (builder + (add-text-to-store + %store + "build-graph" + (format + #f + "\n~a $out\n (while read l ; do echo $l ; done) < bash > $out/bash\n (while read l ; do echo $l ; done) < input1 > $out/input1\n (while read l ; do echo $l ; done) < input2 > $out/input2" + %mkdir) + (list %mkdir))) + (drv (derivation + %store + "closure-graphs" + %bash + `(,builder) + #:references-graphs + `(("bash" unquote %bash) + ("input1" unquote input1) + ("input2" unquote input2)) + #:inputs + `((,%bash) (,builder)))) + (out (derivation->output-path drv))) + (define (deps path . deps) + (let ((count (length deps))) + (string-append + path + "\n\n" + (number->string count) + "\n" + (string-join (sort deps string? input1 %bash) + (string-append (deps %bash) (deps input1 %bash)) + (string-append (deps input1 %bash) (deps %bash)))) + ("/input2" + unquote + (string-concatenate + (map cdr + (sort (map (lambda (p d) (cons p (apply deps p d))) + (list %bash input1 input2) + (list '() (list %bash) (list input1))) + (lambda (x y) + (match x + ((p1 . _) + (match y + ((p2 . _) + (string $out") + #:inputs + `((,%bash)) + #:allowed-references + '()))) + (build-derivations %store (list drv)))) actual-value: #f actual-error: + (wrong-type-arg + "string-prefix?" + "Wrong type argument in position ~A (expecting ~A): ~S" + (2 "string" #f) + (#f)) result: FAIL test-name: derivation #:allowed-references, not allowed location: /home/rsd/v/git/others/guix/tests/derivations.scm:504 source: + (test-assert + "derivation #:allowed-references, not allowed" + (let* ((txt (add-text-to-store %store "foo" "Hello, world.")) + (drv (derivation + %store + "disallowed" + %bash + `("-c" ,(string-append "echo " txt "> $out")) + #:inputs + `((,%bash) (,txt)) + #:allowed-references + '()))) + (guard (c ((nix-protocol-error? c) #t)) + (build-derivations %store (list drv)) + #f))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: derivation #:allowed-references, self allowed location: /home/rsd/v/git/others/guix/tests/derivations.scm:516 source: + (test-assert + "derivation #:allowed-references, self allowed" + (let ((drv (derivation + %store + "allowed" + %bash + '("-c" "echo $out > $out") + #:inputs + `((,%bash)) + #:allowed-references + '("out")))) + (build-derivations %store (list drv)))) actual-value: #f actual-error: + (wrong-type-arg + "string-prefix?" + "Wrong type argument in position ~A (expecting ~A): ~S" + (2 "string" #f) + (#f)) result: FAIL test-name: derivation #:allowed-references, self not allowed location: /home/rsd/v/git/others/guix/tests/derivations.scm:523 source: + (test-assert + "derivation #:allowed-references, self not allowed" + (let ((drv (derivation + %store + "disallowed" + %bash + `("-c" ,"echo $out > $out") + #:inputs + `((,%bash)) + #:allowed-references + '()))) + (guard (c ((nix-protocol-error? c) #t)) + (build-derivations %store (list drv)) + #f))) actual-value: #f actual-error: + (wrong-type-arg + "string-prefix?" + "Wrong type argument in position ~A (expecting ~A): ~S" + (2 "string" #f) + (#f)) result: FAIL test-name: derivation #:disallowed-references, ok location: /home/rsd/v/git/others/guix/tests/derivations.scm:534 source: + (test-assert + "derivation #:disallowed-references, ok" + (let ((drv (derivation + %store + "disallowed" + %bash + '("-c" "echo hello > $out") + #:inputs + `((,%bash)) + #:disallowed-references + '("out")))) + (build-derivations %store (list drv)))) actual-value: #f actual-error: + (wrong-type-arg + "string-prefix?" + "Wrong type argument in position ~A (expecting ~A): ~S" + (2 "string" #f) + (#f)) result: FAIL test-name: derivation #:disallowed-references, not ok location: /home/rsd/v/git/others/guix/tests/derivations.scm:541 source: + (test-assert + "derivation #:disallowed-references, not ok" + (let* ((txt (add-text-to-store %store "foo" "Hello, world.")) + (drv (derivation + %store + "disdisallowed" + %bash + `("-c" ,(string-append "echo " txt "> $out")) + #:inputs + `((,%bash) (,txt)) + #:disallowed-references + (list txt)))) + (guard (c ((nix-protocol-error? c) #t)) + (build-derivations %store (list drv)) + #f))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: derivation #:leaked-env-vars location: /home/rsd/v/git/others/guix/tests/derivations.scm:556 source: + (test-equal + "derivation #:leaked-env-vars" + (getenv "NIX_STATE_DIR") + (let* ((value (getenv "NIX_STATE_DIR")) + (drv (derivation + %store + "leaked-env-vars" + %bash + '("-c" "echo -n $NIX_STATE_DIR > $out") + #:hash + (sha256 (string->utf8 value)) + #:hash-algo + 'sha256 + #:inputs + `((,%bash)) + #:leaked-env-vars + '("NIX_STATE_DIR")))) + (and (build-derivations %store (list drv)) + (call-with-input-file + (derivation->output-path drv) + get-string-all)))) expected-value: /home/rsd/v/git/others/guix/test-tmp/var/11878 actual-value: #f actual-error: + (wrong-type-arg + "string-prefix?" + "Wrong type argument in position ~A (expecting ~A): ~S" + (2 "string" #f) + (#f)) result: FAIL test-name: build derivation with coreutils location: /home/rsd/v/git/others/guix/tests/derivations.scm:577 source: + (test-assert + "build derivation with coreutils" + (let* ((builder + (add-text-to-store + %store + "build-with-coreutils.sh" + "echo $PATH ; mkdir --version ; mkdir $out ; touch $out/good" + '())) + (drv (derivation + %store + "foo" + %bash + `(,builder) + #:env-vars + `(("PATH" + unquote + (string-append + (derivation->output-path %coreutils) + "/bin"))) + #:inputs + `((,builder) (,%coreutils)))) + (succeeded? + (build-derivations %store (list drv)))) + (and succeeded? + (let ((p (derivation->output-path drv))) + (and (valid-path? %store p) + (file-exists? (string-append p "/good"))))))) result: SKIP test-name: build-expression->derivation and invalid module name location: /home/rsd/v/git/others/guix/tests/derivations.scm:600 source: + (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))))) result: SKIP test-name: build-expression->derivation and derivation-prerequisites location: /home/rsd/v/git/others/guix/tests/derivations.scm:609 source: + (test-assert + "build-expression->derivation and derivation-prerequisites" + (let ((drv (build-expression->derivation %store "fail" #f))) + (any (match-lambda + (($ path) + (string=? + path + (derivation-file-name (%guile-for-build))))) + (derivation-prerequisites drv)))) result: SKIP test-name: derivation-prerequisites and valid-derivation-input? location: /home/rsd/v/git/others/guix/tests/derivations.scm:616 source: + (test-assert + "derivation-prerequisites and valid-derivation-input?" + (let* ((a (build-expression->derivation + %store + "a" + '(mkdir %output))) + (b (build-expression->derivation + %store + "b" + `(list ,(random-text)))) + (c (build-expression->derivation + %store + "c" + `(mkdir %output) + #:inputs + `(("a" ,a) ("b" ,b))))) + (build-derivations + %store + (list a + (package-derivation %store %bootstrap-guile))) + (match (derivation-prerequisites + c + (cut valid-derivation-input? %store <>)) + ((($ file ("out"))) + (string=? file (derivation-file-name b))) + (x (pk 'fail x #f))))) result: SKIP test-name: build-expression->derivation without inputs location: /home/rsd/v/git/others/guix/tests/derivations.scm:634 source: + (test-assert + "build-expression->derivation without inputs" + (let* ((builder + '(begin + (mkdir %output) + (call-with-output-file + (string-append %output "/test") + (lambda (p) (display '(hello guix) p))))) + (drv (build-expression->derivation + %store + "goo" + builder)) + (succeeded? + (build-derivations %store (list drv)))) + (and succeeded? + (let ((p (derivation->output-path drv))) + (equal? + '(hello guix) + (call-with-input-file + (string-append p "/test") + read)))))) result: SKIP test-name: build-expression->derivation and max-silent-time location: /home/rsd/v/git/others/guix/tests/derivations.scm:647 source: + (test-assert + "build-expression->derivation and max-silent-time" + (let* ((store (let ((s (open-connection))) + (set-build-options s #:max-silent-time 1) + s)) + (builder '(begin (sleep 100) (mkdir %output) #t)) + (drv (build-expression->derivation + store + "silent" + builder)) + (out-path (derivation->output-path drv))) + (guard (c ((nix-protocol-error? c) + (and (string-contains + (nix-protocol-error-message c) + "failed") + (not (valid-path? store out-path))))) + (build-derivations store (list drv)) + #f))) result: SKIP test-name: build-expression->derivation and timeout location: /home/rsd/v/git/others/guix/tests/derivations.scm:661 source: + (test-assert + "build-expression->derivation and timeout" + (let* ((store (let ((s (open-connection))) + (set-build-options s #:timeout 1) + s)) + (builder '(begin (sleep 100) (mkdir %output) #t)) + (drv (build-expression->derivation + store + "slow" + builder)) + (out-path (derivation->output-path drv))) + (guard (c ((nix-protocol-error? c) + (and (string-contains + (nix-protocol-error-message c) + "failed") + (not (valid-path? store out-path))))) + (build-derivations store (list drv)) + #f))) result: SKIP test-name: build-expression->derivation and derivation-prerequisites-to-build location: /home/rsd/v/git/others/guix/tests/derivations.scm:675 source: + (test-assert + "build-expression->derivation and derivation-prerequisites-to-build" + (let ((drv (build-expression->derivation %store "fail" #f))) + (null? (derivation-prerequisites-to-build %store drv)))) result: SKIP test-name: derivation-prerequisites-to-build when outputs already present location: /home/rsd/v/git/others/guix/tests/derivations.scm:681 source: + (test-assert + "derivation-prerequisites-to-build when outputs already present" + (let* ((builder '(begin (mkdir %output) #t)) + (input-drv + (build-expression->derivation + %store + "input" + builder)) + (input-path + (derivation-output-path + (assoc-ref (derivation-outputs input-drv) "out"))) + (drv (build-expression->derivation + %store + "something" + builder + #:inputs + `(("i" ,input-drv)))) + (output (derivation->output-path drv))) + (when (valid-path? %store input-path) + (delete-paths %store (list input-path))) + (when (valid-path? %store output) + (delete-paths %store (list output))) + (and (equal? + (map derivation-input-path + (derivation-prerequisites-to-build %store drv)) + (list (derivation-file-name input-drv))) + (build-derivations %store (list drv)) + (delete-paths %store (list input-path)) + (not (valid-path? %store input-path)) + (null? (derivation-prerequisites-to-build %store drv))))) result: SKIP test-name: derivation-prerequisites-to-build and substitutes location: /home/rsd/v/git/others/guix/tests/derivations.scm:710 source: + (test-assert + "derivation-prerequisites-to-build and substitutes" + (let* ((store (open-connection)) + (drv (build-expression->derivation + store + "prereq-subst" + (random 1000))) + (output (derivation->output-path drv))) + (set-build-options + store + #:use-substitutes? + #t + #:substitute-urls + (%test-substitute-urls)) + (with-derivation-narinfo + drv + (let-values + (((build download) + (derivation-prerequisites-to-build store drv)) + ((build* download*) + (derivation-prerequisites-to-build + store + drv + #:substitutable? + (const #f)))) + (and (null? build) + (equal? download (list output)) + (null? download*) + (null? build*)))))) actual-value: #f actual-error: + (srfi-34 + #) result: FAIL test-name: derivation-prerequisites-to-build and substitutes, non-substitutable build location: /home/rsd/v/git/others/guix/tests/derivations.scm:732 source: + (test-assert + "derivation-prerequisites-to-build and substitutes, non-substitutable build" + (let* ((store (open-connection)) + (drv (build-expression->derivation + store + "prereq-no-subst" + (random 1000) + #:substitutable? + #f)) + (output (derivation->output-path drv))) + (set-build-options + store + #:use-substitutes? + #t + #:substitute-urls + (%test-substitute-urls)) + (with-derivation-narinfo + drv + (let-values + (((build download) + (derivation-prerequisites-to-build store drv))) + (and (null? download) + (match build + (((? derivation-input? input)) + (string=? + (derivation-input-path input) + (derivation-file-name drv))))))))) actual-value: #f actual-error: + (srfi-34 + #) result: FAIL test-name: derivation-prerequisites-to-build and substitutes, local build location: /home/rsd/v/git/others/guix/tests/derivations.scm:754 source: + (test-assert + "derivation-prerequisites-to-build and substitutes, local build" + (with-store + store + (let* ((drv (build-expression->derivation + store + "prereq-subst-local" + (random 1000) + #:local-build? + #t)) + (output (derivation->output-path drv))) + (set-build-options + store + #:use-substitutes? + #t + #:substitute-urls + (%test-substitute-urls)) + (with-derivation-narinfo + drv + (let-values + (((build download) + (derivation-prerequisites-to-build store drv))) + (and (null? build) + (match download + (((? string? item)) + (string=? item (derivation->output-path drv)))))))))) actual-value: #f actual-error: + (srfi-34 + #) result: FAIL test-name: derivation-prerequisites-to-build in 'check' mode location: /home/rsd/v/git/others/guix/tests/derivations.scm:776 source: + (test-assert + "derivation-prerequisites-to-build in 'check' mode" + (with-store + store + (let* ((dep (build-expression->derivation + store + "dep" + `(begin ,(random-text) (mkdir %output)))) + (drv (build-expression->derivation + store + "to-check" + '(mkdir %output) + #:inputs + `(("dep" ,dep))))) + (build-derivations store (list drv)) + (delete-paths + store + (list (derivation->output-path dep))) + (and (null? (derivation-prerequisites-to-build store drv)) + (match (derivation-prerequisites-to-build + store + drv + #:mode + (build-mode check)) + ((input) + (string=? + (derivation-input-path input) + (derivation-file-name dep)))))))) actual-value: #f actual-error: + (srfi-34 + #) result: FAIL test-name: build-expression->derivation with expression returning #f location: /home/rsd/v/git/others/guix/tests/derivations.scm:796 source: + (test-assert + "build-expression->derivation with expression returning #f" + (let* ((builder '(begin (mkdir %output) #f)) + (drv (build-expression->derivation + %store + "fail" + builder)) + (out-path (derivation->output-path drv))) + (guard (c ((nix-protocol-error? c) + (and (string-match + "build .* failed" + (nix-protocol-error-message c)) + (not (valid-path? %store out-path))))) + (build-derivations %store (list drv)) + #f))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: build-expression->derivation with two outputs location: /home/rsd/v/git/others/guix/tests/derivations.scm:811 source: + (test-assert + "build-expression->derivation with two outputs" + (let* ((builder + '(begin + (call-with-output-file + (assoc-ref %outputs "out") + (lambda (p) (display '(hello) p))) + (call-with-output-file + (assoc-ref %outputs "second") + (lambda (p) (display '(world) p))))) + (drv (build-expression->derivation + %store + "double" + builder + #:outputs + '("out" "second"))) + (succeeded? + (build-derivations %store (list drv)))) + (and succeeded? + (let ((one (derivation->output-path drv)) + (two (derivation->output-path drv "second"))) + (and (equal? '(hello) (call-with-input-file one read)) + (equal? '(world) (call-with-input-file two read))))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: build-expression->derivation with one input location: /home/rsd/v/git/others/guix/tests/derivations.scm:830 source: + (test-assert + "build-expression->derivation with one input" + (let* ((builder + '(call-with-output-file + %output + (lambda (p) + (let ((cu (assoc-ref %build-inputs "cu"))) + (close 1) + (dup2 (port->fdes p) 1) + (execl (string-append cu "/bin/uname") + "uname" + "-a"))))) + (drv (build-expression->derivation + %store + "uname" + builder + #:inputs + `(("cu" ,%coreutils)))) + (succeeded? + (build-derivations %store (list drv)))) + (and succeeded? + (let ((p (derivation->output-path drv))) + (string-contains + (call-with-input-file p read-line) + "GNU"))))) result: SKIP test-name: build-expression->derivation with modules location: /home/rsd/v/git/others/guix/tests/derivations.scm:846 source: + (test-assert + "build-expression->derivation with modules" + (let* ((builder + `(begin + (use-modules (guix build utils)) + (let ((out (assoc-ref %outputs "out"))) + (mkdir-p (string-append out "/guile/guix/nix")) + #t))) + (drv (build-expression->derivation + %store + "test-with-modules" + builder + #:modules + '((guix build utils))))) + (and (build-derivations %store (list drv)) + (let* ((p (derivation->output-path drv)) + (s (stat (string-append p "/guile/guix/nix")))) + (eq? (stat:type s) 'directory))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: build-expression->derivation: same fixed-output path location: /home/rsd/v/git/others/guix/tests/derivations.scm:861 source: + (test-assert + "build-expression->derivation: same fixed-output path" + (let* ((builder1 + '(call-with-output-file + %output + (lambda (p) (write "hello" p)))) + (builder2 + '(call-with-output-file + (pk 'difference-here! %output) + (lambda (p) (write "hello" p)))) + (hash (sha256 (string->utf8 "hello"))) + (input1 + (build-expression->derivation + %store + "fixed" + builder1 + #:hash + hash + #:hash-algo + 'sha256)) + (input2 + (build-expression->derivation + %store + "fixed" + builder2 + #:hash + hash + #:hash-algo + 'sha256)) + (succeeded? + (build-derivations %store (list input1 input2)))) + (and succeeded? + (not (string=? + (derivation-file-name input1) + (derivation-file-name input2))) + (string=? + (derivation->output-path input1) + (derivation->output-path input2))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: build-expression->derivation with a fixed-output input location: /home/rsd/v/git/others/guix/tests/derivations.scm:882 source: + (test-assert + "build-expression->derivation with a fixed-output input" + (let* ((builder1 + '(call-with-output-file + %output + (lambda (p) (write "hello" p)))) + (builder2 + '(call-with-output-file + (pk 'difference-here! %output) + (lambda (p) (write "hello" p)))) + (hash (sha256 (string->utf8 "hello"))) + (input1 + (build-expression->derivation + %store + "fixed" + builder1 + #:hash + hash + #:hash-algo + 'sha256)) + (input2 + (build-expression->derivation + %store + "fixed" + builder2 + #:hash + hash + #:hash-algo + 'sha256)) + (builder3 + '(let ((input (assoc-ref %build-inputs "input"))) + (call-with-output-file + %output + (lambda (out) + (format #f "My input is ~a.~%" input))))) + (final1 + (build-expression->derivation + %store + "final" + builder3 + #:inputs + `(("input" ,input1)))) + (final2 + (build-expression->derivation + %store + "final" + builder3 + #:inputs + `(("input" ,input2))))) + (and (string=? + (derivation->output-path final1) + (derivation->output-path final2)) + (string=? + (derivation->output-path final1) + (derivation-path->output-path + (derivation-file-name final1))) + (build-derivations %store (list final1 final2))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: build-expression->derivation produces recursive fixed-output location: /home/rsd/v/git/others/guix/tests/derivations.scm:913 source: + (test-assert + "build-expression->derivation produces recursive fixed-output" + (let* ((builder + '(begin + (use-modules (srfi srfi-26)) + (mkdir %output) + (chdir %output) + (call-with-output-file + "exe" + (cut display "executable" <>)) + (chmod "exe" 511) + (symlink "exe" "symlink") + (mkdir "subdir"))) + (drv (build-expression->derivation + %store + "fixed-rec" + builder + #:hash-algo + 'sha256 + #:hash + (base32 + "10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p") + #:recursive? + #t))) + (and (build-derivations %store (list drv)) + (let* ((dir (derivation->output-path drv)) + (exe (string-append dir "/exe")) + (link (string-append dir "/symlink")) + (subdir (string-append dir "/subdir"))) + (and (executable-file? exe) + (string=? + "executable" + (call-with-input-file exe get-string-all)) + (string=? "exe" (readlink link)) + (file-is-directory? subdir)))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: build-expression->derivation uses recursive fixed-output location: /home/rsd/v/git/others/guix/tests/derivations.scm:939 source: + (test-assert + "build-expression->derivation uses recursive fixed-output" + (let* ((builder + '(call-with-output-file + %output + (lambda (port) (display "hello" port)))) + (fixed (build-expression->derivation + %store + "small-fixed-rec" + builder + #:hash-algo + 'sha256 + #:hash + (base32 + "0sg9f58l1jj88w6pdrfdpj5x9b1zrwszk84j81zvby36q9whhhqa") + #:recursive? + #t)) + (in (derivation->output-path fixed)) + (builder + `(begin + (mkdir %output) + (chdir %output) + (symlink ,in "symlink"))) + (drv (build-expression->derivation + %store + "fixed-rec-user" + builder + #:inputs + `(("fixed" ,fixed))))) + (and (build-derivations %store (list drv)) + (let ((out (derivation->output-path drv))) + (string=? + (readlink (string-append out "/symlink")) + in))))) actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: build-expression->derivation with #:references-graphs location: /home/rsd/v/git/others/guix/tests/derivations.scm:961 source: + (test-assert + "build-expression->derivation with #:references-graphs" + (let* ((input (add-text-to-store + %store + "foo" + "hello" + (list %bash %mkdir))) + (builder '(copy-file "input" %output)) + (drv (build-expression->derivation + %store + "references-graphs" + builder + #:references-graphs + `(("input" unquote input)))) + (out (derivation->output-path drv))) + (define (deps path . deps) + (let ((count (length deps))) + (string-append + path + "\n\n" + (number->string count) + "\n" + (string-join (sort deps stringderivation + %store + "original-drv1" + #f + #:guile-for-build + joke)) + (drv2 (build-expression->derivation + %store + "original-drv2" + '(call-with-output-file + %output + (lambda (p) (display "hello" p))))) + (drv3 (build-expression->derivation + %store + "drv-to-remap" + '(let ((in (assoc-ref %build-inputs "in"))) + (copy-file in %output)) + #:inputs + `(("in" ,drv1)) + #:guile-for-build + joke)) + (drv4 (map-derivation + %store + drv3 + `((,drv1 unquote drv2) (,joke unquote good)))) + (out (derivation->output-path drv4))) + (and (build-derivations + %store + (list (pk 'remapped drv4))) + (call-with-input-file out get-string-all)))) expected-value: hello actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL test-name: map-derivation, sources location: /home/rsd/v/git/others/guix/tests/derivations.scm:1015 source: + (test-equal + "map-derivation, sources" + "hello" + (let* ((script1 + (add-text-to-store %store "fail.sh" "exit 1")) + (script2 + (add-text-to-store + %store + "hi.sh" + "echo -n hello > $out")) + (bash-full + (package-derivation + %store + (@ (gnu packages bash) bash))) + (drv1 (derivation + %store + "drv-to-remap" + (derivation->output-path bash-full) + `("-e" ,script1) + #:inputs + `((,bash-full) (,script1)))) + (drv2 (map-derivation + %store + drv1 + `((,bash-full unquote %bash) + (,script1 unquote script2)))) + (out (derivation->output-path drv2))) + (and (build-derivations + %store + (list (pk 'remapped* drv2))) + (call-with-input-file out get-string-all)))) expected-value: hello actual-value: #f actual-error: + (wrong-type-arg + "struct_vtable" + "Wrong type argument in position ~A (expecting ~A): ~S" + (1 "struct" #f) + (#f)) result: FAIL random seed for tests: 1473545071 warning: build daemon error: #