diff options
author | Herwig Hochleitner <herwig@bendlas.net> | 2024-01-09 19:38:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 19:38:02 +0100 |
commit | ae34cddb51a9ed2c1c32b0fd7d5d6f8029509c4c (patch) | |
tree | d5e41c39710bc55f46d5c28fe8a25e2554aa85c8 /nixos/tests/systemtap.nix | |
parent | 4b73ceed1946f55453d87835c7ba7ac2123cb24c (diff) |
linuxPackages.systemtap: 4.8 -> 5.0a, add nixos tests (#276840)
* nixos/tests/systemtap: init smoke test * linuxPackages.systemtap: use --sysroot instead of -r * nixos/tests/systemtap: rule out warnings * linuxPackages.systemtap: smaller sysroot * nixos/tests/systemtap: test on a few more kernels * linuxPackages.systemtap: provide debuginfo for tracing kernel.function * linuxPackages.systemtap: test kernel.function probe * linuxPackages.systemtap: 4.8 -> 5.0a
Diffstat (limited to 'nixos/tests/systemtap.nix')
-rw-r--r-- | nixos/tests/systemtap.nix | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/nixos/tests/systemtap.nix b/nixos/tests/systemtap.nix new file mode 100644 index 0000000000000..5cd79d66e872b --- /dev/null +++ b/nixos/tests/systemtap.nix @@ -0,0 +1,50 @@ +{ system ? builtins.currentSystem +, config ? { } +, pkgs ? import ../.. { inherit system config; } +}@args: + +with pkgs.lib; + +let + stapScript = pkgs.writeText "test.stp" '' + probe kernel.function("do_sys_poll") { + println("kernel function probe & println work") + exit() + } + ''; + + ## TODO shared infra with ../kernel-generic.nix + testsForLinuxPackages = linuxPackages: (import ./make-test-python.nix ({ pkgs, ... }: { + name = "kernel-${linuxPackages.kernel.version}"; + meta = with pkgs.lib.maintainers; { + maintainers = [ bendlas ]; + }; + + nodes.machine = { ... }: + { + boot.kernelPackages = linuxPackages; + programs.systemtap.enable = true; + }; + + testScript = + '' + with subtest("Capture stap ouput"): + output = machine.succeed("stap ${stapScript} 2>&1") + + with subtest("Ensure that expected output from stap script is there"): + assert "kernel function probe & println work\n" == output, "kernel function probe & println work\n != " + output + ''; + }) args); + + ## TODO shared infra with ../kernel-generic.nix + kernels = { + inherit (pkgs.linuxKernel.packageAliases) linux_default linux_latest; + }; + +in mapAttrs (_: lP: testsForLinuxPackages lP) kernels // { + passthru = { + inherit testsForLinuxPackages; + + testsForKernel = kernel: testsForLinuxPackages (pkgs.linuxPackagesFor kernel); + }; +} |