From 55ae8965bf8eecd5ebec36663bb0f36018abf64b Mon Sep 17 00:00:00 2001 From: Tyler Retzlaff Date: Tue, 22 Mar 2022 00:12:35 -0700 Subject: [PATCH] test/bpf: skip test if libpcap is unavailable test_bpf_convert is being conditionally registered depending on the presence of RTE_HAS_LIBPCAP except the UT unconditionally lists it as a test to run. When the UT runs test_bpf_convert test-dpdk can't find the registration and assumes the DPDK_TEST environment variable hasn't been defined resulting in test-dpdk dropping to interactive mode and subsequently waiting for the remainder of the UT fast-test timeout period before reporting the test as having timed out. * unconditionally register test_bpf_convert, * if ! RTE_HAS_LIBPCAP provide a stub test_bpf_convert that reports the test is skipped similar to that done with the test_bpf test. Fixes: 2eccf6afbea9 ("bpf: add function to convert classic BPF to DPDK BPF") Cc: stable@dpdk.org Signed-off-by: Tyler Retzlaff Acked-by: Stephen Hemminger Acked-by: Konstantin Ananyev --- app/test/test_bpf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c index 805cce6406..97f500809e 100644 --- a/app/test/test_bpf.c +++ b/app/test/test_bpf.c @@ -3264,7 +3264,16 @@ test_bpf(void) REGISTER_TEST_COMMAND(bpf_autotest, test_bpf); -#ifdef RTE_HAS_LIBPCAP +#ifndef RTE_HAS_LIBPCAP + +static int +test_bpf_convert(void) +{ + printf("BPF convert RTE_HAS_LIBPCAP is undefined, skipping test\n"); + return TEST_SKIPPED; +} + +#else #include static void @@ -3462,5 +3471,6 @@ test_bpf_convert(void) return rc; } -REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert); #endif /* RTE_HAS_LIBPCAP */ + +REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert); -- 2.20.1