diff options
author | Leo Famulari <leo@famulari.name> | 2016-03-21 12:22:31 -0400 |
---|---|---|
committer | Leo Famulari <leo@famulari.name> | 2016-03-21 12:22:31 -0400 |
commit | 09ec508a4c14d1bc09622d98f796548d79ab0552 (patch) | |
tree | 86cc5a2a67d35ad796bfa33d67869d670d65822e /tests/derivations.scm | |
parent | 2dbed47f5c09347c9af42c5f5bacfccbc1ab4aff (diff) | |
parent | 71cafa0472a15f2234e24d3c6d8019ebb38685b0 (diff) | |
download | guix-09ec508a4c14d1bc09622d98f796548d79ab0552.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'tests/derivations.scm')
-rw-r--r-- | tests/derivations.scm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm index 9b53019cc5..4d3b82fe1a 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -18,6 +18,7 @@ (define-module (test-derivations) #:use-module (guix derivations) + #:use-module (guix grafts) #:use-module (guix store) #:use-module (guix utils) #:use-module (guix hash) @@ -44,6 +45,9 @@ (define %store (open-connection-for-tests)) +;; Globally disable grafts because they can trigger early builds. +(%graft? #f) + (define (bootstrap-binary name) (let ((bin (search-bootstrap-binary name (%current-system)))) (and %store @@ -71,6 +75,7 @@ (lambda (e1 e2) (string<? (car e1) (car e2))))) + (test-begin "derivations") (test-assert "parse & export" @@ -499,6 +504,25 @@ (build-derivations %store (list drv)) #f))) +(test-assert "derivation #:disallowed-references, ok" + (let ((drv (derivation %store "disallowed" %bash + '("-c" "echo hello > $out") + #:inputs `((,%bash)) + #:disallowed-references '("out")))) + (build-derivations %store (list drv)))) + +(test-assert "derivation #:disallowed-references, not ok" + (let* ((txt (add-text-to-store %store "foo" "Hello, world.")) + (drv (derivation %store "disdisallowed" %bash + `("-c" ,(string-append "echo " txt "> $out")) + #:inputs `((,%bash) (,txt)) + #:disallowed-references (list txt)))) + (guard (c ((nix-protocol-error? c) + ;; There's no specific error message to check for. + #t)) + (build-derivations %store (list drv)) + #f))) + ;; Here we should get the value of $NIX_STATE_DIR that the daemon sees, which ;; is a unique value for each test process; this value is the same as the one ;; we see in the process executing this file since it is set by 'test-env'. |