···
1
-
import ./make-test-python.nix (
5
-
meta.maintainers = with pkgs.lib.maintainers; [ martinetd ];
4
+
meta.maintainers = with lib.maintainers; [ martinetd ];
10
-
programs.bcc.enable = true;
11
-
environment.systemPackages = with pkgs; [ bpftrace ];
9
+
programs.bcc.enable = true;
10
+
environment.systemPackages = with pkgs; [ bpftrace ];
16
-
# syscount -d 1 stops 1s after probe started so is good for that
17
-
print(machine.succeed("syscount -d 1"))
15
+
# syscount -d 1 stops 1s after probe started so is good for that
16
+
print(machine.succeed("syscount -d 1"))
21
-
machine.succeed("bpftrace -l")
22
-
# simple BEGIN probe (user probe on bpftrace itself)
23
-
print(machine.succeed("bpftrace -e 'BEGIN { print(\"ok\\n\"); exit(); }'"))
25
-
print(machine.succeed("bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit() }'"))
27
-
print(machine.succeed("bpftrace -e 'kprobe:schedule { print(probe); exit() }'"))
29
-
print(machine.succeed("bpftrace -e 'kprobe:schedule { "
30
-
" printf(\"tgid: %d\\n\", ((struct task_struct*) curtask)->tgid); exit() "
32
-
# module BTF (bpftrace >= 0.17)
33
-
# test is currently disabled on aarch64 as kfunc does not work there yet
34
-
# https://github.com/iovisor/bpftrace/issues/2496
35
-
print(machine.succeed("uname -m | grep aarch64 || "
36
-
"bpftrace -e 'kfunc:nft_trans_alloc_gfp { "
37
-
" printf(\"portid: %d\\n\", args->ctx->portid); "
38
-
"} BEGIN { exit() }'"))
40
-
print(machine.succeed("bpftrace -e '#include <errno.h>\n"
41
-
"BEGIN { printf(\"ok %d\\n\", EINVAL); exit(); }'"))
20
+
machine.succeed("bpftrace -l")
21
+
# simple BEGIN probe (user probe on bpftrace itself)
22
+
print(machine.succeed("bpftrace -e 'BEGIN { print(\"ok\\n\"); exit(); }'"))
24
+
print(machine.succeed("bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit() }'"))
26
+
print(machine.succeed("bpftrace -e 'kprobe:schedule { print(probe); exit() }'"))
28
+
print(machine.succeed("bpftrace -e 'kprobe:schedule { "
29
+
" printf(\"tgid: %d\\n\", ((struct task_struct*) curtask)->tgid); exit() "
31
+
# module BTF (bpftrace >= 0.17)
32
+
# test is currently disabled on aarch64 as kfunc does not work there yet
33
+
# https://github.com/iovisor/bpftrace/issues/2496
34
+
print(machine.succeed("uname -m | grep aarch64 || "
35
+
"bpftrace -e 'kfunc:nft_trans_alloc_gfp { "
36
+
" printf(\"portid: %d\\n\", args->ctx->portid); "
37
+
"} BEGIN { exit() }'"))
39
+
print(machine.succeed("bpftrace -e '#include <errno.h>\n"
40
+
"BEGIN { printf(\"ok %d\\n\", EINVAL); exit(); }'"))