tests: Check the mtime and permissions of substituted items.

* tests/store.scm ("substitute")
("substitute + build-things with output path")
("substitute + build-things with specific output"): Call 'canonical-file?'.
* tests/substitute.scm ("substitute, authorized key"): Check the mtime
and permissions of "substitute-retrieved".
This commit is contained in:
Ludovic Courtès 2020-12-14 14:33:06 +01:00
parent 9dfa20a22a
commit 77a1efed9e
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 7 additions and 2 deletions

View file

@ -715,6 +715,7 @@ (define (same? x y)
#:substitute-urls (%test-substitute-urls))
(and (has-substitutes? s o)
(build-derivations s (list d))
(canonical-file? o)
(equal? c (call-with-input-file o get-string-all)))))))
(test-assert "substitute + build-things with output path"
@ -735,6 +736,7 @@ (define (same? x y)
(and (has-substitutes? s o)
(build-things s (list o)) ;give the output path
(valid-path? s o)
(canonical-file? o)
(equal? c (call-with-input-file o get-string-all)))))))
(test-assert "substitute + build-things with specific output"
@ -755,6 +757,7 @@ (define (same? x y)
(build-things s `((,(derivation-file-name d) . "out")))
(valid-path? s o)
(canonical-file? o)
(equal? c (call-with-input-file o get-string-all)))))))
(test-assert "substitute, corrupt output hash"

View file

@ -378,7 +378,7 @@ (define-syntax-rule (with-narinfo* narinfo directory body ...)
(guix-substitute "--substitute")))))
(test-equal "substitute, authorized key"
"Substitutable data."
'("Substitutable data." 1 #o444)
(with-narinfo (string-append %narinfo "Signature: "
(signature-field %narinfo))
(dynamic-wind
@ -387,7 +387,9 @@ (define-syntax-rule (with-narinfo* narinfo directory body ...)
(request-substitution (string-append (%store-prefix)
"/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo")
"substitute-retrieved")
(call-with-input-file "substitute-retrieved" get-string-all))
(list (call-with-input-file "substitute-retrieved" get-string-all)
(stat:mtime (lstat "substitute-retrieved"))
(stat:perms (lstat "substitute-retrieved"))))
(lambda ()
(false-if-exception (delete-file "substitute-retrieved"))))))