From 22f95e028f038cee342f455dfc55bd32b804907c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 16 Mar 2019 15:11:29 +0100 Subject: tests: Add 'with-environment-variable'. * tests/scripts.scm (with-environment-variable): Move to... * guix/tests.scm (with-environment-variable): ... here. * tests/build-utils.scm ("wrap-program, one input, multiple calls"): Use it instead of 'setenv'. --- tests/build-utils.scm | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'tests/build-utils.scm') diff --git a/tests/build-utils.scm b/tests/build-utils.scm index 7d49446f66..03216f9a35 100644 --- a/tests/build-utils.scm +++ b/tests/build-utils.scm @@ -107,19 +107,21 @@ ;; it can't know about the bootstrap bash in the store, since it's not ;; named "bash". Help it out a bit by providing a symlink it this ;; package's output. - (setenv "PATH" (dirname bash)) - (wrap-program foo `("GUIX_FOO" prefix ("hello"))) - (wrap-program foo `("GUIX_BAR" prefix ("world"))) - - ;; The bootstrap Bash is linked against an old libc and would abort with - ;; an assertion failure when trying to load incompatible locale data. - (unsetenv "LOCPATH") - - (let* ((pipe (open-input-pipe foo)) - (str (get-string-all pipe))) - (with-directory-excursion directory - (for-each delete-file '("foo" ".foo-real"))) - (and (zero? (close-pipe pipe)) - str)))))) + (with-environment-variable "PATH" (dirname bash) + (wrap-program foo `("GUIX_FOO" prefix ("hello"))) + (wrap-program foo `("GUIX_BAR" prefix ("world"))) + + ;; The bootstrap Bash is linked against an old libc and would abort + ;; with an assertion failure when trying to load incompatible locale + ;; data. + (unsetenv "LOCPATH") + + (let* ((pipe (open-input-pipe foo)) + (str (get-string-all pipe))) + (with-directory-excursion directory + (for-each delete-file '("foo" ".foo-real"))) + (and (zero? (close-pipe pipe)) + str))))))) + (test-end) -- cgit v1.2.3