tests: "make check-system" no longer interns source upfront.

* gnu/ci.scm (channel-build-system)[build, lower]: Honor #:source.
(channel-source->package): New procedure.
(system-test-jobs): Remove 'instance' and call to
'checkout->channel-instance'.  Use 'channel-source->package'.
* build-aux/run-system-tests.scm (tests-for-channel-instance): Rename to...
(tests-for-current-guix): ... this.  Change 'instance' to 'source'.
(run-system-tests): Use 'local-file' instead of 'interned-file' for
SOURCE.
This commit is contained in:
Ludovic Courtès 2020-03-03 12:35:46 +01:00
parent d37b5a1b58
commit dd1ee160be
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 26 additions and 23 deletions

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -19,7 +19,8 @@
(define-module (run-system-tests) (define-module (run-system-tests)
#:use-module (gnu tests) #:use-module (gnu tests)
#:use-module (gnu packages package-management) #:use-module (gnu packages package-management)
#:use-module ((gnu ci) #:select (channel-instance->package)) #:use-module ((gnu ci) #:select (channel-source->package))
#:use-module (guix gexp)
#:use-module (guix store) #:use-module (guix store)
#:use-module ((guix status) #:select (with-status-verbosity)) #:use-module ((guix status) #:select (with-status-verbosity))
#:use-module (guix monads) #:use-module (guix monads)
@ -51,15 +52,15 @@ (define (filterm mproc lst) ;XXX: move to (guix monads)
lst) lst)
(lift1 reverse %store-monad)))) (lift1 reverse %store-monad))))
(define (tests-for-channel-instance instance) (define (tests-for-current-guix source)
"Return a list of tests for perform, using Guix from INSTANCE, a channel "Return a list of tests for perform, using Guix built from SOURCE, a channel
instance." instance."
;; Honor the 'TESTS' environment variable so that one can select a subset ;; Honor the 'TESTS' environment variable so that one can select a subset
;; of tests to run in the usual way: ;; of tests to run in the usual way:
;; ;;
;; make check-system TESTS=installed-os ;; make check-system TESTS=installed-os
(parameterize ((current-guix-package (parameterize ((current-guix-package
(channel-instance->package instance))) (channel-source->package source)))
(match (getenv "TESTS") (match (getenv "TESTS")
(#f (#f
(all-system-tests)) (all-system-tests))
@ -80,14 +81,12 @@ (define source
;; Intern SOURCE so that 'build-from-source' in (guix channels) sees ;; Intern SOURCE so that 'build-from-source' in (guix channels) sees
;; "fresh" file names and thus doesn't find itself loading .go files ;; "fresh" file names and thus doesn't find itself loading .go files
;; from ~/.cache/guile when it loads 'build-aux/build-self.scm'. ;; from ~/.cache/guile when it loads 'build-aux/build-self.scm'.
;; XXX: It would be best to not do it upfront because we may need it. (mlet* %store-monad ((source -> (local-file source "guix-source"
(mlet* %store-monad ((source (interned-file source "guix-source"
#:recursive? #t #:recursive? #t
#:select? #:select?
(or (git-predicate source) (or (git-predicate source)
(const #t)))) (const #t))))
(instance -> (checkout->channel-instance source)) (tests -> (tests-for-current-guix source))
(tests -> (tests-for-channel-instance instance))
(drv (mapm %store-monad system-test-value tests)) (drv (mapm %store-monad system-test-value tests))
(out -> (map derivation->output-path drv))) (out -> (map derivation->output-path drv)))
(format (current-error-port) "Running ~a system tests...~%" (format (current-error-port) "Running ~a system tests...~%"

View file

@ -28,6 +28,7 @@ (define-module (gnu ci)
#:use-module (guix derivations) #:use-module (guix derivations)
#:use-module (guix build-system) #:use-module (guix build-system)
#:use-module (guix monads) #:use-module (guix monads)
#:use-module (guix gexp)
#:use-module (guix ui) #:use-module (guix ui)
#:use-module ((guix licenses) #:use-module ((guix licenses)
#:select (gpl3+ license? license-name)) #:select (gpl3+ license? license-name))
@ -54,7 +55,7 @@ (define-module (gnu ci)
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:export (channel-instance->package #:export (channel-source->package
hydra-jobs)) hydra-jobs))
;;; Commentary: ;;; Commentary:
@ -239,29 +240,35 @@ (define MiB
(define channel-build-system (define channel-build-system
;; Build system used to "convert" a channel instance to a package. ;; Build system used to "convert" a channel instance to a package.
(let* ((build (lambda* (store name inputs (let* ((build (lambda* (store name inputs
#:key instance system #:key source commit system
#:allow-other-keys) #:allow-other-keys)
(run-with-store store (run-with-store store
(channel-instances->derivation (list instance)) (mlet* %store-monad ((source (lower-object source))
(instance
-> (checkout->channel-instance
source #:commit commit)))
(channel-instances->derivation (list instance)))
#:system system))) #:system system)))
(lower (lambda* (name #:key system instance #:allow-other-keys) (lower (lambda* (name #:key system source commit
#:allow-other-keys)
(bag (bag
(name name) (name name)
(system system) (system system)
(build build) (build build)
(arguments `(#:instance ,instance)))))) (arguments `(#:source ,source
#:commit ,commit))))))
(build-system (name 'channel) (build-system (name 'channel)
(description "Turn a channel instance into a package.") (description "Turn a channel instance into a package.")
(lower lower)))) (lower lower))))
(define (channel-instance->package instance) (define* (channel-source->package source #:key commit)
"Return a package for the given channel INSTANCE." "Return a package for the given channel SOURCE, a lowerable object."
(package (package
(inherit guix) (inherit guix)
(version (or (string-take (channel-instance-commit instance) 7) (version (string-append (package-version guix) "+"))
(string-append (package-version guix) "+")))
(build-system channel-build-system) (build-system channel-build-system)
(arguments `(#:instance ,instance)) (arguments `(#:source ,source
#:commit ,commit))
(inputs '()) (inputs '())
(native-inputs '()) (native-inputs '())
(propagated-inputs '()))) (propagated-inputs '())))
@ -269,9 +276,6 @@ (define (channel-instance->package instance)
(define* (system-test-jobs store system (define* (system-test-jobs store system
#:key source commit) #:key source commit)
"Return a list of jobs for the system tests." "Return a list of jobs for the system tests."
(define instance
(checkout->channel-instance source #:commit commit))
(define (test->thunk test) (define (test->thunk test)
(lambda () (lambda ()
(define drv (define drv
@ -308,7 +312,7 @@ (define (->job test)
;; expensive. It also makes sure we get a valid Guix package when this ;; expensive. It also makes sure we get a valid Guix package when this
;; code is not running from a checkout. ;; code is not running from a checkout.
(parameterize ((current-guix-package (parameterize ((current-guix-package
(channel-instance->package instance))) (channel-source->package source #:commit commit)))
(map ->job (all-system-tests))) (map ->job (all-system-tests)))
'())) '()))