summaryrefslogtreecommitdiff
path: root/tests
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
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')
-rw-r--r--tests/profiles.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/profiles.scm b/tests/profiles.scm
index ce77711d63c..1a06ff88f34 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -279,6 +279,33 @@
279 (string=? (dirname (readlink bindir)) 279 (string=? (dirname (readlink bindir))
280 (derivation->output-path guile)))))) 280 (derivation->output-path guile))))))
281 281
282(test-assertm "load-profile"
283 (mlet* %store-monad
284 ((entry -> (package->manifest-entry %bootstrap-guile))
285 (guile (package->derivation %bootstrap-guile))
286 (drv (profile-derivation (manifest (list entry))
287 #:hooks '()
288 #:locales? #f))
289 (profile -> (derivation->output-path drv))
290 (bindir -> (string-append profile "/bin"))
291 (_ (built-derivations (list drv))))
292 (define-syntax-rule (with-environment-excursion exp ...)
293 (let ((env (environ)))
294 (dynamic-wind
295 (const #t)
296 (lambda () exp ...)
297 (lambda () (environ env)))))
298
299 (return (and (with-environment-excursion
300 (load-profile profile)
301 (and (string-prefix? (string-append bindir ":")
302 (getenv "PATH"))
303 (getenv "GUILE_LOAD_PATH")))
304 (with-environment-excursion
305 (load-profile profile #:pure? #t #:white-list '())
306 (equal? (list (string-append "PATH=" bindir))
307 (environ)))))))
308
282(test-assertm "<profile>" 309(test-assertm "<profile>"
283 (mlet* %store-monad 310 (mlet* %store-monad
284 ((entry -> (package->manifest-entry %bootstrap-guile)) 311 ((entry -> (package->manifest-entry %bootstrap-guile))