nixosTests.bpf: handleTest -> runTest
This commit is contained in:
parent
16e6e74550
commit
4e792f525e
@ -269,7 +269,7 @@ in
|
|||||||
borgbackup = runTest ./borgbackup.nix;
|
borgbackup = runTest ./borgbackup.nix;
|
||||||
borgmatic = runTest ./borgmatic.nix;
|
borgmatic = runTest ./borgmatic.nix;
|
||||||
botamusique = runTest ./botamusique.nix;
|
botamusique = runTest ./botamusique.nix;
|
||||||
bpf = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./bpf.nix { };
|
bpf = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./bpf.nix;
|
||||||
bpftune = runTest ./bpftune.nix;
|
bpftune = runTest ./bpftune.nix;
|
||||||
breitbandmessung = runTest ./breitbandmessung.nix;
|
breitbandmessung = runTest ./breitbandmessung.nix;
|
||||||
broadcast-box = runTest ./broadcast-box.nix;
|
broadcast-box = runTest ./broadcast-box.nix;
|
||||||
|
@ -1,44 +1,42 @@
|
|||||||
import ./make-test-python.nix (
|
{ lib, ... }:
|
||||||
{ pkgs, ... }:
|
{
|
||||||
{
|
name = "bpf";
|
||||||
name = "bpf";
|
meta.maintainers = with lib.maintainers; [ martinetd ];
|
||||||
meta.maintainers = with pkgs.lib.maintainers; [ martinetd ];
|
|
||||||
|
|
||||||
nodes.machine =
|
nodes.machine =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
programs.bcc.enable = true;
|
programs.bcc.enable = true;
|
||||||
environment.systemPackages = with pkgs; [ bpftrace ];
|
environment.systemPackages = with pkgs; [ bpftrace ];
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
## bcc
|
## bcc
|
||||||
# syscount -d 1 stops 1s after probe started so is good for that
|
# syscount -d 1 stops 1s after probe started so is good for that
|
||||||
print(machine.succeed("syscount -d 1"))
|
print(machine.succeed("syscount -d 1"))
|
||||||
|
|
||||||
## bpftrace
|
## bpftrace
|
||||||
# list probes
|
# list probes
|
||||||
machine.succeed("bpftrace -l")
|
machine.succeed("bpftrace -l")
|
||||||
# simple BEGIN probe (user probe on bpftrace itself)
|
# simple BEGIN probe (user probe on bpftrace itself)
|
||||||
print(machine.succeed("bpftrace -e 'BEGIN { print(\"ok\\n\"); exit(); }'"))
|
print(machine.succeed("bpftrace -e 'BEGIN { print(\"ok\\n\"); exit(); }'"))
|
||||||
# tracepoint
|
# tracepoint
|
||||||
print(machine.succeed("bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit() }'"))
|
print(machine.succeed("bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit() }'"))
|
||||||
# kprobe
|
# kprobe
|
||||||
print(machine.succeed("bpftrace -e 'kprobe:schedule { print(probe); exit() }'"))
|
print(machine.succeed("bpftrace -e 'kprobe:schedule { print(probe); exit() }'"))
|
||||||
# BTF
|
# BTF
|
||||||
print(machine.succeed("bpftrace -e 'kprobe:schedule { "
|
print(machine.succeed("bpftrace -e 'kprobe:schedule { "
|
||||||
" printf(\"tgid: %d\\n\", ((struct task_struct*) curtask)->tgid); exit() "
|
" printf(\"tgid: %d\\n\", ((struct task_struct*) curtask)->tgid); exit() "
|
||||||
"}'"))
|
"}'"))
|
||||||
# module BTF (bpftrace >= 0.17)
|
# module BTF (bpftrace >= 0.17)
|
||||||
# test is currently disabled on aarch64 as kfunc does not work there yet
|
# test is currently disabled on aarch64 as kfunc does not work there yet
|
||||||
# https://github.com/iovisor/bpftrace/issues/2496
|
# https://github.com/iovisor/bpftrace/issues/2496
|
||||||
print(machine.succeed("uname -m | grep aarch64 || "
|
print(machine.succeed("uname -m | grep aarch64 || "
|
||||||
"bpftrace -e 'kfunc:nft_trans_alloc_gfp { "
|
"bpftrace -e 'kfunc:nft_trans_alloc_gfp { "
|
||||||
" printf(\"portid: %d\\n\", args->ctx->portid); "
|
" printf(\"portid: %d\\n\", args->ctx->portid); "
|
||||||
"} BEGIN { exit() }'"))
|
"} BEGIN { exit() }'"))
|
||||||
# glibc includes
|
# glibc includes
|
||||||
print(machine.succeed("bpftrace -e '#include <errno.h>\n"
|
print(machine.succeed("bpftrace -e '#include <errno.h>\n"
|
||||||
"BEGIN { printf(\"ok %d\\n\", EINVAL); exit(); }'"))
|
"BEGIN { printf(\"ok %d\\n\", EINVAL); exit(); }'"))
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user