aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-06 17:23:14 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-06 17:23:14 +0200
commit872c69d00e861f86fa4caaadbaa136f46c9db358 (patch)
treed50176869e67baf821b151d6bcc879ef0bd554fe /tests
parenta4d48cc24d0f6bc3c45adf92925d7d901f0763d3 (diff)
parentb15d79dfe65353f4101b0ad653c97e3ef0d4a8b7 (diff)
downloadguix-872c69d00e861f86fa4caaadbaa136f46c9db358.tar
guix-872c69d00e861f86fa4caaadbaa136f46c9db358.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'tests')
-rw-r--r--tests/derivations.scm37
-rw-r--r--tests/gexp.scm8
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index 0b785029a7..87609108d6 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -390,6 +390,43 @@
((p2 . _)
(string<? p1 p2)))))))))))))))
+(test-assert "derivation #:allowed-references, ok"
+ (let ((drv (derivation %store "allowed" %bash
+ '("-c" "echo hello > $out")
+ #:inputs `((,%bash))
+ #:allowed-references '())))
+ (build-derivations %store (list drv))))
+
+(test-assert "derivation #:allowed-references, not allowed"
+ (let* ((txt (add-text-to-store %store "foo" "Hello, world."))
+ (drv (derivation %store "disallowed" %bash
+ `("-c" ,(string-append "echo " txt "> $out"))
+ #:inputs `((,%bash) (,txt))
+ #:allowed-references '())))
+ (guard (c ((nix-protocol-error? c)
+ ;; There's no specific error message to check for.
+ #t))
+ (build-derivations %store (list drv))
+ #f)))
+
+(test-assert "derivation #:allowed-references, self allowed"
+ (let ((drv (derivation %store "allowed" %bash
+ '("-c" "echo $out > $out")
+ #:inputs `((,%bash))
+ #:allowed-references '("out"))))
+ (build-derivations %store (list drv))))
+
+(test-assert "derivation #:allowed-references, self not allowed"
+ (let ((drv (derivation %store "disallowed" %bash
+ `("-c" ,"echo $out > $out")
+ #:inputs `((,%bash))
+ #:allowed-references '())))
+ (guard (c ((nix-protocol-error? c)
+ ;; There's no specific error message to check for.
+ #t))
+ (build-derivations %store (list drv))
+ #f)))
+
(define %coreutils
(false-if-exception
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 21606b510b..60adf497ed 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -211,6 +211,14 @@
(return (string=? (readlink (string-append out "/foo"))
guile))))
+(define shebang
+ (string-append (derivation->output-path guile-for-build)
+ "/bin/guile --no-auto-compile"))
+
+;; If we're going to hit the silly shebang limit (128 chars on Linux-based
+;; systems), then skip the following test.
+(test-skip (if (> (string-length shebang) 127) 1 0))
+
(test-assertm "gexp->script"
(mlet* %store-monad ((n -> (random (expt 2 50)))
(exp -> (gexp