tests: Skip network-dependent tests when the network is unreachable.
* tests/builders.scm (network-reachable?): New variable. ("url-fetch", "gnu-build"): Skip unless NETWORK-REACHABLE?. * tests/derivations.scm (%coreutils): Check for network access. ("build-expression->derivation with one input"): Skip when %COREUTILS is #f. * tests/guix-package.sh: Skip installation of GNU Make when the network is unreachable. * tests/packages.scm ("GNU Make, bootstrap"): Likewise. * tests/union.scm ("union-build"): Likewise.
This commit is contained in:
parent
5fb868033f
commit
ad1ebab379
|
@ -50,9 +50,13 @@
|
||||||
(list name (package-derivation %store package))))
|
(list name (package-derivation %store package))))
|
||||||
(@@ (distro packages base) %boot0-inputs))))
|
(@@ (distro packages base) %boot0-inputs))))
|
||||||
|
|
||||||
|
(define network-reachable?
|
||||||
|
(false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)))
|
||||||
|
|
||||||
|
|
||||||
(test-begin "builders")
|
(test-begin "builders")
|
||||||
|
|
||||||
|
(unless network-reachable? (test-skip 1))
|
||||||
(test-assert "url-fetch"
|
(test-assert "url-fetch"
|
||||||
(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"
|
||||||
"ftp://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz"))
|
"ftp://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz"))
|
||||||
|
@ -69,6 +73,7 @@
|
||||||
(and (build-system? gnu-build-system)
|
(and (build-system? gnu-build-system)
|
||||||
(eq? gnu-build (build-system-builder gnu-build-system))))
|
(eq? gnu-build (build-system-builder gnu-build-system))))
|
||||||
|
|
||||||
|
(unless network-reachable? (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
|
||||||
|
|
|
@ -290,8 +290,9 @@
|
||||||
|
|
||||||
(define %coreutils
|
(define %coreutils
|
||||||
(false-if-exception
|
(false-if-exception
|
||||||
(or (package-derivation %store %bootstrap-coreutils&co)
|
(and (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)
|
||||||
(nixpkgs-derivation "coreutils"))))
|
(or (package-derivation %store %bootstrap-coreutils&co)
|
||||||
|
(nixpkgs-derivation "coreutils")))))
|
||||||
|
|
||||||
(test-skip (if %coreutils 0 1))
|
(test-skip (if %coreutils 0 1))
|
||||||
|
|
||||||
|
@ -385,6 +386,7 @@
|
||||||
(and (equal? '(hello) (call-with-input-file one read))
|
(and (equal? '(hello) (call-with-input-file one read))
|
||||||
(equal? '(world) (call-with-input-file two read)))))))
|
(equal? '(world) (call-with-input-file two read)))))))
|
||||||
|
|
||||||
|
(test-skip (if %coreutils 0 1))
|
||||||
(test-assert "build-expression->derivation with one input"
|
(test-assert "build-expression->derivation with one input"
|
||||||
(let* ((builder '(call-with-output-file %output
|
(let* ((builder '(call-with-output-file %output
|
||||||
(lambda (p)
|
(lambda (p)
|
||||||
|
|
|
@ -31,31 +31,35 @@ test -L "$profile" && test -L "$profile-1-link"
|
||||||
test -f "$profile/bin/guile"
|
test -f "$profile/bin/guile"
|
||||||
|
|
||||||
|
|
||||||
guix-package -b -p "$profile" \
|
# Check whether we have network access.
|
||||||
-i `guix-build -e '(@@ (distro packages base) gnu-make-boot0)'`
|
if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
|
||||||
test -L "$profile-2-link"
|
then
|
||||||
test -f "$profile/bin/make" && test -f "$profile/bin/guile"
|
guix-package -b -p "$profile" \
|
||||||
|
-i `guix-build -e '(@@ (distro packages base) gnu-make-boot0)'`
|
||||||
|
test -L "$profile-2-link"
|
||||||
|
test -f "$profile/bin/make" && test -f "$profile/bin/guile"
|
||||||
|
|
||||||
|
|
||||||
# Check whether `--list-installed' works.
|
# Check whether `--list-installed' works.
|
||||||
# XXX: Change the tests when `--install' properly extracts the package
|
# XXX: Change the tests when `--install' properly extracts the package
|
||||||
# name and version string.
|
# name and version string.
|
||||||
installed="`guix-package -p "$profile" --list-installed | cut -f1 | xargs echo | sort`"
|
installed="`guix-package -p "$profile" --list-installed | cut -f1 | xargs echo | sort`"
|
||||||
case "x$installed" in
|
case "x$installed" in
|
||||||
"guile-bootstrap make-boot0")
|
"guile-bootstrap make-boot0")
|
||||||
true;;
|
true;;
|
||||||
"make-boot0 guile-bootstrap")
|
"make-boot0 guile-bootstrap")
|
||||||
true;;
|
true;;
|
||||||
"*")
|
"*")
|
||||||
false;;
|
false;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
test "`guix-package -p "$profile" -I 'g.*e' | cut -f1`" = "guile-bootstrap"
|
test "`guix-package -p "$profile" -I 'g.*e' | cut -f1`" = "guile-bootstrap"
|
||||||
|
|
||||||
# Remove a package.
|
# Remove a package.
|
||||||
guix-package -b -p "$profile" -r "guile-bootstrap-2.0"
|
guix-package -b -p "$profile" -r "guile-bootstrap-2.0"
|
||||||
test -L "$profile-3-link"
|
test -L "$profile-3-link"
|
||||||
test -f "$profile/bin/make" && ! test -f "$profile/bin/guile"
|
test -f "$profile/bin/make" && ! test -f "$profile/bin/guile"
|
||||||
|
fi
|
||||||
|
|
||||||
# Make sure the `:' syntax works.
|
# Make sure the `:' syntax works.
|
||||||
guix-package -b -i "libsigsegv:lib" -n
|
guix-package -b -i "libsigsegv:lib" -n
|
||||||
|
|
|
@ -125,6 +125,8 @@
|
||||||
(let ((p (pk 'drv d (derivation-path->output-path d))))
|
(let ((p (pk 'drv d (derivation-path->output-path d))))
|
||||||
(eq? 'hello (call-with-input-file p read))))))
|
(eq? 'hello (call-with-input-file p read))))))
|
||||||
|
|
||||||
|
(unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV))
|
||||||
|
(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.
|
||||||
|
|
|
@ -64,7 +64,11 @@
|
||||||
(bin make)
|
(bin make)
|
||||||
(share (doc (make README))))))
|
(share (doc (make README))))))
|
||||||
|
|
||||||
(test-skip (if %store 0 1))
|
(test-skip (if (and %store
|
||||||
|
(false-if-exception
|
||||||
|
(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)))
|
||||||
|
0
|
||||||
|
1))
|
||||||
|
|
||||||
(test-assert "union-build"
|
(test-assert "union-build"
|
||||||
(let* ((inputs (map (match-lambda
|
(let* ((inputs (map (match-lambda
|
||||||
|
|
Loading…
Reference in New Issue