projects/guix·blob python-team · refs

71 lines · 2.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Peter Mikkelsen <[email protected]>
3;;; Copyright © 2022 Bruno Victal <[email protected]>
4;;; Copyright © 2023 Felix Lechner <[email protected]>
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu tests cachefilesd)
22 #:use-module (gnu tests)
23 #:use-module (gnu system)
24 #:use-module (gnu system vm)
25 #:use-module (gnu services)
26 #:use-module (gnu services linux)
27 #:use-module (guix gexp)
28 #:export (%test-cachefilesd))
29
30(define %cachefilesd-os
31 (simple-operating-system
32 (service cachefilesd-service-type
33 (cachefilesd-configuration
34 (cache-directory "/var/cache/fscache")))))
35
36(define (run-cachefilesd-test)
37 "Run tests in %cachefilesd-os, which has cachefilesd running."
38 (define os
39 (marionette-operating-system
40 %cachefilesd-os
41 #:imported-modules '((gnu services herd))))
42
43 (define vm
44 (virtual-machine os))
45
46 (define test
47 (with-imported-modules '((gnu build marionette))
48 #~(begin
49 (use-modules (srfi srfi-64)
50 (gnu build marionette))
51 (define marionette
52 (make-marionette (list #$vm)))
53
54 (test-runner-current (system-test-runner #$output))
55 (test-begin "cachefilesd")
56
57 (test-assert "service is running"
58 (marionette-eval
59 '(begin
60 (use-modules (gnu services herd))
61 (start-service 'cachefilesd))
62 marionette))
63
64 (test-end))))
65 (gexp->derivation "cachefilesd-test" test))
66
67(define %test-cachefilesd
68 (system-test
69 (name "cachefilesd")
70 (description "Test that the cachefilesd runs when started.")
71 (value (run-cachefilesd-test))))