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.wait_for_unit("multi-user.target")
17 machine.wait_until_succeeds("pgrep -f 'agetty.*tty1'")
18 machine.screenshot("postboot")
20 with subtest("create user"):
21 machine.succeed("useradd -m alice")
22 machine.succeed("(echo foobar; echo foobar) | passwd alice")
24 with subtest("Check whether switching VTs works"):
25 machine.fail("pgrep -f 'agetty.*tty2'")
26 machine.send_key("alt-f2")
27 machine.wait_until_succeeds("[ $(fgconsole) = 2 ]")
28 machine.wait_for_unit("getty@tty2.service")
29 machine.wait_until_succeeds("pgrep -f 'agetty.*tty2'")
31 with subtest("Log in as alice on a virtual console"):
32 machine.wait_until_tty_matches("2", "login: ")
33 machine.send_chars("alice\n")
34 machine.wait_until_tty_matches("2", "login: alice")
35 machine.wait_until_succeeds("pgrep login")
36 machine.wait_until_tty_matches("2", "Password: ")
37 machine.send_chars("foobar\n")
38 machine.wait_until_succeeds("pgrep -u alice bash")
39 machine.send_chars("touch done\n")
40 machine.wait_for_file("/home/alice/done")
42 with subtest("Systemd gives and removes device ownership as needed"):
43 machine.succeed("getfacl /dev/snd/timer | grep -q alice")
44 machine.send_key("alt-f1")
45 machine.wait_until_succeeds("[ $(fgconsole) = 1 ]")
46 machine.fail("getfacl /dev/snd/timer | grep -q alice")
47 machine.succeed("chvt 2")
48 machine.wait_until_succeeds("getfacl /dev/snd/timer | grep -q alice")
50 with subtest("Virtual console logout"):
51 machine.send_chars("exit\n")
52 machine.wait_until_fails("pgrep -u alice bash")
53 machine.screenshot("getty")
55 with subtest("Check whether ctrl-alt-delete works"):
56 machine.send_key("ctrl-alt-delete")
57 machine.wait_for_shutdown()