mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-15 22:19:17 +03:00
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
This commit is contained in:
parent
4b73ceed19
commit
ae34cddb51
3 changed files with 62 additions and 3 deletions
50
nixos/tests/systemtap.nix
Normal file
50
nixos/tests/systemtap.nix
Normal file
|
@ -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);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue