[PATCH] test/bpf: skip the BPF ELF load tests if net null missing

Stephen Hemminger
2026-01-22T22:17:35Z

The BPF filtering tests need NULL PMD vdev to work.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/test_bpf.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c
index 0e969f9f13..78998c6194 100644
--- a/app/test/test_bpf.c
+++ b/app/test/test_bpf.c
@@ -3280,7 +3280,15 @@ test_bpf(void)

REGISTER_FAST_TEST(bpf_autotest, NOHUGE_OK, ASAN_OK, test_bpf);

-#ifdef TEST_BPF_ELF_LOAD
+/*
+ * The BPF elf load tests needs the BPF programs to be successfully
+ * compiled into generated file bpf_test.h. This means having
+ * clang with BPF target and xxd command to encode object.
+ *
+ * Test also needs the NULL PMD to be able to have something
+ * to insert filter onto.
+ */
+#if defined(RTE_NET_NULL) && defined(TEST_BPF_ELF_LOAD)

/*
* Helper function to write BPF object data to temporary file.
@@ -3746,11 +3754,11 @@ test_bpf_elf(void)
static int
test_bpf_elf(void)
{
- printf("BPF compile not supported, skipping test\n");
+ printf("BPF compile or NULL PMD not supported, skipping test\n");
return TEST_SKIPPED;
}

-#endif /* !TEST_BPF_ELF_LOAD */
+#endif /* !(TEST_BPF_ELF_LOAD && RTE_NULL) */

REGISTER_FAST_TEST(bpf_elf_autotest, NOHUGE_OK, ASAN_OK, test_bpf_elf);

--
2.51.0