services: hurd-vm: Resurrect system-test by using raw disk-image.
[jackhill/guix/guix.git] / gnu / tests / audio.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@gmail.com>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu tests audio)
20 #:use-module (gnu tests)
21 #:use-module (gnu system)
22 #:use-module (gnu system vm)
23 #:use-module (gnu services)
24 #:use-module (gnu services audio)
25 #:use-module (gnu packages mpd)
26 #:use-module (guix gexp)
27 #:export (%test-mpd))
28
29 (define %mpd-os
30 (simple-operating-system
31 (service mpd-service-type
32 (mpd-configuration
33 (user "root")))))
34
35 (define (run-mpd-test)
36 "Run tests in %mpd-os, which has mpd running."
37 (define os
38 (marionette-operating-system
39 %mpd-os
40 #:imported-modules '((gnu services herd))))
41
42 (define vm
43 (virtual-machine os))
44
45 (define test
46 (with-imported-modules '((gnu build marionette))
47 #~(begin
48 (use-modules (srfi srfi-64)
49 (gnu build marionette))
50 (define marionette
51 (make-marionette (list #$vm)))
52
53 (mkdir #$output)
54 (chdir #$output)
55
56 (test-begin "mpd")
57
58 (test-assert "service is running"
59 (marionette-eval
60 '(begin
61 (use-modules (gnu services herd))
62 (start-service 'mpd))
63 marionette))
64
65 (test-assert "mpc connect"
66 (marionette-eval
67 '(zero? (system #$(file-append mpd-mpc "/bin/mpc")))
68 marionette))
69
70 (test-end)
71 (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
72 (gexp->derivation "mpd-test" test))
73
74 (define %test-mpd
75 (system-test
76 (name "mpd")
77 (description "Test that the mpd can run and be connected to.")
78 (value (run-mpd-test))))