test: enable rawdev skeleton test
authorShreyansh Jain <shreyansh.jain@nxp.com>
Wed, 31 Jan 2018 09:13:17 +0000 (14:43 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 31 Jan 2018 14:38:03 +0000 (15:38 +0100)
Skeleton rawdevice test cases are part of driver layer. This patch
allows test cases to be executed using 'rawdev_autotest' command
in test framework.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
MAINTAINERS
test/test/Makefile
test/test/test_rawdev.c [new file with mode: 0644]

index 4654d22..9beb302 100644 (file)
@@ -320,6 +320,7 @@ M: Shreyansh Jain <shreyansh.jain@nxp.com>
 M: Hemant Agrawal <hemant.agrawal@nxp.com>
 F: lib/librte_rawdev/
 F: drivers/raw/skeleton_rawdev/
+F: test/test/test_rawdev.c
 
 
 Bus Drivers
index cb3884a..a88cc38 100644 (file)
@@ -187,6 +187,10 @@ SRCS-y += test_event_ring.c
 SRCS-y += test_event_eth_rx_adapter.c
 endif
 
+ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y)
+SRCS-y += test_rawdev.c
+endif
+
 SRCS-$(CONFIG_RTE_LIBRTE_KVARGS) += test_kvargs.c
 
 CFLAGS += -DALLOW_EXPERIMENTAL_API
diff --git a/test/test/test_rawdev.c b/test/test/test_rawdev.c
new file mode 100644 (file)
index 0000000..043a38a
--- /dev/null
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2017 NXP
+ */
+#include <rte_common.h>
+#include <rte_mbuf.h>
+#include <rte_malloc.h>
+#include <rte_memcpy.h>
+#include <rte_dev.h>
+#include <rte_rawdev.h>
+#include <rte_bus_vdev.h>
+
+#include "test.h"
+
+static int
+test_rawdev_selftest_impl(const char *pmd, const char *opts)
+{
+       rte_vdev_init(pmd, opts);
+       return rte_rawdev_selftest(rte_rawdev_get_dev_id(pmd));
+}
+
+static int
+test_rawdev_selftest_skeleton(void)
+{
+       return test_rawdev_selftest_impl("rawdev_skeleton", "");
+}
+
+REGISTER_TEST_COMMAND(rawdev_autotest, test_rawdev_selftest_skeleton);