diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-02-11 22:10:14 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-02-11 22:10:14 +0100 |
commit | c8351d9a409879b3d948db3713ce4fe4b787bcd0 (patch) | |
tree | d0986d17137c353d61f83fab08045216fc0e34dd /tests/gexp.scm | |
parent | aee6180c10ab0c63430b7589167bf9e5846e6919 (diff) | |
download | gnu-guix-c8351d9a409879b3d948db3713ce4fe4b787bcd0.tar gnu-guix-c8351d9a409879b3d948db3713ce4fe4b787bcd0.tar.gz |
gexp: Add #:allowed-references parameter to 'gexp->derivation'.
* guix/gexp.scm (lower-references): New procedure.
(gexp->derivation): Add #:allowed-references and honor it.
* tests/gexp.scm ("gexp->derivation #:allowed-references",
"gexp->derivation #:allowed-references, disallowed"): New tests.
* doc/guix.texi (G-Expressions): Update 'gexp->derivation' doc.
Diffstat (limited to 'tests/gexp.scm')
-rw-r--r-- | tests/gexp.scm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm index d80f14344d..03722e4669 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -27,6 +27,7 @@ #:use-module (gnu packages base) #:use-module (gnu packages bootstrap) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-34) #:use-module (srfi srfi-64) #:use-module (rnrs io ports) #:use-module (ice-9 match) @@ -396,6 +397,30 @@ (equal? (call-with-input-file g-guile read) (list (derivation->output-path guile-drv))))))) +(test-assertm "gexp->derivation #:allowed-references" + (mlet %store-monad ((drv (gexp->derivation "allowed-refs" + #~(begin + (mkdir #$output) + (chdir #$output) + (symlink #$output "self") + (symlink #$%bootstrap-guile + "guile")) + #:allowed-references + (list "out" %bootstrap-guile)))) + (built-derivations (list drv)))) + +(test-assert "gexp->derivation #:allowed-references, disallowed" + (let ((drv (run-with-store %store + (gexp->derivation "allowed-refs" + #~(begin + (mkdir #$output) + (chdir #$output) + (symlink #$%bootstrap-guile "guile")) + #:allowed-references '())))) + (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")) |