1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
4 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
5 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu tests nfs)
24 #:use-module (gnu tests)
25 #:use-module (gnu bootloader)
26 #:use-module (gnu bootloader grub)
27 #:use-module (gnu system)
28 #:use-module (gnu system file-systems)
29 #:use-module (gnu system shadow)
30 #:use-module (gnu system vm)
31 #:use-module (gnu services)
32 #:use-module (gnu services base)
33 #:use-module (gnu services nfs)
34 #:use-module (gnu services networking)
35 #:use-module (gnu packages onc-rpc)
36 #:use-module (guix gexp)
37 #:use-module (guix store)
38 #:use-module (guix monads)
43 (host-name "olitupmok")
44 (timezone "Europe/Berlin")
45 (locale "en_US.UTF-8")
47 (bootloader (bootloader-configuration
48 (bootloader grub-bootloader)
50 (file-systems %base-file-systems)
51 (users %base-user-accounts)
56 (service rpcbind-service-type
57 (rpcbind-configuration))
58 (service dhcp-client-service-type)
61 (define (run-nfs-test name socket)
62 "Run a test of an OS running RPC-SERVICE, which should create SOCKET."
64 (marionette-operating-system
66 #:imported-modules '((gnu services herd)
70 (with-imported-modules '((gnu build marionette))
72 (use-modules (gnu build marionette)
76 (make-marionette (list #$(virtual-machine os))))
78 (define (wait-for-socket file)
79 ;; Wait until SOCKET exists in the guest
82 (cond ((and (file-exists? ,file)
83 (eq? 'socket (stat:type (stat ,file))))
89 (error "Socket didn't show up: " ,file))))
95 (test-begin "rpc-daemon")
97 ;; Wait for the rpcbind daemon to be up and running.
98 (test-assert "RPC service running"
101 (use-modules (gnu services herd))
102 (start-service 'rpcbind-daemon))
105 ;; Check the socket file and that the service is still running.
106 (test-assert "RPC socket exists"
108 (wait-for-socket #$socket)
111 (use-modules (gnu services herd)
114 (live-service-running
116 (memq 'rpcbind-daemon
117 (live-service-provision live)))
118 (current-services))))
121 (test-assert "Probe RPC daemon"
123 '(zero? (system* "rpcinfo" "-p"))
127 (exit (= (test-runner-fail-count (test-runner-current)) 0)))))
129 (gexp->derivation name test))
134 (description "Test some things related to NFS.")
135 (value (run-nfs-test name "/var/run/rpcbind.sock"))))