diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2015-02-23 23:52:28 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2015-02-24 00:01:34 +0100 |
| commit | b69c5c2ced1e41fdb5c2e747b1fb3a338ca63768 (patch) | |
| tree | eafabb8dcb62eb56ea00e2a46f7fb42109c9f69d | |
| parent | 12d720fd1a9c43019f2d5afa051b45c7633b3ab0 (diff) | |
tests: Skip tests that would fail due to the shebang length.
Reported by Daniel Kochmański <dkochmanski@hellsgate.pl>.
Fixes <http://bugs.gnu.org/19888>.
* guix/tests.scm (shebang-too-long?): New procedure.
* tests/builders.scm ("gnu-build"): Conditionalize on
not (shebang-too-long?).
* tests/packages.scm ("GNU Make, bootstrap"): Likewise.
* tests/guix-package.sh (shebang_not_too_long): New function.
Use it to determine whether to build 'gnu-make-boot0'.
| -rw-r--r-- | guix/tests.scm | 12 | ||||
| -rw-r--r-- | tests/builders.scm | 3 | ||||
| -rw-r--r-- | tests/guix-package.sh | 13 | ||||
| -rw-r--r-- | tests/packages.scm | 3 |
4 files changed, 27 insertions, 4 deletions
diff --git a/guix/tests.scm b/guix/tests.scm index d004a50a367..0896e842dac 100644 --- a/guix/tests.scm +++ b/guix/tests.scm | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | random-text | 32 | random-text |
| 33 | random-bytevector | 33 | random-bytevector |
| 34 | network-reachable? | 34 | network-reachable? |
| 35 | shebang-too-long? | ||
| 35 | mock | 36 | mock |
| 36 | %substitute-directory | 37 | %substitute-directory |
| 37 | with-derivation-narinfo | 38 | with-derivation-narinfo |
| @@ -185,6 +186,17 @@ CONTENTS." | |||
| 185 | (delete-file (string-append dir "/example.out")) | 186 | (delete-file (string-append dir "/example.out")) |
| 186 | (delete-file (string-append dir "/example.nar"))))) | 187 | (delete-file (string-append dir "/example.nar"))))) |
| 187 | 188 | ||
| 189 | (define (shebang-too-long?) | ||
| 190 | "Return true if the typical shebang in the current store would exceed | ||
| 191 | Linux's static limit---the BINPRM_BUF_SIZE constant, normally 128 characters | ||
| 192 | all included." | ||
| 193 | (define shebang | ||
| 194 | (string-append "#!" (%store-prefix) "/" | ||
| 195 | (make-string 32 #\a) | ||
| 196 | "-bootstrap-binaries-0/bin/bash\0")) | ||
| 197 | |||
| 198 | (> (string-length shebang) 128)) | ||
| 199 | |||
| 188 | (define-syntax with-derivation-substitute | 200 | (define-syntax with-derivation-substitute |
| 189 | (syntax-rules (sha256 =>) | 201 | (syntax-rules (sha256 =>) |
| 190 | "Evaluate BODY in a context where DRV is substitutable with the given | 202 | "Evaluate BODY in a context where DRV is substitutable with the given |
diff --git a/tests/builders.scm b/tests/builders.scm index 3c2a3edc8e9..a7c3e428305 100644 --- a/tests/builders.scm +++ b/tests/builders.scm | |||
| @@ -94,7 +94,8 @@ | |||
| 94 | (test-assert "gnu-build-system" | 94 | (test-assert "gnu-build-system" |
| 95 | (build-system? gnu-build-system)) | 95 | (build-system? gnu-build-system)) |
| 96 | 96 | ||
| 97 | (unless (network-reachable?) (test-skip 1)) | 97 | (when (or (not (network-reachable?)) (shebang-too-long?)) |
| 98 | (test-skip 1)) | ||
| 98 | (test-assert "gnu-build" | 99 | (test-assert "gnu-build" |
| 99 | (let* ((url "http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz") | 100 | (let* ((url "http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz") |
| 100 | (hash (nix-base32-string->bytevector | 101 | (hash (nix-base32-string->bytevector |
diff --git a/tests/guix-package.sh b/tests/guix-package.sh index d4917bbf906..94cf9274207 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh | |||
| @@ -28,6 +28,14 @@ readlink_base () | |||
| 28 | basename `readlink "$1"` | 28 | basename `readlink "$1"` |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | # Return true if a typical shebang in the store would not exceed Linux's | ||
| 32 | # default static limit. | ||
| 33 | shebang_not_too_long () | ||
| 34 | { | ||
| 35 | test `echo $NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bootstrap-binaries-0/bin/bash | wc -c` \ | ||
| 36 | -lt 128 | ||
| 37 | } | ||
| 38 | |||
| 31 | module_dir="t-guix-package-$$" | 39 | module_dir="t-guix-package-$$" |
| 32 | profile="t-profile-$$" | 40 | profile="t-profile-$$" |
| 33 | rm -f "$profile" | 41 | rm -f "$profile" |
| @@ -55,8 +63,9 @@ test -f "$profile/bin/guile" | |||
| 55 | guix package --search-paths -p "$profile" | 63 | guix package --search-paths -p "$profile" |
| 56 | test "`guix package --search-paths -p "$profile" | wc -l`" = 0 | 64 | test "`guix package --search-paths -p "$profile" | wc -l`" = 0 |
| 57 | 65 | ||
| 58 | # Check whether we have network access. | 66 | # Check whether we have network access and an acceptable shebang length. |
| 59 | if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null | 67 | if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null \ |
| 68 | && shebang_not_too_long | ||
| 60 | then | 69 | then |
| 61 | boot_make="(@@ (gnu packages commencement) gnu-make-boot0)" | 70 | boot_make="(@@ (gnu packages commencement) gnu-make-boot0)" |
| 62 | boot_make_drv="`guix build -e "$boot_make" | grep -v -e -debug`" | 71 | boot_make_drv="`guix build -e "$boot_make" | grep -v -e -debug`" |
diff --git a/tests/packages.scm b/tests/packages.scm index 5725b0a8a9c..d6371b3b496 100644 --- a/tests/packages.scm +++ b/tests/packages.scm | |||
| @@ -531,7 +531,8 @@ | |||
| 531 | (%current-target-system "foo64-linux-gnu")) | 531 | (%current-target-system "foo64-linux-gnu")) |
| 532 | (equal? drv (bag->derivation %store bag)))))) | 532 | (equal? drv (bag->derivation %store bag)))))) |
| 533 | 533 | ||
| 534 | (unless (network-reachable?) (test-skip 1)) | 534 | (when (or (not (network-reachable?)) (shebang-too-long?)) |
| 535 | (test-skip 1)) | ||
| 535 | (test-assert "GNU Make, bootstrap" | 536 | (test-assert "GNU Make, bootstrap" |
| 536 | ;; GNU Make is the first program built during bootstrap; we choose it | 537 | ;; GNU Make is the first program built during bootstrap; we choose it |
| 537 | ;; here so that the test doesn't last for too long. | 538 | ;; here so that the test doesn't last for too long. |
