summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/derivations.scm3
-rw-r--r--tests/guix-authenticate.sh13
-rw-r--r--tests/utils.scm31
3 files changed, 46 insertions, 1 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index e87662a198..3903a563a8 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -524,6 +524,9 @@ Deriver: ~a~%"
(basename
(derivation-file-name drv))))) ; Deriver
+ ;; Make sure substitutes are usable.
+ (set-build-options store #:use-substitutes? #t)
+
(let-values (((build download)
(derivation-prerequisites-to-build store drv))
((build* download*)
diff --git a/tests/guix-authenticate.sh b/tests/guix-authenticate.sh
index aa6f9e9f01..35ec7ffd6a 100644
--- a/tests/guix-authenticate.sh
+++ b/tests/guix-authenticate.sh
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
@@ -42,6 +42,17 @@ hash2="`guix authenticate rsautl -verify \
-pubin -in $sig`"
test "$hash2" = `cat "$hash"`
+# Same thing in a pipeline, using the command line syntax that Nix/Crypto.pm
+# uses.
+hash2="` \
+ cat "$hash" \
+ | guix authenticate rsautl -sign \
+ -inkey "$abs_top_srcdir/tests/signing-key.sec" \
+ | guix authenticate rsautl -verify \
+ -inkey $abs_top_srcdir/tests/signing-key.pub \
+ -pubin`"
+test "$hash2" = `cat "$hash"`
+
# Detect corrupt signatures.
if guix authenticate rsautl -verify \
-inkey "$abs_top_srcdir/tests/signing-key.pub" \
diff --git a/tests/utils.scm b/tests/utils.scm
index adac5d4381..1da847689c 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -142,6 +142,37 @@
(append pids1 pids2)))
(equal? (get-bytevector-all decompressed) data)))))
+(test-assert "filtered-port, does not exist"
+ (let* ((file (search-path %load-path "guix.scm"))
+ (input (open-file file "r0b")))
+ (let-values (((port pids)
+ (filtered-port '("/does/not/exist") input)))
+ (any (compose (negate zero?) cdr waitpid)
+ pids))))
+
+(test-assert "compressed-port, decompressed-port, non-file"
+ (let ((data (call-with-input-file (search-path %load-path "guix.scm")
+ get-bytevector-all)))
+ (let*-values (((compressed pids1)
+ (compressed-port 'xz (open-bytevector-input-port data)))
+ ((decompressed pids2)
+ (decompressed-port 'xz compressed)))
+ (and (every (compose zero? cdr waitpid)
+ (append pids1 pids2))
+ (equal? (get-bytevector-all decompressed) data)))))
+
+(false-if-exception (delete-file temp-file))
+(test-assert "compressed-output-port + decompressed-port"
+ (let* ((file (search-path %load-path "guix/derivations.scm"))
+ (data (call-with-input-file file get-bytevector-all)))
+ (call-with-compressed-output-port 'xz (open-file temp-file "w0b")
+ (lambda (compressed)
+ (put-bytevector compressed data)))
+
+ (bytevector=? data
+ (call-with-decompressed-port 'xz (open-file temp-file "r0b")
+ get-bytevector-all))))
+
(false-if-exception (delete-file temp-file))
(test-equal "fcntl-flock wait"
42 ; the child's exit status