diff options
| author | Felix Lechner <felix.lechner@lease-up.com> | 2023-05-28 16:36:31 -0700 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2023-08-15 23:30:44 +0200 |
| commit | b8ee6b8a59bf02f47a6668e016905308b441523e (patch) | |
| tree | 60b036586ace321aa5754fab0dd2d67a0b5bbbe8 /gnu/tests/cachefilesd.scm | |
| parent | 48d06aee7b39c8e72644d665bd1995cb1ae1b094 (diff) | |
services: Add cachefilesd service.
Thanks to Bruno Victal "mirai" for cooperating on this patch and for
generously sharing a wealth of insights about Guix services.
Thanks to Jean-Baptiste Note for an early version of this service!
* doc/guix.texi (Linux Services)[Cachefilesd Service]: New heading.
* gnu/services/linux.scm (serialize-string, non-negative-integer?)
(serialize-non-negative-integer, string, non-negative-integer)
(make-option-serializer, make-percentage-threshold-serializer): New
procedures.
(cachefilesd-configuration): New record type.
(cachefilesd-service-type): New variable.
* gnu/tests/cachefilesd.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
Co-authored-by: Bruno Victal <mirai@makinata.eu>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/tests/cachefilesd.scm')
| -rw-r--r-- | gnu/tests/cachefilesd.scm | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/gnu/tests/cachefilesd.scm b/gnu/tests/cachefilesd.scm new file mode 100644 index 00000000000..7f5d5130671 --- /dev/null +++ b/gnu/tests/cachefilesd.scm | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | ||
| 2 | ;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@gmail.com> | ||
| 3 | ;;; Copyright © 2022 Bruno Victal <mirai@makinata.eu> | ||
| 4 | ;;; Copyright © 2023 Felix Lechner <felix.lechner@lease-up.com> | ||
| 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)))) | ||
