tests: Make builds less expensive.

The switch to the reduced bootstrap broke build time assumptions made by
tests, notably the assumption that GNU-MAKE-BOOT0 was cheap to build.
This commit adjusts this to make these tests cheaper.

* gnu/packages/bootstrap.scm (%bootstrap-inputs-for-tests): New variable.
* guix/tests.scm (gnu-make-for-tests): New variable.
* tests/guix-environment.sh: Use GNU-MAKE-FOR-TESTS instead of
GNU-MAKE-BOOT0.  Remove test with FINDUTILS-BOOT0.
* tests/guix-package-net.sh (boot_make): Use GNU-MAKE-FOR-TESTS.
* tests/packages.scm ("GNU Make, bootstrap"): Likewise.
* tests/profiles.scm ("profile-derivation relative symlinks, two entries"):
Likewise.
* tests/union.scm (%bootstrap-inputs): Remove.
("union-build"): Use %BOOTSTRAP-INPUTS-FOR-TESTS instead of
%BOOTSTRAP-INPUTS.
This commit is contained in:
Ludovic Courtès 2019-06-14 21:26:22 +02:00
parent 11b4a8716c
commit 03d76577b9
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
7 changed files with 61 additions and 37 deletions

View file

@ -53,7 +53,9 @@ (define-module (gnu packages bootstrap)
%bootstrap-glibc %bootstrap-glibc
%bootstrap-inputs %bootstrap-inputs
%bootstrap-mescc-tools %bootstrap-mescc-tools
%bootstrap-mes)) %bootstrap-mes
%bootstrap-inputs-for-tests))
;;; Commentary: ;;; Commentary:
;;; ;;;
@ -809,4 +811,14 @@ (define (%bootstrap-inputs)
;; In gnu-build-system.scm, we rely on the availability of Bash. ;; In gnu-build-system.scm, we rely on the availability of Bash.
("bash" ,%bootstrap-coreutils&co))) ("bash" ,%bootstrap-coreutils&co)))
(define %bootstrap-inputs-for-tests
;; These are bootstrap inputs that are cheap to produce (no compilation
;; needed) and that are meant to be used for testing. (These are those we
;; used before the Mes-based reduced bootstrap.)
`(("libc" ,%bootstrap-glibc)
("gcc" ,%bootstrap-gcc)
("binutils" ,%bootstrap-binutils)
("coreutils&co" ,%bootstrap-coreutils&co)
("bash" ,%bootstrap-coreutils&co)))
;;; bootstrap.scm ends here ;;; bootstrap.scm ends here

View file

@ -23,8 +23,10 @@ (define-module (guix tests)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix base32) #:use-module (guix base32)
#:use-module (guix serialization) #:use-module (guix serialization)
#:use-module ((guix utils) #:select (substitute-keyword-arguments))
#:use-module (gcrypt hash) #:use-module (gcrypt hash)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (gnu packages base)
#:use-module (gnu packages bootstrap) #:use-module (gnu packages bootstrap)
#:use-module (srfi srfi-34) #:use-module (srfi srfi-34)
#:use-module (srfi srfi-64) #:use-module (srfi srfi-64)
@ -50,7 +52,9 @@ (define-module (guix tests)
with-derivation-narinfo with-derivation-narinfo
with-derivation-substitute with-derivation-substitute
dummy-package dummy-package
dummy-origin)) dummy-origin
gnu-make-for-tests))
;;; Commentary: ;;; Commentary:
;;; ;;;
@ -364,6 +368,33 @@ (define-syntax-rule (dummy-origin extra-fields ...)
(sha256 (base32 (make-string 52 #\x)))))) (sha256 (base32 (make-string 52 #\x))))))
(origin (inherit o) extra-fields ...))) (origin (inherit o) extra-fields ...)))
(define gnu-make-for-tests
;; This is a variant of 'gnu-make-boot0' that can be built with minimal
;; resources.
(package-with-bootstrap-guile
(package
(inherit gnu-make)
(name "make-test-boot0")
(arguments
`(#:guile ,%bootstrap-guile
#:implicit-inputs? #f
#:tests? #f ;cannot run "make check"
,@(substitute-keyword-arguments (package-arguments gnu-make)
((#:phases phases)
`(modify-phases ,phases
(replace 'build
(lambda _
(invoke "./build.sh")
#t))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin")))
(install-file "make" bin)
#t))))))))
(native-inputs '()) ;no need for 'pkg-config'
(inputs %bootstrap-inputs-for-tests))))
;; Local Variables: ;; Local Variables:
;; eval: (put 'call-with-derivation-narinfo 'scheme-indent-function 1) ;; eval: (put 'call-with-derivation-narinfo 'scheme-indent-function 1)
;; eval: (put 'call-with-derivation-substitute 'scheme-indent-function 2) ;; eval: (put 'call-with-derivation-substitute 'scheme-indent-function 2)

View file

@ -156,7 +156,7 @@ if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
then then
# Compute the build environment for the initial GNU Make. # Compute the build environment for the initial GNU Make.
guix environment --bootstrap --no-substitutes --search-paths --pure \ guix environment --bootstrap --no-substitutes --search-paths --pure \
-e '(@@ (gnu packages commencement) gnu-make-boot0)' > "$tmpdir/a" -e '(@ (guix tests) gnu-make-for-tests)' > "$tmpdir/a"
# Make sure bootstrap binaries are in the profile. # Make sure bootstrap binaries are in the profile.
profile=`grep "^export PATH" "$tmpdir/a" | sed -r 's|^.*="(.*)/bin"|\1|'` profile=`grep "^export PATH" "$tmpdir/a" | sed -r 's|^.*="(.*)/bin"|\1|'`
@ -177,30 +177,15 @@ then
# Make sure that the shell spawned with '--exec' sees the same environment # Make sure that the shell spawned with '--exec' sees the same environment
# as returned by '--search-paths'. # as returned by '--search-paths'.
guix environment --bootstrap --no-substitutes --pure \ guix environment --bootstrap --no-substitutes --pure \
-e '(@@ (gnu packages commencement) gnu-make-boot0)' \ -e '(@ (guix tests) gnu-make-for-tests)' \
-- /bin/sh -c 'echo $PATH $CPATH $LIBRARY_PATH' > "$tmpdir/b" -- /bin/sh -c 'echo $PATH $CPATH $LIBRARY_PATH' > "$tmpdir/b"
( . "$tmpdir/a" ; echo $PATH $CPATH $LIBRARY_PATH ) > "$tmpdir/c" ( . "$tmpdir/a" ; echo $PATH $CPATH $LIBRARY_PATH ) > "$tmpdir/c"
cmp "$tmpdir/b" "$tmpdir/c" cmp "$tmpdir/b" "$tmpdir/c"
rm "$tmpdir"/* rm "$tmpdir"/*
# Compute the build environment for the initial GNU Findutils.
guix environment --bootstrap --no-substitutes --search-paths --pure \
-e '(@@ (gnu packages commencement) findutils-boot0)' > "$tmpdir/a"
profile=`grep "^export PATH" "$tmpdir/a" | sed -r 's|^.*="(.*)/bin"|\1|'`
# Make sure the bootstrap binaries are all listed where they belong.
grep -E "^export PATH=\"$profile/bin\"" "$tmpdir/a"
grep -E "^export CPATH=\"$profile/include\"" "$tmpdir/a"
grep -E "^export LIBRARY_PATH=\"$profile/lib\"" "$tmpdir/a"
for dep in bootstrap-binaries-0 gcc-bootstrap-0 glibc-bootstrap-0 \
make-boot0
do
guix gc --references "$profile" | grep "$dep"
done
# The following test assumes 'make-boot0' has a "debug" output. # The following test assumes 'make-boot0' has a "debug" output.
make_boot0_debug="`guix build -e '(@@ (gnu packages commencement) gnu-make-boot0)' | grep -e -debug`" make_boot0_debug="`guix build -e '(@ (guix tests) gnu-make-for-tests)' | grep -e -debug`"
test "x$make_boot0_debug" != "x" test "x$make_boot0_debug" != "x"
# Make sure the "debug" output is not listed. # Make sure the "debug" output is not listed.
@ -210,7 +195,7 @@ then
# Compute the build environment for the initial GNU Make, but add in the # Compute the build environment for the initial GNU Make, but add in the
# bootstrap Guile as an ad-hoc addition. # bootstrap Guile as an ad-hoc addition.
guix environment --bootstrap --no-substitutes --search-paths --pure \ guix environment --bootstrap --no-substitutes --search-paths --pure \
-e '(@@ (gnu packages commencement) gnu-make-boot0)' \ -e '(@ (guix tests) gnu-make-for-tests)' \
--ad-hoc guile-bootstrap > "$tmpdir/a" --ad-hoc guile-bootstrap > "$tmpdir/a"
profile=`grep "^export PATH" "$tmpdir/a" | sed -r 's|^.*="(.*)/bin"|\1|'` profile=`grep "^export PATH" "$tmpdir/a" | sed -r 's|^.*="(.*)/bin"|\1|'`
@ -227,14 +212,14 @@ then
# Make sure a package list with plain package objects and package+output # Make sure a package list with plain package objects and package+output
# tuples can be used with -e. # tuples can be used with -e.
expr_list_test_code=" expr_list_test_code="
(list (@@ (gnu packages commencement) gnu-make-boot0) (list (@ (guix tests) gnu-make-for-tests)
(list (@ (gnu packages bootstrap) %bootstrap-guile) \"out\"))" (list (@ (gnu packages bootstrap) %bootstrap-guile) \"out\"))"
guix environment --bootstrap --ad-hoc --no-substitutes --search-paths \ guix environment --bootstrap --ad-hoc --no-substitutes --search-paths \
--pure -e "$expr_list_test_code" > "$tmpdir/a" --pure -e "$expr_list_test_code" > "$tmpdir/a"
profile=`grep "^export PATH" "$tmpdir/a" | sed -r 's|^.*="(.*)/bin"|\1|'` profile=`grep "^export PATH" "$tmpdir/a" | sed -r 's|^.*="(.*)/bin"|\1|'`
for dep in make-boot0 guile-bootstrap for dep in make-test-boot0 guile-bootstrap
do do
guix gc --references "$profile" | grep "$dep" guix gc --references "$profile" | grep "$dep"
done done

View file

@ -57,7 +57,7 @@ test -L "$profile" && test -L "$profile-1-link"
! test -f "$profile-2-link" ! test -f "$profile-2-link"
test -f "$profile/bin/guile" test -f "$profile/bin/guile"
boot_make="(@@ (gnu packages commencement) gnu-make-boot0)" boot_make="(@ (guix tests) gnu-make-for-tests)"
boot_make_drv="`guix build -e "$boot_make" | grep -v -e -debug`" boot_make_drv="`guix build -e "$boot_make" | grep -v -e -debug`"
guix package --bootstrap -p "$profile" -i "$boot_make_drv" guix package --bootstrap -p "$profile" -i "$boot_make_drv"
test -L "$profile-2-link" test -L "$profile-2-link"

View file

@ -935,9 +935,9 @@ (define read-at
(when (or (not (network-reachable?)) (shebang-too-long?)) (when (or (not (network-reachable?)) (shebang-too-long?))
(test-skip 1)) (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-FOR-TESTS can be built cheaply; we choose it here so that the
;; here so that the test doesn't last for too long. ;; test doesn't last for too long.
(let ((gnu-make (@@ (gnu packages commencement) gnu-make-boot0))) (let ((gnu-make gnu-make-for-tests))
(and (package? gnu-make) (and (package? gnu-make)
(or (location? (package-location gnu-make)) (or (location? (package-location gnu-make))
(not (package-location gnu-make))) (not (package-location gnu-make)))

View file

@ -239,11 +239,10 @@ (define glibc
(unless (network-reachable?) (test-skip 1)) (unless (network-reachable?) (test-skip 1))
(test-assertm "profile-derivation relative symlinks, two entries" (test-assertm "profile-derivation relative symlinks, two entries"
(mlet* %store-monad (mlet* %store-monad
((gnu-make-boot0 -> (@@ (gnu packages commencement) gnu-make-boot0)) ((manifest -> (packages->manifest
(manifest -> (packages->manifest (list %bootstrap-guile gnu-make-for-tests)))
(list %bootstrap-guile gnu-make-boot0)))
(guile (package->derivation %bootstrap-guile)) (guile (package->derivation %bootstrap-guile))
(make (package->derivation gnu-make-boot0)) (make (package->derivation gnu-make-for-tests))
(drv (profile-derivation manifest (drv (profile-derivation manifest
#:relative-symlinks? #t #:relative-symlinks? #t
#:hooks '() #:hooks '()

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2012, 2013, 2014, 2015, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
@ -32,9 +32,6 @@ (define-module (test-union)
#:use-module (rnrs io ports) #:use-module (rnrs io ports)
#:use-module (ice-9 match)) #:use-module (ice-9 match))
(define %bootstrap-inputs
(@@ (gnu packages commencement) %bootstrap-inputs+toolchain))
;; Exercise the (guix build union) module. ;; Exercise the (guix build union) module.
(define %store (define %store
@ -99,8 +96,8 @@ (define %store
;; Purposefully leave duplicate entries. ;; Purposefully leave duplicate entries.
(filter (compose package? cadr) (filter (compose package? cadr)
(append (%bootstrap-inputs) (append %bootstrap-inputs-for-tests
(take (%bootstrap-inputs) 3))))) (take %bootstrap-inputs-for-tests 3)))))
(builder `(begin (builder `(begin
(use-modules (guix build union)) (use-modules (guix build union))
(union-build (assoc-ref %outputs "out") (union-build (assoc-ref %outputs "out")