aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/derivations.scm29
-rw-r--r--tests/gexp.scm37
-rw-r--r--tests/guix-environment.sh8
3 files changed, 74 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index 98018a45e3..1d460df4cc 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -895,6 +895,35 @@
(((= derivation-file-name build))
(string=? build (derivation-file-name drv)))))))))
+(test-assert "derivation-build-plan and substitutes, non-substitutable dep"
+ (with-store store
+ (let* ((drv1 (build-expression->derivation store "prereq-no-subst"
+ (random 1000)
+ #:substitutable? #f))
+ (drv2 (build-expression->derivation store "substitutable"
+ (random 1000)
+ #:inputs `(("dep" ,drv1)))))
+
+ ;; Make sure substitutes are usable.
+ (set-build-options store #:use-substitutes? #t
+ #:substitute-urls (%test-substitute-urls))
+
+ (with-derivation-narinfo drv2
+ (sha256 => (make-bytevector 32 0))
+ (references => (list (derivation->output-path drv1)))
+
+ (let-values (((build download)
+ (derivation-build-plan store
+ (list (derivation-input drv2)))))
+ ;; Although DRV2 is available as a substitute, we must build its
+ ;; dependency, DRV1, due to #:substitutable? #f.
+ (and (match download
+ (((= substitutable-path item))
+ (string=? item (derivation->output-path drv2))))
+ (match build
+ (((= derivation-file-name build))
+ (string=? build (derivation-file-name drv1))))))))))
+
(test-assert "derivation-build-plan and substitutes, local build"
(with-store store
(let* ((drv (build-expression->derivation store "prereq-subst-local"
diff --git a/tests/gexp.scm b/tests/gexp.scm
index cee2c96610..23904fce2e 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -832,6 +832,43 @@
(built-derivations (list drv))
(return (equal? '(42 84) (call-with-input-file out read))))))
+(test-assertm "lower-gexp"
+ (mlet* %store-monad
+ ((extension -> %extension-package)
+ (extension-drv (package->derivation %extension-package))
+ (coreutils-drv (package->derivation coreutils))
+ (exp -> (with-extensions (list extension)
+ (with-imported-modules `((guix build utils))
+ #~(begin
+ (use-modules (guix build utils)
+ (hg2g))
+ #$coreutils:debug
+ mkdir-p
+ the-answer))))
+ (lexp (lower-gexp exp
+ #:effective-version "2.0")))
+ (define (matching-input drv output)
+ (lambda (input)
+ (and (eq? (gexp-input-thing input) drv)
+ (string=? (gexp-input-output input) output))))
+
+ (mbegin %store-monad
+ (return (and (find (matching-input extension-drv "out")
+ (lowered-gexp-inputs (pk 'lexp lexp)))
+ (find (matching-input coreutils-drv "debug")
+ (lowered-gexp-inputs lexp))
+ (member (string-append
+ (derivation->output-path extension-drv)
+ "/share/guile/site/2.0")
+ (lowered-gexp-load-path lexp))
+ (= 2 (length (lowered-gexp-load-path lexp)))
+ (member (string-append
+ (derivation->output-path extension-drv)
+ "/lib/guile/2.0/site-ccache")
+ (lowered-gexp-load-compiled-path lexp))
+ (= 2 (length (lowered-gexp-load-compiled-path lexp)))
+ (eq? (lowered-gexp-guile lexp) (%guile-for-build)))))))
+
(test-assertm "gexp->derivation #:references-graphs"
(mlet* %store-monad
((one (text-file "one" (random-text)))
diff --git a/tests/guix-environment.sh b/tests/guix-environment.sh
index fb1c1a022d..067ae93822 100644
--- a/tests/guix-environment.sh
+++ b/tests/guix-environment.sh
@@ -84,6 +84,14 @@ echo "(use-modules (guix profiles) (gnu packages bootstrap))
guix environment --bootstrap --manifest=$tmpdir/manifest.scm --pure \
-- "$SHELL" -c 'test -f "$GUIX_ENVIRONMENT/bin/guile"'
+# if not sharing CWD, chdir home
+(
+ cd "$tmpdir" \
+ && guix environment --bootstrap --container --no-cwd --user=foo \
+ --ad-hoc guile-bootstrap --pure \
+ -- /bin/sh -c 'test $(pwd) == "/home/foo" -a ! -d '"$tmpdir"
+)
+
# Make sure '-r' works as expected.
rm -f "$gcroot"
expected="`guix environment --bootstrap --ad-hoc guile-bootstrap \