diff options
Diffstat (limited to 'tests/substitute.scm')
| -rw-r--r-- | tests/substitute.scm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/substitute.scm b/tests/substitute.scm index 10b74db084e..086bd588358 100644 --- a/tests/substitute.scm +++ b/tests/substitute.scm | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #:use-module (rnrs io ports) | 39 | #:use-module (rnrs io ports) |
| 40 | #:use-module (web uri) | 40 | #:use-module (web uri) |
| 41 | #:use-module (ice-9 regex) | 41 | #:use-module (ice-9 regex) |
| 42 | #:use-module (ice-9 binary-ports) | ||
| 42 | #:use-module (srfi srfi-11) | 43 | #:use-module (srfi srfi-11) |
| 43 | #:use-module (srfi srfi-26) | 44 | #:use-module (srfi srfi-26) |
| 44 | #:use-module (srfi srfi-34) | 45 | #:use-module (srfi srfi-34) |
| @@ -142,6 +143,21 @@ version identifier.." | |||
| 142 | ;; <https://www.rfc-editor.org/rfc/rfc5737>. | 143 | ;; <https://www.rfc-editor.org/rfc/rfc5737>. |
| 143 | "http://203.0.113.1") | 144 | "http://203.0.113.1") |
| 144 | 145 | ||
| 146 | (define (plain-file-nar-sha256 string) | ||
| 147 | (sha256 (call-with-output-bytevector | ||
| 148 | (lambda (port) | ||
| 149 | (let ((bv (string->utf8 string))) | ||
| 150 | (call-with-input-bytevector | ||
| 151 | bv | ||
| 152 | (lambda (contents) | ||
| 153 | (write-file-tree #t port | ||
| 154 | #:file-type+size | ||
| 155 | (lambda (_) | ||
| 156 | (values 'regular | ||
| 157 | (bytevector-length | ||
| 158 | bv))) | ||
| 159 | #:file-port | ||
| 160 | (const contents))))))))) | ||
| 145 | 161 | ||
| 146 | (define %narinfo | 162 | (define %narinfo |
| 147 | ;; Skeleton of the narinfo used below. | 163 | ;; Skeleton of the narinfo used below. |
| @@ -150,7 +166,7 @@ version identifier.." | |||
| 150 | URL: example.nar | 166 | URL: example.nar |
| 151 | Compression: none | 167 | Compression: none |
| 152 | NarHash: sha256:" (bytevector->nix-base32-string | 168 | NarHash: sha256:" (bytevector->nix-base32-string |
| 153 | (sha256 (string->utf8 "Substitutable data."))) " | 169 | (plain-file-nar-sha256 "Substitutable data.")) " |
| 154 | NarSize: 42 | 170 | NarSize: 42 |
| 155 | References: bar baz | 171 | References: bar baz |
| 156 | Deriver: " (%store-prefix) "/foo.drv | 172 | Deriver: " (%store-prefix) "/foo.drv |
| @@ -819,7 +835,7 @@ Compression: lzip | |||
| 819 | URL: example.nar | 835 | URL: example.nar |
| 820 | Compression: none | 836 | Compression: none |
| 821 | NarHash: sha256:" (bytevector->nix-base32-string | 837 | NarHash: sha256:" (bytevector->nix-base32-string |
| 822 | (sha256 (string->utf8 "Substitutable data."))) " | 838 | (plain-file-nar-sha256 "Substitutable data.")) " |
| 823 | NarSize: 42 | 839 | NarSize: 42 |
| 824 | References: bar baz | 840 | References: bar baz |
| 825 | Deriver: " (%store-prefix) "/foo.drv | 841 | Deriver: " (%store-prefix) "/foo.drv |
