summary refs log tree commit diff
path: root/tests/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-03-20 22:44:03 +0100
committerLudovic Courtès <ludo@gnu.org>2016-03-20 22:46:14 +0100
commit3f4ecf32291779d9f75493a5e75cdbea2bc51adb (patch)
tree7e7fee0ef0bb0058f99c37de39a5838b30542530 /tests/gexp.scm
parent35b5ca7869396b8d37539b9279147c100eee12f1 (diff)
downloadguix-3f4ecf32291779d9f75493a5e75cdbea2bc51adb.tar.gz
gexp: Add #:disallowed-references.
* guix/gexp.scm (gexp->derivation): Add #:disallowed-references and
honor it.
* tests/gexp.scm ("gexp->derivation #:disallowed-references, allowed")
("gexp->derivation #:disallowed-references"): New tests.
* doc/guix.texi (G-Expressions): Adjust accordingly.
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r--tests/gexp.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index d343dc3329..75b907abee 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -600,6 +600,30 @@
       (build-derivations %store (list drv))
       #f)))
 
+(test-assertm "gexp->derivation #:disallowed-references, allowed"
+  (mlet %store-monad ((drv (gexp->derivation "disallowed-refs"
+                                             #~(begin
+                                                 (mkdir #$output)
+                                                 (chdir #$output)
+                                                 (symlink #$output "self")
+                                                 (symlink #$%bootstrap-guile
+                                                          "guile"))
+                                             #:disallowed-references '())))
+    (built-derivations (list drv))))
+
+
+(test-assert "gexp->derivation #:disallowed-references"
+  (let ((drv (run-with-store %store
+               (gexp->derivation "disallowed-refs"
+                                 #~(begin
+                                     (mkdir #$output)
+                                     (chdir #$output)
+                                     (symlink #$%bootstrap-guile "guile"))
+                                 #:disallowed-references (list %bootstrap-guile)))))
+    (guard (c ((nix-protocol-error? c) #t))
+      (build-derivations %store (list drv))
+      #f)))
+
 (define shebang
   (string-append "#!" (derivation->output-path (%guile-for-build))
                  "/bin/guile --no-auto-compile"))