diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2019-12-13 11:43:39 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2019-12-13 11:43:39 +0100 |
commit | dfdf1597a7cc13c40653722a771be12afaa64edb (patch) | |
tree | 4d7cd3f21ba89453f23ea1addb55e00574a638bf /nixos/tests/systemd-analyze.nix | |
parent | d5d8b3514d64fcd4022186795f604ec3f360ae17 (diff) | |
parent | 418ad571c3ec856d49b65fa53ab99f185c2d9def (diff) | |
download | nixpkgs-dfdf1597a7cc13c40653722a771be12afaa64edb.tar nixpkgs-dfdf1597a7cc13c40653722a771be12afaa64edb.tar.gz nixpkgs-dfdf1597a7cc13c40653722a771be12afaa64edb.tar.bz2 nixpkgs-dfdf1597a7cc13c40653722a771be12afaa64edb.tar.lz nixpkgs-dfdf1597a7cc13c40653722a771be12afaa64edb.tar.xz nixpkgs-dfdf1597a7cc13c40653722a771be12afaa64edb.tar.zst nixpkgs-dfdf1597a7cc13c40653722a771be12afaa64edb.zip |
Merge master into staging-next
Diffstat (limited to 'nixos/tests/systemd-analyze.nix')
-rw-r--r-- | nixos/tests/systemd-analyze.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/nixos/tests/systemd-analyze.nix b/nixos/tests/systemd-analyze.nix new file mode 100644 index 00000000000..a78ba08cd55 --- /dev/null +++ b/nixos/tests/systemd-analyze.nix @@ -0,0 +1,46 @@ +import ./make-test-python.nix ({ pkgs, latestKernel ? false, ... }: + +{ + name = "systemd-analyze"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ raskin ]; + }; + + machine = + { pkgs, lib, ... }: + { boot.kernelPackages = lib.mkIf latestKernel pkgs.linuxPackages_latest; + sound.enable = true; # needed for the factl test, /dev/snd/* exists without them but udev doesn't care then + }; + + testScript = '' + machine.wait_for_unit("multi-user.target") + + # We create a special output directory to copy it as a whole + with subtest("Prepare output dir"): + machine.succeed("mkdir systemd-analyze") + + + # Save the output into a file with given name inside the common + # output directory + def run_systemd_analyze(args, name): + tgt_dir = "systemd-analyze" + machine.succeed( + "systemd-analyze {} > {}/{} 2> {}/{}.err".format( + " ".join(args), tgt_dir, name, tgt_dir, name + ) + ) + + + with subtest("Print statistics"): + run_systemd_analyze(["blame"], "blame.txt") + run_systemd_analyze(["critical-chain"], "critical-chain.txt") + run_systemd_analyze(["dot"], "dependencies.dot") + run_systemd_analyze(["plot"], "systemd-analyze.svg") + + # We copy the main graph into the $out (toplevel), and we also copy + # the entire output directory with additional data + with subtest("Copying the resulting data into $out"): + machine.copy_from_vm("systemd-analyze/", "") + machine.copy_from_vm("systemd-analyze/systemd-analyze.svg", "") + ''; +}) |