diff options
| author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2020-01-06 01:36:00 -0500 |
|---|---|---|
| committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2020-01-31 23:37:13 -0500 |
| commit | d3e439e355284f136ff13eb3e6fffb4661552f3b (patch) | |
| tree | 624e123167079a142ddacb1c3d7b00e73f7f3490 /tests/services | |
| parent | 76f5428bc6b4b4d944be1c16f50d6e558416635f (diff) | |
gnu: Add earlyoom-service-type.
* gnu/services/linux.scm: New file.
* tests/services/linux.scm: Add test.
* Makefile.am (SCM_TESTS): Register test.
* doc/guix.texi (Linux Services): Add a new section and document the new
service and its configuration.
Diffstat (limited to 'tests/services')
| -rw-r--r-- | tests/services/linux.scm | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/services/linux.scm b/tests/services/linux.scm new file mode 100644 index 00000000000..8ad119c49f7 --- /dev/null +++ b/tests/services/linux.scm | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | ||
| 2 | ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@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 (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)) | ||
| 25 | |||
| 26 | ;;; Tests for the (gnu services linux) module. | ||
| 27 | |||
| 28 | (test-begin "linux-services") | ||
| 29 | |||
| 30 | |||
| 31 | ;;; | ||
| 32 | ;;; Early OOM daemon. | ||
| 33 | ;;; | ||
| 34 | |||
| 35 | (define earlyoom-configuration->command-line-args | ||
| 36 | (@@ (gnu services linux) earlyoom-configuration->command-line-args)) | ||
| 37 | |||
| 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\""))) | ||
| 49 | |||
| 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)) | ||
| 56 | |||
| 57 | (test-end "linux-services") | ||
