[dpdk-dev,22/39] app/test: octeontx eventdev unit test infrastructure
Checks
Commit Message
add test setup and teardown routines.
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
app/test/Makefile | 5 +-
app/test/test_eventdev_octeontx.c | 98 +++++++++++++++++++++++++++++++++++++++
2 files changed, 102 insertions(+), 1 deletion(-)
create mode 100644 app/test/test_eventdev_octeontx.c
Comments
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Friday, March 3, 2017 5:28 PM
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren,
> Harry <harry.van.haaren@intel.com>; hemant.agrawal@nxp.com; Eads, Gage <gage.eads@intel.com>;
> nipun.gupta@nxp.com; santosh.shukla@caviumnetworks.com; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH 22/39] app/test: octeontx eventdev unit test infrastructure
>
> add test setup and teardown routines.
>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
1) I think the autotest_data.py file needs to be updated to run the test command too, event/sw example at top of patch
http://dpdk.org/dev/patchwork/patch/21694/
2) This requires a rebase against latest head, app/test has moved to test/test/.
I will ignore this app/test to test/test move for the remaining patches of the series.
With fixes above,
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
> ---
> app/test/Makefile | 5 +-
> app/test/test_eventdev_octeontx.c | 98 +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 102 insertions(+), 1 deletion(-)
> create mode 100644 app/test/test_eventdev_octeontx.c
>
> diff --git a/app/test/Makefile b/app/test/Makefile
> index a426548..b45a1d3 100644
> --- a/app/test/Makefile
> +++ b/app/test/Makefile
> @@ -197,7 +197,10 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c
> SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c
> SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
>
> -SRCS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += test_eventdev.c
> +ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y)
> +SRCS-y += test_eventdev.c
> +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c
> +endif
>
> SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
>
> diff --git a/app/test/test_eventdev_octeontx.c b/app/test/test_eventdev_octeontx.c
> new file mode 100644
> index 0000000..9744961
> --- /dev/null
> +++ b/app/test/test_eventdev_octeontx.c
> @@ -0,0 +1,98 @@
> +/*-
> + * BSD LICENSE
> + *
> + * Copyright(c) 2017 Cavium networks. All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *
> + * * Redistributions of source code must retain the above copyright
> + * notice, this list of conditions and the following disclaimer.
> + * * Redistributions in binary form must reproduce the above copyright
> + * notice, this list of conditions and the following disclaimer in
> + * the documentation and/or other materials provided with the
> + * distribution.
> + * * Neither the name of Cavium networks nor the names of its
> + * contributors may be used to endorse or promote products derived
> + * from this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#include <rte_atomic.h>
> +#include <rte_common.h>
> +#include <rte_cycles.h>
> +#include <rte_debug.h>
> +#include <rte_eal.h>
> +#include <rte_ethdev.h>
> +#include <rte_eventdev.h>
> +#include <rte_hexdump.h>
> +#include <rte_mbuf.h>
> +#include <rte_malloc.h>
> +#include <rte_memcpy.h>
> +#include <rte_launch.h>
> +#include <rte_lcore.h>
> +#include <rte_per_lcore.h>
> +#include <rte_random.h>
> +
> +#include "test.h"
> +
> +#define NUM_PACKETS (1 << 18)
> +#define MAX_EVENTS (16 * 1024)
> +
> +static int evdev;
> +
> +static int
> +testsuite_setup(void)
> +{
> + const char *eventdev_name = "event_octeontx";
> +
> + evdev = rte_event_dev_get_dev_id(eventdev_name);
> + if (evdev < 0) {
> + printf("%d: Eventdev %s not found - creating.\n",
> + __LINE__, eventdev_name);
> + if (rte_eal_vdev_init(eventdev_name, NULL) < 0) {
> + printf("Error creating eventdev\n");
> + return TEST_FAILED;
> + }
> + evdev = rte_event_dev_get_dev_id(eventdev_name);
> + if (evdev < 0) {
> + printf("Error finding newly created eventdev\n");
> + return TEST_FAILED;
> + }
> + }
> +
> + return TEST_SUCCESS;
> +}
> +
> +static void
> +testsuite_teardown(void)
> +{
> + rte_event_dev_close(evdev);
> +}
> +
> +
> +static struct unit_test_suite eventdev_octeontx_testsuite = {
> + .suite_name = "eventdev octeontx unit test suite",
> + .setup = testsuite_setup,
> + .teardown = testsuite_teardown,
> +};
> +
> +static int
> +test_eventdev_octeontx(void)
> +{
> + return unit_test_suite_runner(&eventdev_octeontx_testsuite);
> +}
> +
> +REGISTER_TEST_COMMAND(eventdev_octeontx_autotest, test_eventdev_octeontx);
> --
> 2.5.5
On Thu, Mar 23, 2017 at 11:55:27AM +0000, Van Haaren, Harry wrote:
> > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> > Sent: Friday, March 3, 2017 5:28 PM
> > To: dev@dpdk.org
> > Cc: thomas.monjalon@6wind.com; Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren,
> > Harry <harry.van.haaren@intel.com>; hemant.agrawal@nxp.com; Eads, Gage <gage.eads@intel.com>;
> > nipun.gupta@nxp.com; santosh.shukla@caviumnetworks.com; Jerin Jacob
> > <jerin.jacob@caviumnetworks.com>
> > Subject: [dpdk-dev] [PATCH 22/39] app/test: octeontx eventdev unit test infrastructure
> >
> > add test setup and teardown routines.
> >
> > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
>
Hi Harry,
Thanks for the review.
> 1) I think the autotest_data.py file needs to be updated to run the test command too, event/sw example at top of patch
> http://dpdk.org/dev/patchwork/patch/21694/
Unlike event/sw, Since this test case has the dependency on specific HW. I
prefer to not add to common autotest_data.py.
>
> 2) This requires a rebase against latest head, app/test has moved to test/test/.
> I will ignore this app/test to test/test move for the remaining patches of the series.
Will fix it v2
>
> With fixes above,
>
> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
>
>
> > ---
> > app/test/Makefile | 5 +-
> > app/test/test_eventdev_octeontx.c | 98 +++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 102 insertions(+), 1 deletion(-)
> > create mode 100644 app/test/test_eventdev_octeontx.c
> >
> > diff --git a/app/test/Makefile b/app/test/Makefile
> > index a426548..b45a1d3 100644
> > --- a/app/test/Makefile
> > +++ b/app/test/Makefile
> > @@ -197,7 +197,10 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c
> > SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c
> > SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
> >
> > -SRCS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += test_eventdev.c
> > +ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y)
> > +SRCS-y += test_eventdev.c
> > +SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c
> > +endif
> >
> > SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
> >
> > diff --git a/app/test/test_eventdev_octeontx.c b/app/test/test_eventdev_octeontx.c
> > new file mode 100644
> > index 0000000..9744961
> > --- /dev/null
> > +++ b/app/test/test_eventdev_octeontx.c
> > @@ -0,0 +1,98 @@
> > +/*-
> > + * BSD LICENSE
> > + *
> > + * Copyright(c) 2017 Cavium networks. All rights reserved.
> > + *
> > + * Redistribution and use in source and binary forms, with or without
> > + * modification, are permitted provided that the following conditions
> > + * are met:
> > + *
> > + * * Redistributions of source code must retain the above copyright
> > + * notice, this list of conditions and the following disclaimer.
> > + * * Redistributions in binary form must reproduce the above copyright
> > + * notice, this list of conditions and the following disclaimer in
> > + * the documentation and/or other materials provided with the
> > + * distribution.
> > + * * Neither the name of Cavium networks nor the names of its
> > + * contributors may be used to endorse or promote products derived
> > + * from this software without specific prior written permission.
> > + *
> > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> > + */
> > +
> > +#include <rte_atomic.h>
> > +#include <rte_common.h>
> > +#include <rte_cycles.h>
> > +#include <rte_debug.h>
> > +#include <rte_eal.h>
> > +#include <rte_ethdev.h>
> > +#include <rte_eventdev.h>
> > +#include <rte_hexdump.h>
> > +#include <rte_mbuf.h>
> > +#include <rte_malloc.h>
> > +#include <rte_memcpy.h>
> > +#include <rte_launch.h>
> > +#include <rte_lcore.h>
> > +#include <rte_per_lcore.h>
> > +#include <rte_random.h>
> > +
> > +#include "test.h"
> > +
> > +#define NUM_PACKETS (1 << 18)
> > +#define MAX_EVENTS (16 * 1024)
> > +
> > +static int evdev;
> > +
> > +static int
> > +testsuite_setup(void)
> > +{
> > + const char *eventdev_name = "event_octeontx";
> > +
> > + evdev = rte_event_dev_get_dev_id(eventdev_name);
> > + if (evdev < 0) {
> > + printf("%d: Eventdev %s not found - creating.\n",
> > + __LINE__, eventdev_name);
> > + if (rte_eal_vdev_init(eventdev_name, NULL) < 0) {
> > + printf("Error creating eventdev\n");
> > + return TEST_FAILED;
> > + }
> > + evdev = rte_event_dev_get_dev_id(eventdev_name);
> > + if (evdev < 0) {
> > + printf("Error finding newly created eventdev\n");
> > + return TEST_FAILED;
> > + }
> > + }
> > +
> > + return TEST_SUCCESS;
> > +}
> > +
> > +static void
> > +testsuite_teardown(void)
> > +{
> > + rte_event_dev_close(evdev);
> > +}
> > +
> > +
> > +static struct unit_test_suite eventdev_octeontx_testsuite = {
> > + .suite_name = "eventdev octeontx unit test suite",
> > + .setup = testsuite_setup,
> > + .teardown = testsuite_teardown,
> > +};
> > +
> > +static int
> > +test_eventdev_octeontx(void)
> > +{
> > + return unit_test_suite_runner(&eventdev_octeontx_testsuite);
> > +}
> > +
> > +REGISTER_TEST_COMMAND(eventdev_octeontx_autotest, test_eventdev_octeontx);
> > --
> > 2.5.5
>
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Friday, March 24, 2017 1:41 PM
> Subject: Re: [dpdk-dev] [PATCH 22/39] app/test: octeontx eventdev unit test infrastructure
>
> On Thu, Mar 23, 2017 at 11:55:27AM +0000, Van Haaren, Harry wrote:
<snip>
> > > Subject: [dpdk-dev] [PATCH 22/39] app/test: octeontx eventdev unit test infrastructure
> > >
> > > add test setup and teardown routines.
> > >
> > > Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> >
>
> Hi Harry,
>
> Thanks for the review.
>
> > 1) I think the autotest_data.py file needs to be updated to run the test command too,
> event/sw example at top of patch
> > http://dpdk.org/dev/patchwork/patch/21694/
>
> Unlike event/sw, Since this test case has the dependency on specific HW. I
> prefer to not add to common autotest_data.py.
Ah yes - good point - Ack-ed again for clarity.
> > 2) This requires a rebase against latest head, app/test has moved to test/test/.
> > I will ignore this app/test to test/test move for the remaining patches of the series.
>
> Will fix it v2
Perfect.
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
@@ -197,7 +197,10 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c
SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c
SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
-SRCS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += test_eventdev.c
+ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y)
+SRCS-y += test_eventdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += test_eventdev_octeontx.c
+endif
SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
new file mode 100644
@@ -0,0 +1,98 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright(c) 2017 Cavium networks. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Cavium networks nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <rte_atomic.h>
+#include <rte_common.h>
+#include <rte_cycles.h>
+#include <rte_debug.h>
+#include <rte_eal.h>
+#include <rte_ethdev.h>
+#include <rte_eventdev.h>
+#include <rte_hexdump.h>
+#include <rte_mbuf.h>
+#include <rte_malloc.h>
+#include <rte_memcpy.h>
+#include <rte_launch.h>
+#include <rte_lcore.h>
+#include <rte_per_lcore.h>
+#include <rte_random.h>
+
+#include "test.h"
+
+#define NUM_PACKETS (1 << 18)
+#define MAX_EVENTS (16 * 1024)
+
+static int evdev;
+
+static int
+testsuite_setup(void)
+{
+ const char *eventdev_name = "event_octeontx";
+
+ evdev = rte_event_dev_get_dev_id(eventdev_name);
+ if (evdev < 0) {
+ printf("%d: Eventdev %s not found - creating.\n",
+ __LINE__, eventdev_name);
+ if (rte_eal_vdev_init(eventdev_name, NULL) < 0) {
+ printf("Error creating eventdev\n");
+ return TEST_FAILED;
+ }
+ evdev = rte_event_dev_get_dev_id(eventdev_name);
+ if (evdev < 0) {
+ printf("Error finding newly created eventdev\n");
+ return TEST_FAILED;
+ }
+ }
+
+ return TEST_SUCCESS;
+}
+
+static void
+testsuite_teardown(void)
+{
+ rte_event_dev_close(evdev);
+}
+
+
+static struct unit_test_suite eventdev_octeontx_testsuite = {
+ .suite_name = "eventdev octeontx unit test suite",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+};
+
+static int
+test_eventdev_octeontx(void)
+{
+ return unit_test_suite_runner(&eventdev_octeontx_testsuite);
+}
+
+REGISTER_TEST_COMMAND(eventdev_octeontx_autotest, test_eventdev_octeontx);