diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/derivations.scm | 19 | ||||
-rw-r--r-- | tests/gexp.scm | 24 | ||||
-rw-r--r-- | tests/pypi.scm | 3 | ||||
-rw-r--r-- | tests/store.scm | 6 |
4 files changed, 50 insertions, 2 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm index 3c35218040..4d3b82fe1a 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -504,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'. 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")) diff --git a/tests/pypi.scm b/tests/pypi.scm index 960b8cd32a..cf351a542f 100644 --- a/tests/pypi.scm +++ b/tests/pypi.scm @@ -84,7 +84,8 @@ baz > 13.37") ('version "1.0.0") ('source ('origin ('method 'url-fetch) - ('uri (pypi-uri "foo" version)) + ('uri (string-append "https://example.com/foo-" + version ".tar.gz")) ('sha256 ('base32 (? string? hash))))) diff --git a/tests/store.scm b/tests/store.scm index 3d32d52758..f7db7df966 100644 --- a/tests/store.scm +++ b/tests/store.scm @@ -450,7 +450,11 @@ (with-store s ;the right one again (set-build-options s #:use-substitutes? #t #:substitute-urls (%test-substitute-urls)) - (has-substitutes? s o)))))) + (has-substitutes? s o)) + (with-store s ;empty list of URLs + (set-build-options s #:use-substitutes? #t + #:substitute-urls '()) + (not (has-substitutes? s o))))))) (test-assert "substitute" (with-store s |