at 23.11-pre 1.6 kB view raw
1import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }: 2 3{ 4 name = "systemd-analyze"; 5 meta = with pkgs.lib.maintainers; { 6 maintainers = [ raskin ]; 7 }; 8 9 nodes.machine = 10 { pkgs, lib, ... }: 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 13 }; 14 15 testScript = '' 16 machine.wait_for_unit("multi-user.target") 17 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") 21 22 23 # Save the output into a file with given name inside the common 24 # output directory 25 def run_systemd_analyze(args, name): 26 tgt_dir = "systemd-analyze" 27 machine.succeed( 28 "systemd-analyze {} > {}/{} 2> {}/{}.err".format( 29 " ".join(args), tgt_dir, name, tgt_dir, name 30 ) 31 ) 32 33 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") 39 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", "") 45 ''; 46})