1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
19 (define-module (tests services linux)
20 #:use-module (ice-9 match)
21 #:use-module (gnu packages linux)
22 #:use-module (gnu services linux)
23 #:use-module (guix gexp)
24 #:use-module (srfi srfi-64))
26 ;;; Tests for the (gnu services linux) module.
28 (test-begin "linux-services")
35 (define earlyoom-configuration->command-line-args
36 (@@ (gnu services linux) earlyoom-configuration->command-line-args))
38 (define %earlyoom-configuration-sample
39 (earlyoom-configuration
40 (minimum-available-memory 10)
41 (minimum-free-swap 20)
42 (prefer-regexp "icecat")
43 (avoid-regexp "guix-daemon")
44 (memory-report-interval 60)
45 (ignore-positive-oom-score-adj? #f)
46 (run-with-higher-priority? #t)
47 (show-debug-messages? #f)
48 (send-notification-command "python \"/some/path/notify-all-users.py\"")))
50 (test-equal "earlyoom-configuration->command-line-args"
51 (list (file-append earlyoom "/bin/earlyoom")
52 "-m" "10" "-s" "20" "--prefer" "icecat"
53 "--avoid" "guix-daemon" "-r" "60" "-p"
54 "-N" "python \"/some/path/notify-all-users.py\"")
55 (earlyoom-configuration->command-line-args %earlyoom-configuration-sample))
57 (test-end "linux-services")