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'.
This commit is contained in:
parent
12d720fd1a
commit
b69c5c2ced
|
@ -32,6 +32,7 @@
|
||||||
random-text
|
random-text
|
||||||
random-bytevector
|
random-bytevector
|
||||||
network-reachable?
|
network-reachable?
|
||||||
|
shebang-too-long?
|
||||||
mock
|
mock
|
||||||
%substitute-directory
|
%substitute-directory
|
||||||
with-derivation-narinfo
|
with-derivation-narinfo
|
||||||
|
@ -185,6 +186,17 @@ CONTENTS."
|
||||||
(delete-file (string-append dir "/example.out"))
|
(delete-file (string-append dir "/example.out"))
|
||||||
(delete-file (string-append dir "/example.nar")))))
|
(delete-file (string-append dir "/example.nar")))))
|
||||||
|
|
||||||
|
(define (shebang-too-long?)
|
||||||
|
"Return true if the typical shebang in the current store would exceed
|
||||||
|
Linux's static limit---the BINPRM_BUF_SIZE constant, normally 128 characters
|
||||||
|
all included."
|
||||||
|
(define shebang
|
||||||
|
(string-append "#!" (%store-prefix) "/"
|
||||||
|
(make-string 32 #\a)
|
||||||
|
"-bootstrap-binaries-0/bin/bash\0"))
|
||||||
|
|
||||||
|
(> (string-length shebang) 128))
|
||||||
|
|
||||||
(define-syntax with-derivation-substitute
|
(define-syntax with-derivation-substitute
|
||||||
(syntax-rules (sha256 =>)
|
(syntax-rules (sha256 =>)
|
||||||
"Evaluate BODY in a context where DRV is substitutable with the given
|
"Evaluate BODY in a context where DRV is substitutable with the given
|
||||||
|
|
|
@ -94,7 +94,8 @@
|
||||||
(test-assert "gnu-build-system"
|
(test-assert "gnu-build-system"
|
||||||
(build-system? gnu-build-system))
|
(build-system? gnu-build-system))
|
||||||
|
|
||||||
(unless (network-reachable?) (test-skip 1))
|
(when (or (not (network-reachable?)) (shebang-too-long?))
|
||||||
|
(test-skip 1))
|
||||||
(test-assert "gnu-build"
|
(test-assert "gnu-build"
|
||||||
(let* ((url "http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz")
|
(let* ((url "http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz")
|
||||||
(hash (nix-base32-string->bytevector
|
(hash (nix-base32-string->bytevector
|
||||||
|
|
|
@ -28,6 +28,14 @@ readlink_base ()
|
||||||
basename `readlink "$1"`
|
basename `readlink "$1"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Return true if a typical shebang in the store would not exceed Linux's
|
||||||
|
# default static limit.
|
||||||
|
shebang_not_too_long ()
|
||||||
|
{
|
||||||
|
test `echo $NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bootstrap-binaries-0/bin/bash | wc -c` \
|
||||||
|
-lt 128
|
||||||
|
}
|
||||||
|
|
||||||
module_dir="t-guix-package-$$"
|
module_dir="t-guix-package-$$"
|
||||||
profile="t-profile-$$"
|
profile="t-profile-$$"
|
||||||
rm -f "$profile"
|
rm -f "$profile"
|
||||||
|
@ -55,8 +63,9 @@ test -f "$profile/bin/guile"
|
||||||
guix package --search-paths -p "$profile"
|
guix package --search-paths -p "$profile"
|
||||||
test "`guix package --search-paths -p "$profile" | wc -l`" = 0
|
test "`guix package --search-paths -p "$profile" | wc -l`" = 0
|
||||||
|
|
||||||
# Check whether we have network access.
|
# Check whether we have network access and an acceptable shebang length.
|
||||||
if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
|
if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null \
|
||||||
|
&& shebang_not_too_long
|
||||||
then
|
then
|
||||||
boot_make="(@@ (gnu packages commencement) gnu-make-boot0)"
|
boot_make="(@@ (gnu packages commencement) gnu-make-boot0)"
|
||||||
boot_make_drv="`guix build -e "$boot_make" | grep -v -e -debug`"
|
boot_make_drv="`guix build -e "$boot_make" | grep -v -e -debug`"
|
||||||
|
|
|
@ -531,7 +531,8 @@
|
||||||
(%current-target-system "foo64-linux-gnu"))
|
(%current-target-system "foo64-linux-gnu"))
|
||||||
(equal? drv (bag->derivation %store bag))))))
|
(equal? drv (bag->derivation %store bag))))))
|
||||||
|
|
||||||
(unless (network-reachable?) (test-skip 1))
|
(when (or (not (network-reachable?)) (shebang-too-long?))
|
||||||
|
(test-skip 1))
|
||||||
(test-assert "GNU Make, bootstrap"
|
(test-assert "GNU Make, bootstrap"
|
||||||
;; GNU Make is the first program built during bootstrap; we choose it
|
;; GNU Make is the first program built during bootstrap; we choose it
|
||||||
;; here so that the test doesn't last for too long.
|
;; here so that the test doesn't last for too long.
|
||||||
|
|
Loading…
Reference in New Issue