tests: Add a mechanism to describe and discover system tests.

* gnu/tests.scm (<system-test>): New record type.
(write-system-test, test-modules, fold-system-tests)
(all-system-tests): New procedures.
* gnu/tests/base.scm (%test-basic-os): Turn into a <system-test>.
* gnu/tests/install.scm (%test-installed-os): Likewise.
* build-aux/run-system-tests.scm (%system-tests): Remove.
(run-system-tests): Use 'all-system-tests'.
This commit is contained in:
Ludovic Courtès 2016-06-20 22:34:13 +02:00
parent 2a6ba87086
commit 98b65b5ff6
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
5 changed files with 112 additions and 38 deletions

View file

@ -17,8 +17,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (run-system-tests)
#:use-module (gnu tests base)
#:use-module (gnu tests install)
#:use-module (gnu tests)
#:use-module (guix store)
#:use-module (guix monads)
#:use-module (guix derivations)
@ -45,14 +44,16 @@
lst)
(lift1 reverse %store-monad))))
(define %system-tests
(list %test-basic-os
%test-installed-os))
(define (run-system-tests . args)
(define tests
(all-system-tests))
(format (current-error-port) "Running ~a system tests...~%"
(length tests))
(with-store store
(run-with-store store
(mlet* %store-monad ((drv (sequence %store-monad %system-tests))
(mlet* %store-monad ((drv (mapm %store-monad system-test-value tests))
(out -> (map derivation->output-path drv)))
(mbegin %store-monad
(show-what-to-build* drv)