From 98b65b5ff6b1dea0ad58b0f47dd163c32d0cbf6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 20 Jun 2016 22:34:13 +0200 Subject: tests: Add a mechanism to describe and discover system tests. * gnu/tests.scm (): 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 . * gnu/tests/install.scm (%test-installed-os): Likewise. * build-aux/run-system-tests.scm (%system-tests): Remove. (run-system-tests): Use 'all-system-tests'. --- gnu/tests/base.scm | 30 +++++++++++++++++------------- gnu/tests/install.scm | 36 ++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 29 deletions(-) (limited to 'gnu/tests') diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index b417bc4bda..3dfa28f7f5 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -161,16 +161,20 @@ info --version") #: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))) - ;; XXX: Add call to 'virtualized-operating-system' to get the exact same - ;; set of services as the OS produced by - ;; 'system-qemu-image/shared-store-script'. - (run-basic-test (virtualized-operating-system os '()) - #~(list #$run)))) + (system-test + (name "basic") + (description + "Instrument %SIMPLE-OS, run it in a VM, and runs a series of basic +functionality tests.") + (value + (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))) + ;; XXX: Add call to 'virtualized-operating-system' to get the exact same + ;; set of services as the OS produced by + ;; 'system-qemu-image/shared-store-script'. + (run-basic-test (virtualized-operating-system os '()) + #~(list #$run)))))) diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 0b3950a212..c33919ba2f 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -185,21 +185,25 @@ reboot\n")) (define %test-installed-os - ;; Test basic functionality of an OS installed like one would do by hand. - ;; This test is expensive in terms of CPU and storage usage since we need to - ;; build (current-guix) and then store a couple of full system images. - (mlet %store-monad ((image (run-install)) - (system (current-system))) - (run-basic-test %minimal-os - #~(let ((image #$image)) - ;; First we need a writable copy of the image. - (format #t "copying image '~a'...~%" image) - (copy-file image "disk.img") - (chmod "disk.img" #o644) - (list (string-append #$qemu-minimal "/bin/" - #$(qemu-command system)) - "-enable-kvm" "-no-reboot" "-m" "256" - "-drive" "file=disk.img,if=virtio")) - "installed-os"))) + (system-test + (name "installed-os") + (description + "Test basic functionality of an OS installed like one would do by hand. +This test is expensive in terms of CPU and storage usage since we need to +build (current-guix) and then store a couple of full system images.") + (value + (mlet %store-monad ((image (run-install)) + (system (current-system))) + (run-basic-test %minimal-os + #~(let ((image #$image)) + ;; First we need a writable copy of the image. + (format #t "copying image '~a'...~%" image) + (copy-file image "disk.img") + (chmod "disk.img" #o644) + (list (string-append #$qemu-minimal "/bin/" + #$(qemu-command system)) + "-enable-kvm" "-no-reboot" "-m" "256" + "-drive" "file=disk.img,if=virtio")) + "installed-os"))))) ;;; install.scm ends here -- cgit v1.2.3