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;
15 machine.wait_for_unit("multi-user.target")
17 # We create a special output directory to copy it as a whole
18 with subtest("Prepare output dir"):
19 machine.succeed("mkdir systemd-analyze")
22 # Save the output into a file with given name inside the common
24 def run_systemd_analyze(args, name):
25 tgt_dir = "systemd-analyze"
27 "systemd-analyze {} > {}/{} 2> {}/{}.err".format(
28 " ".join(args), tgt_dir, name, tgt_dir, name
33 with subtest("Print statistics"):
34 run_systemd_analyze(["blame"], "blame.txt")
35 run_systemd_analyze(["critical-chain"], "critical-chain.txt")
36 run_systemd_analyze(["dot"], "dependencies.dot")
37 run_systemd_analyze(["plot"], "systemd-analyze.svg")
39 # We copy the main graph into the $out (toplevel), and we also copy
40 # the entire output directory with additional data
41 with subtest("Copying the resulting data into $out"):
42 machine.copy_from_vm("systemd-analyze/", "")
43 machine.copy_from_vm("systemd-analyze/systemd-analyze.svg", "")