mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-20 12:43:52 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
45 lines
1.6 KiB
Nix
45 lines
1.6 KiB
Nix
import ./make-test-python.nix (
|
|
{ pkgs, ... }:
|
|
{
|
|
name = "bpf";
|
|
meta.maintainers = with pkgs.lib.maintainers; [ martinetd ];
|
|
|
|
nodes.machine =
|
|
{ pkgs, ... }:
|
|
{
|
|
programs.bcc.enable = true;
|
|
environment.systemPackages = with pkgs; [ bpftrace ];
|
|
};
|
|
|
|
testScript = ''
|
|
## bcc
|
|
# syscount -d 1 stops 1s after probe started so is good for that
|
|
print(machine.succeed("syscount -d 1"))
|
|
|
|
## bpftrace
|
|
# list probes
|
|
machine.succeed("bpftrace -l")
|
|
# simple BEGIN probe (user probe on bpftrace itself)
|
|
print(machine.succeed("bpftrace -e 'BEGIN { print(\"ok\\n\"); exit(); }'"))
|
|
# tracepoint
|
|
print(machine.succeed("bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit() }'"))
|
|
# kprobe
|
|
print(machine.succeed("bpftrace -e 'kprobe:schedule { print(probe); exit() }'"))
|
|
# BTF
|
|
print(machine.succeed("bpftrace -e 'kprobe:schedule { "
|
|
" printf(\"tgid: %d\\n\", ((struct task_struct*) curtask)->tgid); exit() "
|
|
"}'"))
|
|
# module BTF (bpftrace >= 0.17)
|
|
# test is currently disabled on aarch64 as kfunc does not work there yet
|
|
# https://github.com/iovisor/bpftrace/issues/2496
|
|
print(machine.succeed("uname -m | grep aarch64 || "
|
|
"bpftrace -e 'kfunc:nft_trans_alloc_gfp { "
|
|
" printf(\"portid: %d\\n\", args->ctx->portid); "
|
|
"} BEGIN { exit() }'"))
|
|
# glibc includes
|
|
print(machine.succeed("bpftrace -e '#include <errno.h>\n"
|
|
"BEGIN { printf(\"ok %d\\n\", EINVAL); exit(); }'"))
|
|
'';
|
|
}
|
|
)
|