summaryrefslogtreecommitdiff
path: root/tests/profiles.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-06-15 10:02:48 +0200
committerLudovic Courtès <ludo@gnu.org>2021-06-18 14:18:07 +0200
commitee61777a326c3395518dee5e50ffc9c35ae53f3d (patch)
tree3b939e0c7a0ea69383d21cae4cfd0e91d8a53ceb /tests/profiles.scm
parentc5b1b48f09bb9af60aef5d48191b284d4b281a34 (diff)
profiles: Add 'load-profile'.
* guix/profiles.scm (%precious-variables): New variable. (purify-environment, load-profile): New procedures. * guix/scripts/environment.scm (%precious-variables) (purify-environment, create-environment): Remove. (launch-environment): Call 'load-profile' instead of 'create-environment'. * tests/profiles.scm ("load-profile"): New test.
Diffstat (limited to 'tests/profiles.scm')
-rw-r--r--tests/profiles.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/profiles.scm b/tests/profiles.scm
index ce77711d63..1a06ff88f3 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -279,6 +279,33 @@
(string=? (dirname (readlink bindir))
(derivation->output-path guile))))))
+(test-assertm "load-profile"
+ (mlet* %store-monad
+ ((entry -> (package->manifest-entry %bootstrap-guile))
+ (guile (package->derivation %bootstrap-guile))
+ (drv (profile-derivation (manifest (list entry))
+ #:hooks '()
+ #:locales? #f))
+ (profile -> (derivation->output-path drv))
+ (bindir -> (string-append profile "/bin"))
+ (_ (built-derivations (list drv))))
+ (define-syntax-rule (with-environment-excursion exp ...)
+ (let ((env (environ)))
+ (dynamic-wind
+ (const #t)
+ (lambda () exp ...)
+ (lambda () (environ env)))))
+
+ (return (and (with-environment-excursion
+ (load-profile profile)
+ (and (string-prefix? (string-append bindir ":")
+ (getenv "PATH"))
+ (getenv "GUILE_LOAD_PATH")))
+ (with-environment-excursion
+ (load-profile profile #:pure? #t #:white-list '())
+ (equal? (list (string-append "PATH=" bindir))
+ (environ)))))))
+
(test-assertm "<profile>"
(mlet* %store-monad
((entry -> (package->manifest-entry %bootstrap-guile))