Skip to contentSkip to conversation

test/event_eth_tx_adapter: skip tests if no eventdev

PATCH Superseded Bruce Richardson 3 participants 5 messages Jul 21 – Sep 15

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/event_eth_tx_adapter: skip tests if no eventdev

If there is no eventdev present, and the SW eventdev driver is not available, skip the eth tx adapter tests, rather than failing on event creation.

Note: We keep the failure case where we do have the event/sw driver built, but fail to create an instance of it.

---
 app/test/test_event_eth_tx_adapter.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
app/test/test_event_eth_tx_adapter.c +8 -2
index bec298a8b8..18801028ce 100644
@@ -202,12 +202,13 @@ deinit_ports(void)
 static int
 testsuite_setup(void)
 {
-	const char *vdev_name = "event_sw0";
-
 	int err = init_ports();
 	TEST_ASSERT(err == 0, "Port initialization failed err %d\n", err);
 
+#ifdef RTE_EVENT_SW
 	if (rte_event_dev_count() == 0) {
+		const char *vdev_name = "event_sw0";
+
 		printf("Failed to find a valid event device,"
 			" testing with event_sw0 device\n");
 		err = rte_vdev_init(vdev_name, NULL);
@@ -215,6 +216,11 @@ testsuite_setup(void)
 			vdev_name, err);
 		event_dev_delete = 1;
 	}
+#endif
+	if (rte_event_dev_count() == 0) {
+		printf("Failed to find a valid event device, skipping test\n");
+		return TEST_SKIPPED;
+	}
 	return err;
 }
 
Signature · 1 line
2.53.0
#1 lore raw
Quoted 34 lines · Bruce Richardson

If there is no eventdev present, and the SW eventdev driver is not available, skip the eth tx adapter tests, rather than failing on event creation.

Note: We keep the failure case where we do have the event/sw driver built, but fail to create an instance of it.

---
 app/test/test_event_eth_tx_adapter.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
app/test/test_event_eth_tx_adapter.c +3 -2
index bec298a8b8..18801028ce 100644
@@ -202,12 +202,13 @@ deinit_ports(void)
 static int
 testsuite_setup(void)
 {
-       const char *vdev_name = "event_sw0";
-
        int err = init_ports();
        TEST_ASSERT(err == 0, "Port initialization failed err %d\n", err);
 
+#ifdef RTE_EVENT_SW
        if (rte_event_dev_count() == 0) {
+               const char *vdev_name = "event_sw0";
+
                printf("Failed to find a valid event device,"
                        " testing with event_sw0 device\n");
                err = rte_vdev_init(vdev_name, NULL);

app/test/test_event_eth_tx_adapter.c testsuite_setup(void) · line 223

Quoted 8 lines
app/test/test_event_eth_tx_adapter.c +5 -0
@@ -215,6 +216,11 @@ testsuite_setup(void)
                        vdev_name, err);
                event_dev_delete = 1;
        }
+#endif
+       if (rte_event_dev_count() == 0) {
+               printf("Failed to find a valid event device, skipping test\n");
+               return TEST_SKIPPED;
+       }

It seems strange to reevaluate this part here.

rte_vdev_init succeeded but we still have no eventdev object? That should be a failure to me.

Signature · 1 line
David Marchand
#2 lore raw
Quoted 47 lines · David Marchand
Quoted 34 lines · Bruce Richardson

If there is no eventdev present, and the SW eventdev driver is not available, skip the eth tx adapter tests, rather than failing on event creation.

Note: We keep the failure case where we do have the event/sw driver built, but fail to create an instance of it.

---
 app/test/test_event_eth_tx_adapter.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
