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