;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017 Ludovic Courtès ;;; Copyright © 2016 John Darrington ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2018 Clément Lassieur ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu tests nfs) #:use-module (gnu tests) #:use-module (gnu bootloader) #:use-module (gnu bootloader grub) #:use-module (gnu system) #:use-module (gnu system file-systems) #:use-module (gnu system shadow) #:use-module (gnu system vm) #:use-module (gnu services) #:use-module (gnu services base) #:use-module (gnu services nfs) #:use-module (gnu services networking) #:use-module (gnu packages onc-rpc) #:use-module (guix gexp) #:use-module (guix store) #:use-module (guix monads) #:export (%test-nfs)) (define %base-os (operating-system (host-name "olitupmok") (timezone "Europe/Berlin") (locale "en_US.UTF-8") (bootloader (bootloader-configuration (bootloader grub-bootloader) (target "/dev/sdX"))) (file-systems %base-file-systems) (users %base-user-accounts) (packages (cons* rpcbind %base-packages)) (services (cons* (service rpcbind-service-type (rpcbind-configuration)) (service dhcp-client-service-type) %base-services)))) (define (run-nfs-test name socket) "Run a test of an OS running RPC-SERVICE, which should create SOCKET." (define os (marionette-operating-system %base-os #:imported-modules '((gnu services herd) (guix combinators)))) (define test (with-imported-modules '((gnu build marionette)) #~(begin (use-modules (gnu build marionette) (srfi srfi-64)) (define marionette (make-marionette (list #$(virtual-machine os)))) (define (wait-for-socket file) ;; Wait until SOCKET exists in the guest (marionette-eval `(let loop ((i 10)) (cond ((and (file-exists? ,file) (eq? 'socket (stat:type (stat ,file)))) #t) ((> i 0) (sleep 1) (loop (- i 1))) (else (error "Socket didn't show up: " ,file)))) marionette)) (mkdir #$output) (chdir #$output) (test-begin "rpc-daemon") ;; Wait for the rpcbind daemon to be up and running. (test-assert "RPC service running" (marionette-eval '(begin (use-modules (gnu services herd)) (start-service 'rpcbind-daemon)) marionette)) ;; Check the socket file and that the service is still running. (test-assert "RPC socket exists" (and (wait-for-socket #$socket) (marionette-eval '(begin (use-modules (gnu services herd) (srfi srfi-1)) (live-service-running (find (lambda (live) (memq 'rpcbind-daemon (live-service-provision live))) (current-services)))) marionette))) (test-assert "Probe RPC daemon" (marionette-eval '(zero? (system* "rpcinfo" "-p")) marionette)) (test-end) (exit (= (test-runner-fail-count (test-runner-current)) 0))))) (gexp->derivation name test)) (define %test-nfs (system-test (name "nfs") (description "Test some things related to NFS.") (value (run-nfs-test name "/var/run/rpcbind.sock")))) 79b8'>guix: Refactor script....* scripts/guix.in: Remove empty surrounding ‘let’. Define 'main' as the procedure called when running the script. (maybe-augment-load-paths!): Rename to ... (augment-load-paths!): ... this. Use 'and=>' for 'file-exists?'. (run-guix-main): Rename to ... (main): ... this. Call 'augment-load-paths!'. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Mathieu Lirzin 2018-01-23build: Expand ‘scripts/guix’ at Make time....This moves the complexity of Autotools variable expansion outside of the application code. * scripts/guix.in (config-lookup): Delete. (maybe-augment-load-paths!, run-guix-main): Use fully expanded variables instead of calling ‘config-lookup’. * configure.ac: Don't use AC_CONFIG_FILES for ‘scripts/guix’. Use AC_PROG_SED. * Makefile.am (scripts/guix): New rule. (do_subst): New variable. (CLEANFILES, EXTRA_DIST): Adapt. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Mathieu Lirzin 2017-03-20build: Install .go files to $libdir/guile/X.Y....* configure.ac: Define and substitute 'guileobjectdir'. * Makefile.am (nobase_nodist_guilemodule_DATA): Remove $(GOBJECTS). (nobase_nodist_guileobject_DATA): New variable. (guix_install_go_files): Adjust accordingly. (install-data-hook): Likewise. * scripts/guix.in (config-lookup): Add 'exec_prefix' and 'guileobjectdir'. Add '_' in VAR-REF-REGEXP. (maybe-augment-load-paths!): Distinguish OBJECT-DIR from MODULE-DIR. Ludovic Courtès 2016-04-06challenge: Really exit with non-zero upon hash mismatch....Reported by John Darrington. * guix/scripts/challenge.scm (guix-challenge): Add an explicit 'exit' call when ISSUES is empty. * scripts/guix.in: Add comment about 'exit'. * doc/guix.texi (Invoking guix challenge): Mention the behavior and exit code. Ludovic Courtès