at master 1.5 kB view raw
1{ 2 latestKernel, 3 lib, 4 ... 5}: 6 7{ 8 name = "systemd-analyze"; 9 meta.maintainers = with lib.maintainers; [ raskin ]; 10 11 _module.args.latestKernel = lib.mkDefault false; 12 13 nodes.machine = 14 { pkgs, lib, ... }: 15 { 16 boot.kernelPackages = lib.mkIf latestKernel pkgs.linuxPackages_latest; 17 }; 18 19 testScript = '' 20 machine.wait_for_unit("multi-user.target") 21 22 # We create a special output directory to copy it as a whole 23 with subtest("Prepare output dir"): 24 machine.succeed("mkdir systemd-analyze") 25 26 27 # Save the output into a file with given name inside the common 28 # output directory 29 def run_systemd_analyze(args, name): 30 tgt_dir = "systemd-analyze" 31 machine.succeed( 32 "systemd-analyze {} > {}/{} 2> {}/{}.err".format( 33 " ".join(args), tgt_dir, name, tgt_dir, name 34 ) 35 ) 36 37 38 with subtest("Print statistics"): 39 run_systemd_analyze(["blame"], "blame.txt") 40 run_systemd_analyze(["critical-chain"], "critical-chain.txt") 41 run_systemd_analyze(["dot"], "dependencies.dot") 42 run_systemd_analyze(["plot"], "systemd-analyze.svg") 43 44 # We copy the main graph into the $out (toplevel), and we also copy 45 # the entire output directory with additional data 46 with subtest("Copying the resulting data into $out"): 47 machine.copy_from_vm("systemd-analyze/", "") 48 machine.copy_from_vm("systemd-analyze/systemd-analyze.svg", "") 49 ''; 50}