1 import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }:
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ eelco ];
11 { boot.kernelPackages = lib.mkIf latestKernel pkgs.linuxPackages_latest;
12 sound.enable = true; # needed for the factl test, /dev/snd/* exists without them but udev doesn't care then
16 machine.start(allow_reboot = True)
18 machine.wait_for_unit("multi-user.target")
19 machine.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
20 machine.screenshot("postboot")
22 with subtest("create user"):
23 machine.succeed("useradd -m alice")
24 machine.succeed("(echo foobar; echo foobar) | passwd alice")
26 with subtest("Check whether switching VTs works"):
27 machine.fail("pgrep -f 'agetty.*tty2'")
28 machine.send_key("alt-f2")
29 machine.wait_until_succeeds("[ $(fgconsole) = 2 ]")
30 machine.wait_for_unit("getty@tty2.service")
31 machine.wait_until_succeeds("pgrep -f 'agetty.*tty2'")
33 with subtest("Log in as alice on a virtual console"):
34 machine.wait_until_tty_matches("2", "login: ")
35 machine.send_chars("alice\n")
36 machine.wait_until_tty_matches("2", "login: alice")
37 machine.wait_until_succeeds("pgrep login")
38 machine.wait_until_tty_matches("2", "Password: ")
39 machine.send_chars("foobar\n")
40 machine.wait_until_succeeds("pgrep -u alice bash")
41 machine.send_chars("touch done\n")
42 machine.wait_for_file("/home/alice/done")
44 with subtest("Systemd gives and removes device ownership as needed"):
45 machine.succeed("getfacl /dev/snd/timer | grep -q alice")
46 machine.send_key("alt-f1")
47 machine.wait_until_succeeds("[ $(fgconsole) = 1 ]")
48 machine.fail("getfacl /dev/snd/timer | grep -q alice")
49 machine.succeed("chvt 2")
50 machine.wait_until_succeeds("getfacl /dev/snd/timer | grep -q alice")
52 with subtest("Virtual console logout"):
53 machine.send_chars("exit\n")
54 machine.wait_until_fails("pgrep -u alice bash")
55 machine.screenshot("getty")
57 with subtest("Check whether ctrl-alt-delete works"):
58 boot_id1 = machine.succeed("cat /proc/sys/kernel/random/boot_id").strip()
63 boot_id2 = machine.succeed("cat /proc/sys/kernel/random/boot_id").strip()
66 assert boot_id1 != boot_id2