diff options
Diffstat (limited to 'gnu/tests')
-rw-r--r-- | gnu/tests/base.scm | 23 | ||||
-rw-r--r-- | gnu/tests/install.scm | 13 | ||||
-rw-r--r-- | gnu/tests/linux-modules.scm | 56 | ||||
-rw-r--r-- | gnu/tests/networking.scm | 3 | ||||
-rw-r--r-- | gnu/tests/reconfigure.scm | 16 | ||||
-rw-r--r-- | gnu/tests/ssh.scm | 5 | ||||
-rw-r--r-- | gnu/tests/web.scm | 5 |
7 files changed, 89 insertions, 32 deletions
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index 37b83dc7ec..086d2a133f 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -195,6 +195,14 @@ info --version") (pk 'services services) '(root #$@(operating-system-shepherd-service-names os))))) + (test-equal "/var/log/messages is not world-readable" + #o640 ;<https://bugs.gnu.org/40405> + (begin + (wait-for-file "/var/log/messages" marionette + #:read 'get-u8) + (marionette-eval '(stat:perms (lstat "/var/log/messages")) + marionette))) + (test-assert "homes" (let ((homes '#$(map user-account-home-directory @@ -451,6 +459,21 @@ info --version") (marionette-eval '(readlink "/var/guix/gcroots/profiles") marionette)) + (test-equal "guix-daemon set-http-proxy action" + '(#t) ;one value, #t + (marionette-eval '(with-shepherd-action 'guix-daemon + ('set-http-proxy "http://localhost:8118") + result + result) + marionette)) + + (test-equal "guix-daemon set-http-proxy action, clear" + '(#t) ;one value, #t + (marionette-eval '(with-shepherd-action 'guix-daemon + ('set-http-proxy) + result + result) + marionette)) (test-assert "screendump" (begin diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index b0b40f2764..8650474fbc 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -232,7 +232,9 @@ packages defined in installation-os." os (list target)) #:disk-image-size install-size #:file-system-type - installation-disk-image-file-system-type))) + installation-disk-image-file-system-type + ;; Don't provide substitutes; too big. + #:substitutable? #f))) (define install (with-imported-modules '((guix build utils) (gnu build marionette)) @@ -250,7 +252,7 @@ packages defined in installation-os." (make-marionette `(,(which #$(qemu-command system)) "-no-reboot" - "-m" "800" + "-m" "1200" #$@(cond ((string=? "ext4" installation-disk-image-file-system-type) #~("-drive" @@ -296,7 +298,8 @@ packages defined in installation-os." (exit #$(and gui-test (gui-test #~marionette))))))) - (gexp->derivation "installation" install))) + (gexp->derivation "installation" install + #:substitutable? #f))) ;too big (define* (qemu-command/writable-image image #:key (memory-size 256)) "Return as a monadic value the command to run QEMU on a writable copy of @@ -1071,7 +1074,7 @@ build (current-guix) and then store a couple of full system images.") %base-user-accounts)) ;; The installer does not create a swap device in guided mode with ;; encryption support. - (swap-devices (if encrypted? '() '("/dev/vdb2"))) + (swap-devices (if encrypted? '() '("/dev/vda2"))) (services (cons (service dhcp-client-service-type) (operating-system-user-services %minimal-os))))) @@ -1122,6 +1125,8 @@ build (current-guix) and then store a couple of full system images.") #:os installation-os-for-gui-tests #:install-size install-size #:target-size target-size + #:installation-disk-image-file-system-type + "iso9660" #:gui-test (lambda (marionette) (gui-test-program diff --git a/gnu/tests/linux-modules.scm b/gnu/tests/linux-modules.scm index 39e11587c6..953b132ef7 100644 --- a/gnu/tests/linux-modules.scm +++ b/gnu/tests/linux-modules.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.org> ;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org> +;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,14 +20,18 @@ (define-module (gnu tests linux-modules) #:use-module (gnu packages linux) + #:use-module (gnu services) + #:use-module (gnu services linux) #:use-module (gnu system) #:use-module (gnu system vm) #:use-module (gnu tests) #:use-module (guix derivations) #:use-module (guix gexp) #:use-module (guix modules) + #:use-module (guix packages) #:use-module (guix monads) #:use-module (guix store) + #:use-module (guix utils) #:export (%test-loadable-kernel-modules-0 %test-loadable-kernel-modules-1 %test-loadable-kernel-modules-2)) @@ -37,25 +42,40 @@ ;;; ;;; Code: -(define* (module-loader-program os modules) - "Return an executable store item that, upon being evaluated, will dry-run -load MODULES." +(define* (modules-loaded?-program os modules) + "Return an executable store item that, upon being evaluated, will verify +that MODULES are actually loaded." (program-file - "load-kernel-modules.scm" - (with-imported-modules (source-module-closure '((guix build utils))) - #~(begin - (use-modules (guix build utils)) - (for-each (lambda (module) - (invoke (string-append #$kmod "/bin/modprobe") "-n" "--" - module)) - '#$modules))))) + "verify-kernel-modules-loaded.scm" + #~(begin + (use-modules (ice-9 rdelim) + (ice-9 popen) + (srfi srfi-1) + (srfi srfi-13)) + (let* ((port (open-input-pipe (string-append #$kmod "/bin/lsmod"))) + (lines (string-split (read-string port) #\newline)) + (separators (char-set #\space #\tab)) + (modules (map (lambda (line) + (string-take line + (or (string-index line separators) + 0))) + lines)) + (status (close-pipe port))) + (and (= status 0) + (and-map (lambda (module) + (member module modules string=?)) + '#$modules)))))) (define* (run-loadable-kernel-modules-test module-packages module-names) - "Run a test of an OS having MODULE-PACKAGES, and modprobe MODULE-NAMES." + "Run a test of an OS having MODULE-PACKAGES, and verify that MODULE-NAMES +are loaded in memory." (define os (marionette-operating-system (operating-system (inherit (simple-operating-system)) + (services (cons (service kernel-module-loader-service-type module-names) + (operating-system-user-services + (simple-operating-system)))) (kernel-loadable-modules module-packages)) #:imported-modules '((guix combinators)))) (define vm (virtual-machine os)) @@ -75,7 +95,8 @@ load MODULES." marionette)) (test-end) (exit (= (test-runner-fail-count (test-runner-current)) 0))))) - (gexp->derivation "loadable-kernel-modules" (test (module-loader-program os module-names)))) + (gexp->derivation "loadable-kernel-modules" + (test (modules-loaded?-program os module-names)))) (define %test-loadable-kernel-modules-0 (system-test @@ -99,5 +120,12 @@ with one extra module.") (description "Tests loadable kernel modules facility of <operating-system> with two extra modules.") (value (run-loadable-kernel-modules-test - (list acpi-call-linux-module ddcci-driver-linux) + (list acpi-call-linux-module + (package + (inherit ddcci-driver-linux) + (arguments + `(#:linux #f + ,@(strip-keyword-arguments '(#:linux) + (package-arguments + ddcci-driver-linux)))))) '("acpi_call" "ddcci"))))) diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm index e90b247883..ca18b2f452 100644 --- a/gnu/tests/networking.scm +++ b/gnu/tests/networking.scm @@ -205,7 +205,8 @@ port 7, and a dict service on port 2628." ;; Make sure the bridge is created. (test-assert "br0 exists" (marionette-eval - '(zero? (system* "ovs-vsctl" "br-exists" "br0")) + '(zero? (system* #$(file-append openvswitch "/bin/ovs-vsctl") + "br-exists" "br0")) marionette)) ;; Make sure eth0 is connected to the bridge. diff --git a/gnu/tests/reconfigure.scm b/gnu/tests/reconfigure.scm index 8b85920979..928a210a94 100644 --- a/gnu/tests/reconfigure.scm +++ b/gnu/tests/reconfigure.scm @@ -136,14 +136,6 @@ Shepherd (PID 1) by unloading obsolete services and loading new services." (stop #~(const #t)) (respawn? #f))) - ;; Return the Shepherd service file for SERVICE, after ensuring that it - ;; exists in the store. - (define (ensure-service-file service) - (let ((file (shepherd-service-file service))) - (mlet* %store-monad ((store-object (lower-object file)) - (_ (built-derivations (list store-object)))) - (return file)))) - (define (test enable-dummy disable-dummy) (with-imported-modules '((gnu build marionette)) #~(begin @@ -187,10 +179,12 @@ Shepherd (PID 1) by unloading obsolete services and loading new services." (test-end) (exit (= (test-runner-fail-count (test-runner-current)) 0))))) - (mlet* %store-monad ((file (ensure-service-file dummy-service))) - (let ((enable (upgrade-services-program (list file) '(dummy) '() '())) + (gexp->derivation + "upgrade-services" + (let* ((file (shepherd-service-file dummy-service)) + (enable (upgrade-services-program (list file) '(dummy) '() '())) (disable (upgrade-services-program '() '() '(dummy) '()))) - (gexp->derivation "upgrade-services" (test enable disable))))) + (test enable disable)))) (define* (run-install-bootloader-test) "Run a test of an OS running INSTALL-BOOTLOADER-PROGRAM, which installs a diff --git a/gnu/tests/ssh.scm b/gnu/tests/ssh.scm index a74227ea4a..10438ad22a 100644 --- a/gnu/tests/ssh.scm +++ b/gnu/tests/ssh.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> ;;; @@ -136,6 +136,9 @@ root with an empty password." (current-services)))) marionette)) + (test-assert "wait for port 22" + (wait-for-tcp-port 22 marionette)) + ;; Connect to the guest over SSH. Make sure we can run a shell ;; command there. (test-equal "shell command" diff --git a/gnu/tests/web.scm b/gnu/tests/web.scm index 7c1c0aa511..1c984dd6f4 100644 --- a/gnu/tests/web.scm +++ b/gnu/tests/web.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2017, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2017, 2019 Christopher Baines <mail@cbaines.net> ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr> @@ -110,6 +110,9 @@ HTTP-PORT." ((pid) (number? pid)))))) marionette)) + (test-assert "HTTP port ready" + (wait-for-tcp-port #$forwarded-port marionette)) + ;; Retrieve the index.html file we put in /srv. (test-equal "http-get" '(200 #$%index.html-contents) |