diff options
| author | Marius Bakke <mbakke@fastmail.com> | 2019-03-23 23:16:55 +0100 |
|---|---|---|
| committer | Marius Bakke <mbakke@fastmail.com> | 2019-03-23 23:16:55 +0100 |
| commit | 8c14f7f8a7ab0722bf4c9f92fd28ae85514d564f (patch) | |
| tree | adc5d29e9c2dcda5befa0ca81f1af8df23294947 /tests/build-utils.scm | |
| parent | 2f33a7321e5e37d37f57c229c8079cb4ffd10834 (diff) | |
| parent | 3374e9207f5244c20402a3c5513fe562140fef47 (diff) | |
Merge branch 'staging' into core-updates
Diffstat (limited to 'tests/build-utils.scm')
| -rw-r--r-- | tests/build-utils.scm | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/tests/build-utils.scm b/tests/build-utils.scm index 1c9084514d0..5678bb6a22f 100644 --- a/tests/build-utils.scm +++ b/tests/build-utils.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2015, 2016 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012, 2015, 2016, 2019 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net> | 3 | ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net> |
| 4 | ;;; | 4 | ;;; |
| 5 | ;;; This file is part of GNU Guix. | 5 | ;;; This file is part of GNU Guix. |
| @@ -21,11 +21,14 @@ | |||
| 21 | (define-module (test-build-utils) | 21 | (define-module (test-build-utils) |
| 22 | #:use-module (guix tests) | 22 | #:use-module (guix tests) |
| 23 | #:use-module (guix build utils) | 23 | #:use-module (guix build utils) |
| 24 | #:use-module ((gnu build bootloader) | ||
| 25 | #:select (invoke/quiet)) | ||
| 24 | #:use-module ((guix utils) | 26 | #:use-module ((guix utils) |
| 25 | #:select (%current-system call-with-temporary-directory)) | 27 | #:select (%current-system call-with-temporary-directory)) |
| 26 | #:use-module (gnu packages) | 28 | #:use-module (gnu packages) |
| 27 | #:use-module (gnu packages bootstrap) | 29 | #:use-module (gnu packages bootstrap) |
| 28 | #:use-module (srfi srfi-34) | 30 | #:use-module (srfi srfi-34) |
| 31 | #:use-module (srfi srfi-35) | ||
| 29 | #:use-module (srfi srfi-64) | 32 | #:use-module (srfi srfi-64) |
| 30 | #:use-module (rnrs io ports) | 33 | #:use-module (rnrs io ports) |
| 31 | #:use-module (ice-9 popen)) | 34 | #:use-module (ice-9 popen)) |
| @@ -108,20 +111,39 @@ | |||
| 108 | ;; it can't know about the bootstrap bash in the store, since it's not | 111 | ;; it can't know about the bootstrap bash in the store, since it's not |
| 109 | ;; named "bash". Help it out a bit by providing a symlink it this | 112 | ;; named "bash". Help it out a bit by providing a symlink it this |
| 110 | ;; package's output. | 113 | ;; package's output. |
| 111 | (setenv "PATH" (dirname bash)) | 114 | (with-environment-variable "PATH" (dirname bash) |
| 112 | (wrap-program foo `("GUIX_FOO" prefix ("hello"))) | 115 | (wrap-program foo `("GUIX_FOO" prefix ("hello"))) |
| 113 | (wrap-program foo `("GUIX_BAR" prefix ("world"))) | 116 | (wrap-program foo `("GUIX_BAR" prefix ("world"))) |
| 114 | 117 | ||
| 115 | ;; The bootstrap Bash is linked against an old libc and would abort with | 118 | ;; The bootstrap Bash is linked against an old libc and would abort |
| 116 | ;; an assertion failure when trying to load incompatible locale data. | 119 | ;; with an assertion failure when trying to load incompatible locale |
| 117 | (unsetenv "LOCPATH") | 120 | ;; data. |
| 118 | 121 | (unsetenv "LOCPATH") | |
| 119 | (let* ((pipe (open-input-pipe foo)) | 122 | |
| 120 | (str (get-string-all pipe))) | 123 | (let* ((pipe (open-input-pipe foo)) |
| 121 | (with-directory-excursion directory | 124 | (str (get-string-all pipe))) |
| 122 | (for-each delete-file '("foo" ".foo-real"))) | 125 | (with-directory-excursion directory |
| 123 | (and (zero? (close-pipe pipe)) | 126 | (for-each delete-file '("foo" ".foo-real"))) |
| 124 | str)))))) | 127 | (and (zero? (close-pipe pipe)) |
| 128 | str))))))) | ||
| 129 | |||
| 130 | (test-assert "invoke/quiet, success" | ||
| 131 | (begin | ||
| 132 | (invoke/quiet "true") | ||
| 133 | #t)) | ||
| 134 | |||
| 135 | (test-assert "invoke/quiet, failure" | ||
| 136 | (guard (c ((message-condition? c) | ||
| 137 | (string-contains (condition-message c) "This is an error."))) | ||
| 138 | (invoke/quiet "sh" "-c" "echo This is an error. ; false") | ||
| 139 | #f)) | ||
| 140 | |||
| 141 | (test-assert "invoke/quiet, failure, message on stderr" | ||
| 142 | (guard (c ((message-condition? c) | ||
| 143 | (string-contains (condition-message c) | ||
| 144 | "This is another error."))) | ||
| 145 | (invoke/quiet "sh" "-c" "echo This is another error. >&2 ; false") | ||
| 146 | #f)) | ||
| 125 | 147 | ||
| 126 | (let ((script-contents "\ | 148 | (let ((script-contents "\ |
| 127 | #!/anything/cabbage-bash-1.2.3/bin/sh | 149 | #!/anything/cabbage-bash-1.2.3/bin/sh |
