diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/utils.scm | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/tests/utils.scm b/tests/utils.scm index adbfdf55baa..1da847689c6 100644 --- a/tests/utils.scm +++ b/tests/utils.scm | |||
| @@ -162,23 +162,16 @@ | |||
| 162 | (equal? (get-bytevector-all decompressed) data))))) | 162 | (equal? (get-bytevector-all decompressed) data))))) |
| 163 | 163 | ||
| 164 | (false-if-exception (delete-file temp-file)) | 164 | (false-if-exception (delete-file temp-file)) |
| 165 | (test-equal "compressed-output-port + decompressed-port" | 165 | (test-assert "compressed-output-port + decompressed-port" |
| 166 | '((0) "Hello, compressed port!") | 166 | (let* ((file (search-path %load-path "guix/derivations.scm")) |
| 167 | (let ((text "Hello, compressed port!") | 167 | (data (call-with-input-file file get-bytevector-all))) |
| 168 | (output (open-file temp-file "w0b"))) | 168 | (call-with-compressed-output-port 'xz (open-file temp-file "w0b") |
| 169 | (let-values (((compressed pids) | 169 | (lambda (compressed) |
| 170 | (compressed-output-port 'xz output))) | 170 | (put-bytevector compressed data))) |
| 171 | (display text compressed) | 171 | |
| 172 | (close-port compressed) | 172 | (bytevector=? data |
| 173 | (close-port output) | 173 | (call-with-decompressed-port 'xz (open-file temp-file "r0b") |
| 174 | (and (every (compose zero? cdr waitpid) pids) | 174 | get-bytevector-all)))) |
| 175 | (let*-values (((input) | ||
| 176 | (open-file temp-file "r0b")) | ||
| 177 | ((decompressed pids) | ||
| 178 | (decompressed-port 'xz input))) | ||
| 179 | (let ((str (get-string-all decompressed))) | ||
| 180 | (list (map (compose cdr waitpid) pids) | ||
| 181 | str))))))) | ||
| 182 | 175 | ||
| 183 | (false-if-exception (delete-file temp-file)) | 176 | (false-if-exception (delete-file temp-file)) |
| 184 | (test-equal "fcntl-flock wait" | 177 | (test-equal "fcntl-flock wait" |
