tests: Export 'run-basic-test'.

* gnu/tests/base.scm (run-basic-test): New procedure, extracted from ...
(%test-basic-os): ... here.  Use it.
This commit is contained in:
Ludovic Courtès 2016-06-19 23:53:24 +02:00
parent 77559f23b0
commit e3de272a81
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 105 additions and 98 deletions

View File

@ -30,7 +30,8 @@
#:use-module (guix monads)
#:use-module (guix packages)
#:use-module (srfi srfi-1)
#:export (%test-basic-os))
#:export (run-basic-test
%test-basic-os))
(define %simple-os
(operating-system
@ -56,15 +57,10 @@
%base-user-accounts))))
(define %test-basic-os
;; Monadic derivation that instruments %SIMPLE-OS, runs it in a VM, and runs
;; a series of basic functionality tests.
(mlet* %store-monad ((os -> (marionette-operating-system
%simple-os
#:imported-modules '((gnu services herd)
(guix combinators))))
(run (system-qemu-image/shared-store-script
os #:graphic? #f)))
(define* (run-basic-test os command #:optional (name "basic"))
"Return a derivation called NAME that tests basic features of the OS started
using COMMAND, a gexp that evaluates to a list of strings. Compare some
properties of running system to what's declared in OS, an <operating-system>."
(define test
#~(begin
(use-modules (gnu build marionette)
@ -74,7 +70,7 @@
(ice-9 match))
(define marionette
(make-marionette (list #$run)))
(make-marionette #$command))
(mkdir #$output)
(chdir #$output)
@ -160,5 +156,16 @@ info --version")
(test-end)
(exit (= (test-runner-fail-count (test-runner-current)) 0))))
(gexp->derivation "basic" test
#:modules '((gnu build marionette)))))
(gexp->derivation name test
#:modules '((gnu build marionette))))
(define %test-basic-os
;; Monadic derivation that instruments %SIMPLE-OS, runs it in a VM, and runs
;; a series of basic functionality tests.
(mlet* %store-monad ((os -> (marionette-operating-system
%simple-os
#:imported-modules '((gnu services herd)
(guix combinators))))
(run (system-qemu-image/shared-store-script
os #:graphic? #f)))
(run-basic-test os #~(list #$run))))