Files
linux/tools/testing/selftests/bpf/bpftool_helpers.h
Alexis Lothoré (eBPF Foundation) f21fae5774 selftests/bpf: Add a few helpers for bpftool testing
In order to integrate some bpftool tests into test_progs, define a few
specific helpers that allow to execute bpftool commands, while possibly
retrieving the command output. Those helpers most notably set the
path to the bpftool binary under test. This version checks different
possible paths relative to the directories where the different
test_progs runners are executed, as we want to make sure not to
accidentally use a bootstrap version of the binary.

Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20260123-bpftool-tests-v4-1-a6653a7f28e7@bootlin.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-01-26 18:47:21 -08:00

12 lines
276 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#pragma once
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#define MAX_BPFTOOL_CMD_LEN (256)
int run_bpftool_command(char *args);
int get_bpftool_command_output(char *args, char *output_buf, size_t output_max_len);