1 import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }:
4 name = "systemd-analyze";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ raskin ];
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")
18 # We create a special output directory to copy it as a whole
19 with subtest("Prepare output dir"):
20 machine.succeed("mkdir systemd-analyze")
23 # Save the output into a file with given name inside the common
25 def run_systemd_analyze(args, name):
26 tgt_dir = "systemd-analyze"
28 "systemd-analyze {} > {}/{} 2> {}/{}.err".format(
29 " ".join(args), tgt_dir, name, tgt_dir, name
34 with subtest("Print statistics"):
35 run_systemd_analyze(["blame"], "blame.txt")
36 run_systemd_analyze(["critical-chain"], "critical-chain.txt")
37 run_systemd_analyze(["dot"], "dependencies.dot")
38 run_systemd_analyze(["plot"], "systemd-analyze.svg")
40 # We copy the main graph into the $out (toplevel), and we also copy
41 # the entire output directory with additional data
42 with subtest("Copying the resulting data into $out"):
43 machine.copy_from_vm("systemd-analyze/", "")
44 machine.copy_from_vm("systemd-analyze/systemd-analyze.svg", "")