Skip to contentSkip to conversation

test/bpf: skip test if libpcap is unavailable

PATCH Superseded Tyler Retzlaff 4 participants 9 messages Mar 21, 2022 – Apr 26, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 app/test/test_bpf.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
app/test/test_bpf.c +12 -2
index 805cce6..de1fa87 100644
@@ -3264,7 +3264,16 @@ struct bpf_test {
 
 REGISTER_TEST_COMMAND(bpf_autotest, test_bpf);
 
-#ifdef RTE_HAS_LIBPCAP
+#ifndef RTE_HAS_LIBPCAP
+
+static int
+test_bpf_convert(void)
+{
+	printf("BPF not supported, skipping test\n");
+	return TEST_SKIPPED;
+}
+
+#else
 #include <pcap/pcap.h>
 
 static void
@@ -3462,5 +3471,6 @@ struct bpf_test {
 	return rc;
 }
 
-REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert);
 #endif /* RTE_HAS_LIBPCAP */
+
+REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert);
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 31 lines

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")
---
 app/test/test_bpf.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
app/test/test_bpf.c +0 -0
index 805cce6..de1fa87 100644

app/test/test_bpf.c struct bpf_test { · line 3272

Quoted 10 lines
app/test/test_bpf.c +6 -1
@@ -3264,7 +3264,16 @@ struct bpf_test {
 
 REGISTER_TEST_COMMAND(bpf_autotest, test_bpf);
 
-#ifdef RTE_HAS_LIBPCAP
+#ifndef RTE_HAS_LIBPCAP
+
+static int
+test_bpf_convert(void)
+{
+	printf("BPF not supported, skipping test\n");

One nit: the message above seems a bit misleading... Probably "LIBPCAP is not supported" or so? With that fixed:

Quoted 17 lines
app/test/test_bpf.c +6 -2
+	return TEST_SKIPPED;
+}
+
+#else
 #include <pcap/pcap.h>
 
 static void
@@ -3462,5 +3471,6 @@ struct bpf_test {
 	return rc;
 }
 
-REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert);
 #endif /* RTE_HAS_LIBPCAP */
+
+REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert);
--

1.8.3.1

Acked-by on v1 1/1
#3 lore raw
In reply to Tyler Retzlaff
Quoted 14 lines · On Mon, 21 Mar 2022 06:13:27 -0700 Tyler Retzlaff…

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.

Quoted 6 lines
Fixes 2eccf6afbea9 ("bpf: add function to convert classic BPF to DPDK BPF")

LGTM

#2 lore raw
In reply to Ananyev, Konstantin
Quoted 26 lines · Konstantin
Quoted 12 lines
---
 app/test/test_bpf.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
app/test/test_bpf.c +0 -0
index 805cce6..de1fa87 100644

app/test/test_bpf.c struct bpf_test { · line 3272

Quoted 10 lines
app/test/test_bpf.c +6 -1
@@ -3264,7 +3264,16 @@ struct bpf_test {
 
 REGISTER_TEST_COMMAND(bpf_autotest, test_bpf);
 
-#ifdef RTE_HAS_LIBPCAP
+#ifndef RTE_HAS_LIBPCAP
+
+static int
+test_bpf_convert(void)
+{
+	printf("BPF not supported, skipping test\n");

One nit: the message above seems a bit misleading... Probably "LIBPCAP is not supported" or so? With that fixed:

Quoted 1 line

yeah, i cut and paste the other skip function. i agree i'll tweak the message to talk about libpcap.

Quoted 19 lines
Quoted 19 lines
app/test/test_bpf.c +6 -2
+	return TEST_SKIPPED;
+}
+
+#else
 #include <pcap/pcap.h>
 
 static void
@@ -3462,5 +3471,6 @@ struct bpf_test {
 	return rc;
 }
 
-REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert);
 #endif /* RTE_HAS_LIBPCAP */
+
+REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert);
--

1.8.3.1

#4 lore raw

PATCH v2 1/1 test/bpf: skip test if libpcap is unavailable

In reply to Tyler Retzlaff

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")
---
 app/test/test_bpf.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
app/test/test_bpf.c +12 -2
index 805cce6..97f5008 100644
@@ -3264,7 +3264,16 @@ struct bpf_test {
 
 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 <pcap/pcap.h>
 
 static void
@@ -3462,5 +3471,6 @@ struct bpf_test {
 	return rc;
 }
 
-REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert);
 #endif /* RTE_HAS_LIBPCAP */
+
+REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert);
Signature · 1 line
1.8.3.1
Acked-by on v2 1/1
#5 lore raw
Quoted 47 lines

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")
---
 app/test/test_bpf.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
app/test/test_bpf.c +10 -1
index 805cce6..97f5008 100644
@@ -3264,7 +3264,16 @@ struct bpf_test {
 
 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 <pcap/pcap.h>
 
 static void

app/test/test_bpf.c struct bpf_test {

Quoted 8 lines
app/test/test_bpf.c +2 -2
@@ -3462,5 +3471,6 @@ struct bpf_test {
 	return rc;
 }
 
-REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert);
 #endif /* RTE_HAS_LIBPCAP */
+
+REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert);
--
Quoted 1 line

1.8.3.1

Acked-by Stephen Hemminger Acked-by Konstantin Ananyev on v2 1/1 Applied
#7 lore raw
In reply to Tyler Retzlaff
Quoted 11 lines · Tyler Retzlaff

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.

Quoted 8 lines

* 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")

Applied, thanks.

Signature · 1 line
David Marchand
#8 lore raw
Quoted 17 lines · David Marchand
Quoted 15 lines · Tyler Retzlaff

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.

Quoted 8 lines
Quoted 4 lines
Fixes 2eccf6afbea9 ("bpf: add function to convert classic BPF to DPDK BPF")

Applied, thanks.

thanks mate!

Quoted 4 lines
Signature · 2 lines
-- 
David Marchand