Some of the BPF tests require the net/null driver to be present, so skip
those tests if it's not found. If the early part of the tests fail,
return that failure - on if they succeed do we return skipped on the
missing dependency.

Signed-off-by: Bruce Richardson <[email protected]>
---
 app/test/test_bpf.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c
index a7d56f8d86..ae588acb16 100644
--- a/app/test/test_bpf.c
+++ b/app/test/test_bpf.c
@@ -3725,6 +3725,11 @@ test_bpf_elf_rx_load(void)
        return ret == 0 ? TEST_SUCCESS : TEST_FAILED;
 }
 
+#ifdef RTE_NET_NULL
+static const bool have_net_null = true;
+#else
+static const bool have_net_null;  /* statics default to false */
+#endif
 
 static int
 test_bpf_elf(void)
@@ -3732,6 +3737,10 @@ test_bpf_elf(void)
        int ret;
 
        ret = test_bpf_elf_load();
+       if (ret == TEST_SUCCESS && !have_net_null) {
+               printf("net_null driver not available, skipping remainder of 
BPF tests\n");
+               return TEST_SKIPPED;
+       }
        if (ret == TEST_SUCCESS)
                ret = test_bpf_elf_tx_load();
        if (ret == TEST_SUCCESS)
-- 
2.51.0

Reply via email to