%%%% Starting test store Group begin: store Test begin: test-name: "store-path-hash-part" source-file: "tests/store.scm" source-line: 51 source-form: (test-equal "store-path-hash-part" "283gqy39v3g9dxjy26rynl0zls82fmcg" (store-path-hash-part (string-append (%store-prefix) "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7"))) Test end: result-kind: pass actual-value: "283gqy39v3g9dxjy26rynl0zls82fmcg" expected-value: "283gqy39v3g9dxjy26rynl0zls82fmcg" Test begin: test-name: "store-path-hash-part #f" source-file: "tests/store.scm" source-line: 57 source-form: (test-equal "store-path-hash-part #f" #f (store-path-hash-part (string-append (%store-prefix) "/foo/bar/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7"))) Test end: result-kind: pass actual-value: #f expected-value: #f Test begin: test-name: "store-path-package-name" source-file: "tests/store.scm" source-line: 63 source-form: (test-equal "store-path-package-name" "guile-2.0.7" (store-path-package-name (string-append (%store-prefix) "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7"))) Test end: result-kind: pass actual-value: "guile-2.0.7" expected-value: "guile-2.0.7" Test begin: test-name: "store-path-package-name #f" source-file: "tests/store.scm" source-line: 69 source-form: (test-equal "store-path-package-name #f" #f (store-path-package-name "/foo/bar/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7")) Test end: result-kind: pass actual-value: #f expected-value: #f Test begin: test-name: "direct-store-path?" source-file: "tests/store.scm" source-line: 74 source-form: (test-assert "direct-store-path?" (and (direct-store-path? (string-append (%store-prefix) "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7")) (not (direct-store-path? (string-append (%store-prefix) "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7/bin/guile"))) (not (direct-store-path? (%store-prefix))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "valid-path? live" source-file: "tests/store.scm" source-line: 86 source-form: (test-assert "valid-path? live" (let ((p (add-text-to-store %store "hello" "hello, world"))) (valid-path? %store p))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "valid-path? false" source-file: "tests/store.scm" source-line: 90 source-form: (test-assert "valid-path? false" (not (valid-path? %store (string-append (%store-prefix) "/" (make-string 32 #\e) "-foobar")))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "valid-path? error" source-file: "tests/store.scm" source-line: 95 source-form: (test-assert "valid-path? error" (with-store s (guard (c ((nix-protocol-error? c) #t)) (valid-path? s "foo") #f))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "valid-path? recovery" source-file: "tests/store.scm" source-line: 101 source-form: (test-assert "valid-path? recovery" (with-store s (let-syntax ((true-if-error (syntax-rules () ((_ exp) (guard (c ((nix-protocol-error? c) #t)) exp #f))))) (and (true-if-error (valid-path? s "foo")) (true-if-error (valid-path? s "bar")) (true-if-error (valid-path? s "baz")) (true-if-error (valid-path? s "chbouib")) (valid-path? s (add-text-to-store s "valid" "yeah")))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "hash-part->path" source-file: "tests/store.scm" source-line: 118 source-form: (test-assert "hash-part->path" (let ((p (add-text-to-store %store "hello" "hello, world"))) (equal? (hash-part->path %store (store-path-hash-part p)) p))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "dead-paths" source-file: "tests/store.scm" source-line: 123 source-form: (test-assert "dead-paths" (let ((p (add-text-to-store %store "random-text" (random-text)))) (->bool (member p (dead-paths %store))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "permanent root" source-file: "tests/store.scm" source-line: 144 source-form: (test-assert "permanent root" (let* ((p (with-store store (let ((p (add-text-to-store store "random-text" (random-text)))) (add-permanent-root p) (add-permanent-root p) p)))) (and (member p (live-paths %store)) (begin (remove-permanent-root p) (->bool (member p (dead-paths %store))))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "dead path can be explicitly collected" source-file: "tests/store.scm" source-line: 156 source-form: (test-assert "dead path can be explicitly collected" (let ((p (add-text-to-store %store "random-text" (random-text) (quote ())))) (let-values (((paths freed) (delete-paths %store (list p)))) (and (equal? paths (list p)) (> freed 0) (not (file-exists? p)))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "add-text-to-store vs. delete-paths" source-file: "tests/store.scm" source-line: 164 source-form: (test-assert "add-text-to-store vs. delete-paths" (with-store store (let* ((text (random-text)) (path (add-text-to-store store "delete-me" text)) (deleted (delete-paths store (list path))) (path2 (add-text-to-store store "delete-me" text))) (and (string=? path path2) (equal? deleted (list path)) (valid-path? store path) (file-exists? path))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "add-to-store vs. delete-paths" source-file: "tests/store.scm" source-line: 177 source-form: (test-assert "add-to-store vs. delete-paths" (with-store store (let* ((file (search-path %load-path "guix.scm")) (path (add-to-store store "delete-me" #t "sha256" file)) (deleted (delete-paths store (list path))) (path2 (add-to-store store "delete-me" #t "sha256" file))) (and (string=? path path2) (equal? deleted (list path)) (valid-path? store path) (file-exists? path))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "references" source-file: "tests/store.scm" source-line: 189 source-form: (test-assert "references" (let* ((t1 (add-text-to-store %store "random1" (random-text))) (t2 (add-text-to-store %store "random2" (random-text) (list t1)))) (and (equal? (list t1) (references %store t2)) (equal? (list t2) (referrers %store t1)) (null? (references %store t1)) (null? (referrers %store t2))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "requisites" source-file: "tests/store.scm" source-line: 199 source-form: (test-assert "requisites" (let* ((t1 (add-text-to-store %store "random1" (random-text) (quote ()))) (t2 (add-text-to-store %store "random2" (random-text) (list t1))) (t3 (add-text-to-store %store "random3" (random-text) (list t2))) (t4 (add-text-to-store %store "random4" (random-text) (list t1 t3)))) (define (same? x y) (and (= (length x) (length y)) (lset= equal? x y))) (and (same? (requisites %store t1) (list t1)) (same? (requisites %store t2) (list t1 t2)) (same? (requisites %store t3) (list t1 t2 t3)) (same? (requisites %store t4) (list t1 t2 t3 t4))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "derivers" source-file: "tests/store.scm" source-line: 217 source-form: (test-assert "derivers" (let* ((b (add-text-to-store %store "build" "echo $foo > $out" (quote ()))) (s (add-to-store %store "bash" #t "sha256" (search-bootstrap-binary "bash" (%current-system)))) (d (derivation %store "the-thing" s (quasiquote ("-e" (unquote b))) #:env-vars (quasiquote (("foo" unquote (random-text)))) #:inputs (quasiquote (((unquote b)) ((unquote s)))))) (o (derivation->output-path d))) (and (build-derivations %store (list d)) (equal? (query-derivation-outputs %store (derivation-file-name d)) (list o)) (equal? (valid-derivers %store o) (list (derivation-file-name d)))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "topologically-sorted, one item" source-file: "tests/store.scm" source-line: 233 source-form: (test-assert "topologically-sorted, one item" (let* ((a (add-text-to-store %store "a" "a")) (b (add-text-to-store %store "b" "b" (list a))) (c (add-text-to-store %store "c" "c" (list b))) (d (add-text-to-store %store "d" "d" (list c))) (s (topologically-sorted %store (list d)))) (equal? s (list a b c d)))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "topologically-sorted, several items" source-file: "tests/store.scm" source-line: 241 source-form: (test-assert "topologically-sorted, several items" (let* ((a (add-text-to-store %store "a" "a")) (b (add-text-to-store %store "b" "b" (list a))) (c (add-text-to-store %store "c" "c" (list b))) (d (add-text-to-store %store "d" "d" (list c))) (s1 (topologically-sorted %store (list d a c b))) (s2 (topologically-sorted %store (list b d c a b d)))) (equal? s1 s2 (list a b c d)))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "topologically-sorted, more difficult" source-file: "tests/store.scm" source-line: 250 source-form: (test-assert "topologically-sorted, more difficult" (let* ((a (add-text-to-store %store "a" "a")) (b (add-text-to-store %store "b" "b" (list a))) (c (add-text-to-store %store "c" "c" (list b))) (d (add-text-to-store %store "d" "d" (list c))) (w (add-text-to-store %store "w" "w")) (x (add-text-to-store %store "x" "x" (list w))) (y (add-text-to-store %store "y" "y" (list x d))) (s1 (topologically-sorted %store (list y))) (s2 (topologically-sorted %store (list c y))) (s3 (topologically-sorted %store (cons y (references %store y))))) (let* ((x-then-d? (equal? (references %store y) (list x d)))) (and (equal? s1 (if x-then-d? (list w x a b c d y) (list a b c d w x y))) (equal? s2 (if x-then-d? (list a b c w x d y) (list a b c d w x y))) (lset= string=? s1 s3))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "current-build-output-port, UTF-8" source-file: "tests/store.scm" source-line: 274 source-form: (test-assert "current-build-output-port, UTF-8" (string-contains (with-fluids ((%default-port-encoding "UTF-8")) (call-with-output-string (lambda (port) (parameterize ((current-build-output-port port)) (let* ((s "Here\u2019s a Greek letter: \u03bb.") (d (build-expression->derivation %store "foo" (quasiquote (display (unquote s))) #:guile-for-build (package-derivation s %bootstrap-guile (%current-system))))) (guard (c ((nix-protocol-error? c) #t)) (build-derivations %store (list d)))))))) "Here\u2019s a Greek letter: \u03bb.")) Test end: result-kind: pass actual-value: 191 Test begin: test-name: "current-build-output-port, UTF-8 + garbage" source-file: "tests/store.scm" source-line: 290 source-form: (test-assert "current-build-output-port, UTF-8 + garbage" (string-contains (with-fluids ((%default-port-encoding "UTF-8")) (call-with-output-string (lambda (port) (parameterize ((current-build-output-port port)) (let ((d (build-expression->derivation %store "foo" (quasiquote (begin (use-modules (rnrs io ports)) (display "garbage: ") (put-bytevector (current-output-port) #vu8(128)) (display "lambda: \u03bb\n"))) #:guile-for-build (package-derivation %store %bootstrap-guile)))) (guard (c ((nix-protocol-error? c) #t)) (build-derivations %store (list d)))))))) "garbage: ?lambda: \u03bb")) Test end: result-kind: pass actual-value: 191 Test begin: test-name: "log-file, derivation" source-file: "tests/store.scm" source-line: 310 source-form: (test-assert "log-file, derivation" (let* ((b (add-text-to-store %store "build" "echo $foo > $out" (quote ()))) (s (add-to-store %store "bash" #t "sha256" (search-bootstrap-binary "bash" (%current-system)))) (d (derivation %store "the-thing" s (quasiquote ("-e" (unquote b))) #:env-vars (quasiquote (("foo" unquote (random-text)))) #:inputs (quasiquote (((unquote b)) ((unquote s))))))) (and (build-derivations %store (list d)) (file-exists? (pk (log-file %store (derivation-file-name d))))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "log-file, output file name" source-file: "tests/store.scm" source-line: 322 source-form: (test-assert "log-file, output file name" (let* ((b (add-text-to-store %store "build" "echo $foo > $out" (quote ()))) (s (add-to-store %store "bash" #t "sha256" (search-bootstrap-binary "bash" (%current-system)))) (d (derivation %store "the-thing" s (quasiquote ("-e" (unquote b))) #:env-vars (quasiquote (("foo" unquote (random-text)))) #:inputs (quasiquote (((unquote b)) ((unquote s)))))) (o (derivation->output-path d))) (and (build-derivations %store (list d)) (file-exists? (pk (log-file %store o))) (string=? (log-file %store (derivation-file-name d)) (log-file %store o))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "no substitutes" source-file: "tests/store.scm" source-line: 337 source-form: (test-assert "no substitutes" (with-store s (let* ((d1 (package-derivation s %bootstrap-guile (%current-system))) (d2 (package-derivation s %bootstrap-glibc (%current-system))) (o (map derivation->output-path (list d1 d2)))) (set-build-options s #:use-substitutes? #f) (and (not (has-substitutes? s (derivation-file-name d1))) (not (has-substitutes? s (derivation-file-name d2))) (null? (substitutable-paths s o)) (null? (substitutable-path-info s o)))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "build-things with output path" source-file: "tests/store.scm" source-line: 348 source-form: (test-assert "build-things with output path" (with-store s (let* ((c (random-text)) (d (build-expression->derivation s "substitute-me" (quasiquote (call-with-output-file %output (lambda (p) (display (unquote c) p)))) #:guile-for-build (package-derivation s %bootstrap-guile (%current-system)))) (o (derivation->output-path d))) (set-build-options s #:use-substitutes? #f) (build-things s (list o)) (not (valid-path? s o))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "substitute query" source-file: "tests/store.scm" source-line: 368 source-form: (test-assert "substitute query" (with-store s (let* ((d (package-derivation s %bootstrap-guile (%current-system))) (o (derivation->output-path d))) (with-derivation-narinfo d (false-if-exception (delete-file-recursively (string-append (getenv "XDG_CACHE_HOME") "/guix/substitute"))) (set-build-options s #:use-substitutes? #t #:substitute-urls (%test-substitute-urls)) (and (has-substitutes? s o) (equal? (list o) (substitutable-paths s (list o))) (match (pk (quote spi) (substitutable-path-info s (list o))) (((? substitutable? s)) (and (string=? (substitutable-deriver s) (derivation-file-name d)) (null? (substitutable-references s)) (equal? (substitutable-nar-size s) 1234))))))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "substitute query, alternating URLs" source-file: "tests/store.scm" source-line: 392 source-form: (test-assert "substitute query, alternating URLs" (let* ((d (with-store s (package-derivation s %bootstrap-guile (%current-system)))) (o (derivation->output-path d))) (with-derivation-narinfo d (false-if-exception (delete-file-recursively (string-append (getenv "XDG_CACHE_HOME") "/guix/substitute"))) (and (with-store s (set-build-options s #:use-substitutes? #t #:substitute-urls (%test-substitute-urls)) (has-substitutes? s o)) (with-store s (set-build-options s #:use-substitutes? #t #:substitute-urls (list "http://does-not-exist")) (not (has-substitutes? s o))) (with-store s (set-build-options s #:use-substitutes? #t #:substitute-urls (%test-substitute-urls)) (has-substitutes? s o)))))) Test end: result-kind: fail actual-value: #f actual-error: (srfi-34 #) Test begin: test-name: "substitute" source-file: "tests/store.scm" source-line: 420 source-form: (test-assert "substitute" (with-store s (let* ((c (random-text)) (d (build-expression->derivation s "substitute-me" (quasiquote (call-with-output-file %output (lambda (p) (exit 1) (display (unquote c) p)))) #:guile-for-build (package-derivation s %bootstrap-guile (%current-system)))) (o (derivation->output-path d))) (with-derivation-substitute d c (set-build-options s #:use-substitutes? #t #:substitute-urls (%test-substitute-urls)) (and (has-substitutes? s o) (build-derivations s (list d)) (equal? c (call-with-input-file o get-string-all))))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "substitute + build-things with output path" source-file: "tests/store.scm" source-line: 439 source-form: (test-assert "substitute + build-things with output path" (with-store s (let* ((c (random-text)) (d (build-expression->derivation s "substitute-me" (quasiquote (call-with-output-file %output (lambda (p) (exit 1) (display (unquote c) p)))) #:guile-for-build (package-derivation s %bootstrap-guile (%current-system)))) (o (derivation->output-path d))) (with-derivation-substitute d c (set-build-options s #:use-substitutes? #t #:substitute-urls (%test-substitute-urls)) (and (has-substitutes? s o) (build-things s (list o)) (valid-path? s o) (equal? c (call-with-input-file o get-string-all))))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "substitute, corrupt output hash" source-file: "tests/store.scm" source-line: 459 source-form: (test-assert "substitute, corrupt output hash" (with-store s (let* ((c "hello, world") (d (build-expression->derivation s "corrupt-substitute" (quasiquote (mkdir %output)) #:guile-for-build (package-derivation s %bootstrap-guile (%current-system)))) (o (derivation->output-path d))) (with-derivation-substitute d c (sha256 => (make-bytevector 32 0)) (set-build-options s #:use-substitutes? #t #:fallback? #f #:substitute-urls (%test-substitute-urls)) (and (has-substitutes? s o) (guard (c ((nix-protocol-error? c) (pk (quote corrupt) c) (not (zero? (nix-protocol-error-status c))))) (build-derivations s (list d)) #f)))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "substitute --fallback" source-file: "tests/store.scm" source-line: 489 source-form: (test-assert "substitute --fallback" (with-store s (let* ((t (random-text)) (d (build-expression->derivation s "substitute-me-not" (quasiquote (call-with-output-file %output (lambda (p) (display (unquote t) p)))) #:guile-for-build (package-derivation s %bootstrap-guile (%current-system)))) (o (derivation->output-path d))) (with-derivation-narinfo d (set-build-options s #:use-substitutes? #t #:substitute-urls (%test-substitute-urls)) (and (has-substitutes? s o) (guard (c ((nix-protocol-error? c) (set-build-options s #:use-substitutes? #t #:substitute-urls (%test-substitute-urls) #:fallback? #t) (and (build-derivations s (list d)) (equal? t (call-with-input-file o get-string-all))))) (build-derivations s (list d)) #f)))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "export/import several paths" source-file: "tests/store.scm" source-line: 521 source-form: (test-assert "export/import several paths" (let* ((texts (unfold (cut >= <> 10) (lambda _ (random-text)) #{1+}# 0)) (files (map (cut add-text-to-store %store "text" <>) texts)) (dump (call-with-bytevector-output-port (cut export-paths %store files <>)))) (delete-paths %store files) (and (every (negate file-exists?) files) (let* ((source (open-bytevector-input-port dump)) (imported (import-paths %store source))) (and (equal? imported files) (every file-exists? files) (equal? texts (map (lambda (file) (call-with-input-file file get-string-all)) files))))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "export/import paths, ensure topological order" source-file: "tests/store.scm" source-line: 541 source-form: (test-assert "export/import paths, ensure topological order" (let* ((file0 (add-text-to-store %store "baz" (random-text))) (file1 (add-text-to-store %store "foo" (random-text) (list file0))) (file2 (add-text-to-store %store "bar" (random-text) (list file1))) (files (list file1 file2)) (dump1 (call-with-bytevector-output-port (cute export-paths %store (list file1 file2) <>))) (dump2 (call-with-bytevector-output-port (cute export-paths %store (list file2 file1) <>)))) (delete-paths %store files) (and (every (negate file-exists?) files) (bytevector=? dump1 dump2) (let* ((source (open-bytevector-input-port dump1)) (imported (import-paths %store source))) (and (equal? imported (list file1 file2)) (every file-exists? files) (equal? (list file0) (references %store file1)) (equal? (list file1) (references %store file2))))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "export/import incomplete" source-file: "tests/store.scm" source-line: 563 source-form: (test-assert "export/import incomplete" (let* ((file0 (add-text-to-store %store "baz" (random-text))) (file1 (add-text-to-store %store "foo" (random-text) (list file0))) (file2 (add-text-to-store %store "bar" (random-text) (list file1))) (dump (call-with-bytevector-output-port (cute export-paths %store (list file2) <>)))) (delete-paths %store (list file0 file1 file2)) (guard (c ((nix-protocol-error? c) (and (not (zero? (nix-protocol-error-status c))) (string-contains (nix-protocol-error-message c) "not valid")))) (import-paths %store (open-bytevector-input-port dump))))) Test end: result-kind: pass actual-value: 77 Test begin: test-name: "export/import recursive" source-file: "tests/store.scm" source-line: 580 source-form: (test-assert "export/import recursive" (let* ((file0 (add-text-to-store %store "baz" (random-text))) (file1 (add-text-to-store %store "foo" (random-text) (list file0))) (file2 (add-text-to-store %store "bar" (random-text) (list file1))) (dump (call-with-bytevector-output-port (cute export-paths %store (list file2) <> #:recursive? #t)))) (delete-paths %store (list file0 file1 file2)) (let ((imported (import-paths %store (open-bytevector-input-port dump)))) (and (equal? imported (list file0 file1 file2)) (every file-exists? (list file0 file1 file2)) (equal? (list file0) (references %store file1)) (equal? (list file1) (references %store file2)))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "write-file & export-path yield the same result" source-file: "tests/store.scm" source-line: 596 source-form: (test-assert "write-file & export-path yield the same result" (run-with-store %store (mlet* %store-monad ((drv1 (package->derivation %bootstrap-guile)) (out1 -> (derivation->output-path drv1)) (data -> (unfold (cut >= <> 26) (lambda (i) (random-bytevector 128)) #{1+}# 0)) (build -> (gexp (begin (use-modules (rnrs io ports) (srfi srfi-1)) (let () (define letters (map (lambda (i) (string (integer->char (+ i (char->integer #\a))))) (iota 26))) (define (touch file data) (call-with-output-file file (lambda (port) (put-bytevector port data)))) (mkdir (ungexp output)) (chdir (ungexp output)) (for-each touch (append (drop letters 10) (take letters 10)) (list (ungexp-splicing data))) #t)))) (drv2 (gexp->derivation "bunch" build)) (out2 -> (derivation->output-path drv2)) (item-info -> (store-lift query-path-info))) (mbegin %store-monad (built-derivations (list drv1 drv2)) (foldm %store-monad (lambda (item result) (define ref-hash (let-values (((port get) (open-sha256-port))) (write-file item port) (close-port port) (get))) (>>= (item-info item) (lambda (info) (return (and result (bytevector=? (path-info-hash info) ref-hash)))))) #t (list out1 out2)))) #:guile-for-build (%guile-for-build))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "import corrupt path" source-file: "tests/store.scm" source-line: 662 source-form: (test-assert "import corrupt path" (let* ((text (random-text)) (file (add-text-to-store %store "text" text)) (dump (call-with-bytevector-output-port (cut export-paths %store (list file) <>)))) (delete-paths %store (list file)) (let* ((index (quotient (bytevector-length dump) 4)) (byte (bytevector-u8-ref dump index))) (bytevector-u8-set! dump index (logxor 255 byte))) (and (not (file-exists? file)) (guard (c ((nix-protocol-error? c) (pk (quote c) c) (and (not (zero? (nix-protocol-error-status c))) (string-contains (nix-protocol-error-message c) "corrupt")))) (let* ((source (open-bytevector-input-port dump)) (imported (import-paths %store source))) (pk (quote corrupt-imported) imported) #f))))) Test end: result-kind: pass actual-value: 80 Test begin: test-name: "register-path" source-file: "tests/store.scm" source-line: 685 source-form: (test-assert "register-path" (let ((file (string-append (%store-prefix) "/" (make-string 32 #\f) "-fake"))) (when (valid-path? %store file) (delete-paths %store (list file))) (false-if-exception (delete-file file)) (let ((ref (add-text-to-store %store "ref-of-fake" (random-text))) (drv (string-append file ".drv"))) (call-with-output-file file (cut display "This is a fake store item.\n" <>)) (register-path file #:references (list ref) #:deriver drv) (and (valid-path? %store file) (equal? (references %store file) (list ref)) (null? (valid-derivers %store file)) (null? (referrers %store file)))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "verify-store" source-file: "tests/store.scm" source-line: 705 source-form: (test-assert "verify-store" (let* ((text (random-text)) (file1 (add-text-to-store %store "foo" text)) (file2 (add-text-to-store %store "bar" (random-text) (list file1)))) (and (pk (quote verify1) (verify-store %store)) (begin (delete-file file1) (not (pk (quote verify2) (verify-store %store)))) (begin (call-with-output-file file1 (lambda (port) (display text port))) (pk (quote verify3) (verify-store %store)))))) Test end: result-kind: pass actual-value: #t Test begin: test-name: "verify-store + check-contents" source-file: "tests/store.scm" source-line: 722 source-form: (test-assert "verify-store + check-contents" (with-store s (let* ((text (random-text)) (drv (build-expression->derivation s "corrupt" (quasiquote (let ((out (assoc-ref %outputs "out"))) (call-with-output-file out (lambda (port) (display (unquote text) port))) #t)) #:guile-for-build (package-derivation s %bootstrap-guile (%current-system)))) (file (derivation->output-path drv))) (with-derivation-substitute drv text (and (build-derivations s (list drv)) (verify-store s #:check-contents? #t) (begin (chmod file 420) (call-with-output-file file (lambda (port) (display "corrupt!" port))) #t) (not (verify-store s #:check-contents? #t)) (delete-paths s (list file))))))) Test end: result-kind: pass actual-value: ("/home/bob/guix/test-tmp/store/74qgba0svij37jfnx8lqrd0x55ppyrrf-corrupt") Test begin: test-name: "build-things, check mode" source-file: "tests/store.scm" source-line: 759 source-form: (test-assert "build-things, check mode" (with-store store (call-with-temporary-output-file (lambda (entropy entropy-port) (write (random-text) entropy-port) (force-output entropy-port) (let* ((drv (build-expression->derivation store "non-deterministic" (quasiquote (begin (use-modules (rnrs io ports)) (let ((out (assoc-ref %outputs "out"))) (call-with-output-file out (lambda (port) (display (call-with-input-file (unquote entropy) get-string-all) port))) #t))) #:guile-for-build (package-derivation store %bootstrap-guile (%current-system)))) (file (derivation->output-path drv))) (and (build-things store (list (derivation-file-name drv))) (begin (write (random-text) entropy-port) (force-output entropy-port) (guard (c ((nix-protocol-error? c) (pk (quote determinism-exception) c) (and (not (zero? (nix-protocol-error-status c))) (string-contains (nix-protocol-error-message c) "deterministic")))) (build-things store (list (derivation-file-name drv)) (build-mode check)) #f)))))))) Test end: result-kind: pass actual-value: 79 Test begin: test-name: "build multiple times" source-file: "tests/store.scm" source-line: 796 source-form: (test-assert "build multiple times" (with-store store (set-build-options store #:rounds 2 #:use-substitutes? #f) (call-with-temporary-output-file (lambda (entropy entropy-port) (write (random-text) entropy-port) (force-output entropy-port) (let* ((drv (build-expression->derivation store "non-deterministic" (quasiquote (begin (use-modules (rnrs io ports)) (let ((out (assoc-ref %outputs "out"))) (call-with-output-file out (lambda (port) (display (call-with-input-file (unquote entropy) get-string-all) port) (call-with-output-file (unquote entropy) (lambda (port) (write (quote foobar) port))))) #t))) #:guile-for-build (package-derivation store %bootstrap-guile (%current-system)))) (file (derivation->output-path drv))) (guard (c ((nix-protocol-error? c) (pk (quote multiple-build) c) (and (not (zero? (nix-protocol-error-status c))) (string-contains (nix-protocol-error-message c) "deterministic")))) (current-build-output-port (current-error-port)) (build-things store (list (derivation-file-name drv))) #f)))))) Test end: result-kind: pass actual-value: 77 Test begin: test-name: "store-lower" source-file: "tests/store.scm" source-line: 834 source-form: (test-equal "store-lower" "Lowered." (let* ((add (store-lower text-file)) (file (add %store "foo" "Lowered."))) (call-with-input-file file get-string-all))) Test end: result-kind: pass actual-value: "Lowered." expected-value: "Lowered." Test begin: test-name: "query-path-info" source-file: "tests/store.scm" source-line: 840 source-form: (test-assert "query-path-info" (let* ((ref (add-text-to-store %store "ref" "foo")) (item (add-text-to-store %store "item" "bar" (list ref))) (info (query-path-info %store item))) (and (equal? (path-info-references info) (list ref)) (equal? (path-info-hash info) (sha256 (string->utf8 (call-with-output-string (cut write-file item <>)))))))) Test end: result-kind: pass actual-value: #t Group end: store # of expected passes 45 # of unexpected failures 1