aboutsummaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-02-01 12:16:39 +0100
committerLudovic Courtès <ludo@gnu.org>2017-02-01 12:36:41 +0100
commitae763b5b0b7d5e7316a3d0efe991fe8ab2261031 (patch)
treeffe951fbfe0387c43b7352f1bd3d2e0571b1d154 /gnu/tests
parent524ee6c9e5a2510f6e15ab23c75a26f61b6a0d81 (diff)
downloadguix-ae763b5b0b7d5e7316a3d0efe991fe8ab2261031.tar
guix-ae763b5b0b7d5e7316a3d0efe991fe8ab2261031.tar.gz
system: Create home directories once 'file-systems' is up.
Fixes <http://bugs.gnu.org/21108>. Reported by Andy Patterson <ajpatter@uwaterloo.ca> and Leo Famulari <leo@famulari.name>. * gnu/build/activation.scm (activate-users+groups)[activate-user]: Pass #:create-home? #t iff CREATE-HOME? and SYSTEM?. (activate-user-home): New procedure. * gnu/system/shadow.scm (account-shepherd-service): New procedure. (account-service-type)[extensions]: Add SHEPHERD-ROOT-SERVICE-TYPE extension. * gnu/tests/base.scm (run-basic-test)["home"] ["skeletons in home directories"]: New tests. * gnu/tests/install.scm (%separate-home-os, %separate-home-os-source) (%test-separate-home-os): New variables.
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/base.scm37
-rw-r--r--gnu/tests/install.scm60
2 files changed, 96 insertions, 1 deletions
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index a725ca90f3..756d3df800 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -146,6 +146,43 @@ info --version")
(pk 'services services)
'(root #$@(operating-system-shepherd-service-names os)))))
+ (test-assert "homes"
+ (let ((homes
+ '#$(map user-account-home-directory
+ (filter user-account-create-home-directory?
+ (operating-system-user-accounts os)))))
+ (marionette-eval
+ `(begin
+ (use-modules (gnu services herd) (srfi srfi-1))
+
+ ;; Home directories are supposed to exist once 'user-homes'
+ ;; has been started.
+ (start-service 'user-homes)
+
+ (every (lambda (home)
+ (and (file-exists? home)
+ (file-is-directory? home)))
+ ',homes))
+ marionette)))
+
+ (test-assert "skeletons in home directories"
+ (let ((homes
+ '#$(filter-map (lambda (account)
+ (and (user-account-create-home-directory?
+ account)
+ (not (user-account-system? account))
+ (user-account-home-directory account)))
+ (operating-system-user-accounts os))))
+ (marionette-eval
+ `(begin
+ (use-modules (srfi srfi-1) (ice-9 ftw))
+ (every (lambda (home)
+ (null? (lset-difference string=?
+ (scandir "/etc/skel/")
+ (scandir home))))
+ ',homes))
+ marionette)))
+
(test-equal "login on tty1"
"root\n"
(begin
diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm
index 4e8d594054..b104efcfd5 100644
--- a/gnu/tests/install.scm
+++ b/gnu/tests/install.scm
@@ -35,6 +35,7 @@
#:use-module (guix utils)
#:export (%test-installed-os
%test-separate-store-os
+ %test-separate-home-os
%test-raid-root-os
%test-encrypted-os
%test-btrfs-root-os))
@@ -218,7 +219,6 @@ IMAGE, a disk image. The QEMU VM is has access to MEMORY-SIZE MiB of RAM."
"-no-reboot" "-m" #$(number->string memory-size)
"-drive" "file=disk.img,if=virtio")))))
-
(define %test-installed-os
(system-test
(name "installed-os")
@@ -234,6 +234,64 @@ build (current-guix) and then store a couple of full system images.")
;;;
+;;; Separate /home.
+;;;
+
+(define-os-with-source (%separate-home-os %separate-home-os-source)
+ ;; The OS we want to install.
+ (use-modules (gnu) (gnu tests) (srfi srfi-1))
+
+ (operating-system
+ (host-name "liberigilo")
+ (timezone "Europe/Paris")
+ (locale "en_US.utf8")
+
+ (bootloader (grub-configuration (device "/dev/vdb")))
+ (kernel-arguments '("console=ttyS0"))
+ (file-systems (cons* (file-system
+ (device "my-root")
+ (title 'label)
+ (mount-point "/")
+ (type "ext4"))
+ (file-system
+ (device "none")
+ (title 'device)
+ (type "tmpfs")
+ (mount-point "/home")
+ (type "tmpfs"))
+ %base-file-systems))
+ (users (cons* (user-account
+ (name "alice")
+ (group "users")
+ (home-directory "/home/alice"))
+ (user-account
+ (name "charlie")
+ (group "users")
+ (home-directory "/home/charlie"))
+ %base-user-accounts))
+ (services (cons (service marionette-service-type
+ (marionette-configuration
+ (imported-modules '((gnu services herd)
+ (guix combinators)))))
+ %base-services))))
+
+(define %test-separate-home-os
+ (system-test
+ (name "separate-home-os")
+ (description
+ "Test basic functionality of an installed OS with a separate /home
+partition. In particular, home directories must be correctly created (see
+<https://bugs.gnu.org/21108>).")
+ (value
+ (mlet* %store-monad ((image (run-install %separate-home-os
+ %separate-home-os-source
+ #:script
+ %simple-installation-script))
+ (command (qemu-command/writable-image image)))
+ (run-basic-test %separate-home-os command "separate-home-os")))))
+
+
+;;;
;;; Separate /gnu/store partition.
;;;