app/test/test_event_eth_tx_adapter.c +3 -2
index bec298a8b8..18801028ce 100644
@@ -202,12 +202,13 @@ deinit_ports(void)
 static int
 testsuite_setup(void)
 {
-       const char *vdev_name = "event_sw0";
-
        int err = init_ports();
        TEST_ASSERT(err == 0, "Port initialization failed err %d\n", err);
 
+#ifdef RTE_EVENT_SW
        if (rte_event_dev_count() == 0) {
+               const char *vdev_name = "event_sw0";
+
                printf("Failed to find a valid event device,"
                        " testing with event_sw0 device\n");
                err = rte_vdev_init(vdev_name, NULL);

app/test/test_event_eth_tx_adapter.c testsuite_setup(void) · line 223

Quoted 8 lines
app/test/test_event_eth_tx_adapter.c +5 -0
@@ -215,6 +216,11 @@ testsuite_setup(void)
                        vdev_name, err);
                event_dev_delete = 1;
        }
+#endif
+       if (rte_event_dev_count() == 0) {
+               printf("Failed to find a valid event device, skipping test\n");
+               return TEST_SKIPPED;
+       }

It seems strange to reevaluate this part here.

Quoted 3 lines

rte_vdev_init succeeded but we still have no eventdev object? That should be a failure to me.

This is meant to catch the case where we don't have RTE_EVENT_SW. However, I can rework the change to avoid checking twice in the case we do have it.

/Bruce

#3 lore raw

PATCH v2 1/1 test/event_eth_tx_adapter: skip tests if no eventdev

In reply to Bruce Richardson

If there is no eventdev present, and the SW eventdev driver is not available, skip the eth tx adapter tests, rather than failing on event creation.

Note: We keep the failure case where we do have the event/sw driver built, but fail to create an instance of it.

---
 app/test/test_event_eth_tx_adapter.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
app/test/test_event_eth_tx_adapter.c +7 -2
index bec298a8b8..0c161897ce 100644
@@ -202,18 +202,23 @@ deinit_ports(void)
 static int
 testsuite_setup(void)
 {
-	const char *vdev_name = "event_sw0";
-
 	int err = init_ports();
 	TEST_ASSERT(err == 0, "Port initialization failed err %d\n", err);
 
 	if (rte_event_dev_count() == 0) {
+#ifdef RTE_EVENT_SW
+		const char *vdev_name = "event_sw0";
+
 		printf("Failed to find a valid event device,"
 			" testing with event_sw0 device\n");
 		err = rte_vdev_init(vdev_name, NULL);
 		TEST_ASSERT(err == 0, "vdev %s creation failed  %d\n",
 			vdev_name, err);
 		event_dev_delete = 1;
+#else
+		printf("Failed to find a valid event device, skipping test\n");
+		return TEST_SKIPPED;
+#endif
 	}
 	return err;
 }
Signature · 1 line
2.53.0
Applied
#4 lore raw
Quoted 9 lines · Bruce Richardson

If there is no eventdev present, and the SW eventdev driver is not available, skip the eth tx adapter tests, rather than failing on event creation.

Note: We keep the failure case where we do have the event/sw driver built, but fail to create an instance of it.

Applied to dpdk-next-eventdev/for-main. Thanks

Quoted 37 lines
---
 app/test/test_event_eth_tx_adapter.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
app/test/test_event_eth_tx_adapter.c +7 -3
index bec298a8b8..0c161897ce 100644
@@ -202,18 +202,23 @@ deinit_ports(void)
 static int
 testsuite_setup(void)
 {
-       const char *vdev_name = "event_sw0";
-
        int err = init_ports();
        TEST_ASSERT(err == 0, "Port initialization failed err %d\n", err);
 
        if (rte_event_dev_count() == 0) {
+#ifdef RTE_EVENT_SW
+               const char *vdev_name = "event_sw0";
+
                printf("Failed to find a valid event device,"
                        " testing with event_sw0 device\n");
                err = rte_vdev_init(vdev_name, NULL);
                TEST_ASSERT(err == 0, "vdev %s creation failed  %d\n",
                        vdev_name, err);
                event_dev_delete = 1;
+#else
+               printf("Failed to find a valid event device, skipping test\n");
+               return TEST_SKIPPED;
+#endif
        }
        return err;
 }
--

2.53.0