[PATCH v5 3/5] bpf: add a test for BPF ELF load
Stephen Hemminger
stephen at networkplumber.org
Mon Nov 10 18:07:30 CET 2025
On Mon, 10 Nov 2025 16:38:08 +0000
Marat Khalili <marat.khalili at huawei.com> wrote:
> > +xxd = find_program('xxd', required: false)
> > +if not xxd.found()
> > + message('app/test_bpf: missing xxd required to convert object to array')
> > + subdir_done()
> > +endif
> > +
> > +# BPF compiler flags
> > +bpf_cflags = [ '-O2', '-target', 'bpf', '-g', '-c']
> > +
> > +# Enable test in test_bpf.c
> > +cflags += '-DTEST_BPF_ELF_LOAD'
>
> Sorry for not noticing it earlier, we probably want these tests depend on
> RTE_LIBRTE_BPF_ELF, otherwise they fail when libelf is not installed.
I tested without elf and it build ok.
> // snip
>
> > +static int
> > +test_bpf_elf_load(void)
> > +{
> > + static const char test_section[] = "call1";
> > + uint8_t tbuf[sizeof(struct dummy_vect8)];
>
> I still think alignment may become an issue here.
On x86 alignment doesn't matter. But would be better to use
a union to be safe.
More information about the dev
mailing list