get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/85495/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 85495,
    "url": "https://patches.dpdk.org/api/patches/85495/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20201219062806.56477-8-chenbo.xia@intel.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20201219062806.56477-8-chenbo.xia@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20201219062806.56477-8-chenbo.xia@intel.com",
    "date": "2020-12-19T06:28:05",
    "name": "[v2,7/8] test/emudev: introduce functional test",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "faea0e707bc353736e01e5a6510a3472f7761d9f",
    "submitter": {
        "id": 1276,
        "url": "https://patches.dpdk.org/api/people/1276/?format=api",
        "name": "Chenbo Xia",
        "email": "chenbo.xia@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20201219062806.56477-8-chenbo.xia@intel.com/mbox/",
    "series": [
        {
            "id": 14383,
            "url": "https://patches.dpdk.org/api/series/14383/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=14383",
            "date": "2020-12-19T06:27:58",
            "name": "Introduce emudev library and iavf emudev driver",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/14383/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/85495/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/85495/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 35889A04B5;\n\tSat, 19 Dec 2020 07:45:41 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 09846CBDC;\n\tSat, 19 Dec 2020 07:43:35 +0100 (CET)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by dpdk.org (Postfix) with ESMTP id 55B8ACBA9\n for <dev@dpdk.org>; Sat, 19 Dec 2020 07:43:33 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 18 Dec 2020 22:43:32 -0800",
            "from npg-dpdk-virtio-xiachenbo-nw.sh.intel.com ([10.67.119.123])\n by fmsmga001.fm.intel.com with ESMTP; 18 Dec 2020 22:43:30 -0800"
        ],
        "IronPort-SDR": [
            "\n 18fBoKVNLtJ1F5VogLh54X232Y6nEMyAeTRLPI5qwO7+OixaXB31PglGQu2S3ODGlivfWE2iR5\n 6jbHdZypJmeg==",
            "\n jgG0HKoa+xYrWlG3ug/0XhFjjo1EkZvqGWjav+79Bso1puTGTWqxDtkp4Ex/X4MSDw51tK+Rg/\n 3hHkAcXu8oxg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9839\"; a=\"163285200\"",
            "E=Sophos;i=\"5.78,432,1599548400\"; d=\"scan'208\";a=\"163285200\"",
            "E=Sophos;i=\"5.78,432,1599548400\"; d=\"scan'208\";a=\"454449638\""
        ],
        "X-ExtLoop1": "1",
        "From": "Chenbo Xia <chenbo.xia@intel.com>",
        "To": "dev@dpdk.org,\n\tthomas@monjalon.net,\n\tdavid.marchand@redhat.com",
        "Cc": "stephen@networkplumber.org, cunming.liang@intel.com, xiuchun.lu@intel.com,\n miao.li@intel.com, jingjing.wu@intel.com",
        "Date": "Sat, 19 Dec 2020 14:28:05 +0800",
        "Message-Id": "<20201219062806.56477-8-chenbo.xia@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20201219062806.56477-1-chenbo.xia@intel.com>",
        "References": "<20201218074736.93999-1-chenbo.xia@intel.com>\n <20201219062806.56477-1-chenbo.xia@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 7/8] test/emudev: introduce functional test",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch introduces functional test for emudev. The\nimplementation of iavf emudev selftest is also added.\n\nSigned-off-by: Miao Li <miao.li@intel.com>\nSigned-off-by: Chenbo Xia <chenbo.xia@intel.com>\n---\n app/test/meson.build                 |   5 +-\n app/test/test_emudev.c               |  29 +++++\n drivers/emu/iavf/iavf_emu.c          |   1 +\n drivers/emu/iavf/iavf_emu_internal.h |   1 +\n drivers/emu/iavf/iavf_emu_test.c     | 174 +++++++++++++++++++++++++++\n drivers/emu/iavf/meson.build         |   2 +-\n 6 files changed, 210 insertions(+), 2 deletions(-)\n create mode 100644 app/test/test_emudev.c\n create mode 100644 drivers/emu/iavf/iavf_emu_test.c",
    "diff": "diff --git a/app/test/meson.build b/app/test/meson.build\nindex f5b15ac44c..b8b79bbc8b 100644\n--- a/app/test/meson.build\n+++ b/app/test/meson.build\n@@ -139,6 +139,7 @@ test_sources = files('commands.c',\n \t'test_trace_register.c',\n \t'test_trace_perf.c',\n \t'test_vfio_user.c',\n+\t'test_emudev.c',\n \t'test_version.c',\n \t'virtual_pmd.c'\n )\n@@ -176,7 +177,8 @@ test_deps = ['acl',\n \t'stack',\n \t'vfio_user',\n \t'telemetry',\n-\t'timer'\n+\t'timer',\n+\t'emudev'\n ]\n \n # Each test is marked with flag true/false\n@@ -327,6 +329,7 @@ driver_test_names = [\n         'eventdev_selftest_octeontx',\n         'eventdev_selftest_sw',\n         'rawdev_autotest',\n+        'emudev_autotest',\n ]\n \n dump_test_names = [\ndiff --git a/app/test/test_emudev.c b/app/test/test_emudev.c\nnew file mode 100644\nindex 0000000000..0dfce162ed\n--- /dev/null\n+++ b/app/test/test_emudev.c\n@@ -0,0 +1,29 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2020 Intel Corporation\n+ */\n+\n+#include <rte_emudev.h>\n+#include <rte_bus_vdev.h>\n+\n+#include \"test.h\"\n+\n+static int\n+test_emudev_selftest_impl(const char *pmd, const char *opts)\n+{\n+\tint ret = 0;\n+\n+\tif (rte_emudev_get_dev_id(pmd) == -ENODEV)\n+\t\tret = rte_vdev_init(pmd, opts);\n+\tif (ret)\n+\t\treturn TEST_SKIPPED;\n+\n+\treturn rte_emudev_selftest(rte_emudev_get_dev_id(pmd));\n+}\n+\n+static int\n+test_emudev_selftest(void)\n+{\n+\treturn test_emudev_selftest_impl(\"emu_iavf\", \"sock=/tmp/sock1\");\n+}\n+\n+REGISTER_TEST_COMMAND(emudev_autotest, test_emudev_selftest);\ndiff --git a/drivers/emu/iavf/iavf_emu.c b/drivers/emu/iavf/iavf_emu.c\nindex 9ad371ca98..88bf2bdf94 100644\n--- a/drivers/emu/iavf/iavf_emu.c\n+++ b/drivers/emu/iavf/iavf_emu.c\n@@ -246,4 +246,5 @@ struct rte_emudev_ops emu_iavf_ops = {\n \t.subscribe_event = iavf_emu_subs_ev,\n \t.unsubscribe_event = iavf_emu_unsubs_ev,\n \t.get_attr = iavf_emu_get_attr,\n+\t.dev_selftest = iavf_emu_selftest,\n };\ndiff --git a/drivers/emu/iavf/iavf_emu_internal.h b/drivers/emu/iavf/iavf_emu_internal.h\nindex 10197c00ba..1ac7f96566 100644\n--- a/drivers/emu/iavf/iavf_emu_internal.h\n+++ b/drivers/emu/iavf/iavf_emu_internal.h\n@@ -65,4 +65,5 @@ struct iavf_emudev {\n };\n \n void iavf_emu_uninit_device(struct iavf_emudev *dev);\n+int iavf_emu_selftest(uint16_t dev_id);\n #endif\ndiff --git a/drivers/emu/iavf/iavf_emu_test.c b/drivers/emu/iavf/iavf_emu_test.c\nnew file mode 100644\nindex 0000000000..ad19134724\n--- /dev/null\n+++ b/drivers/emu/iavf/iavf_emu_test.c\n@@ -0,0 +1,174 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2020 Intel Corporation\n+ */\n+\n+#include <inttypes.h>\n+\n+#include <rte_common.h>\n+#include <rte_malloc.h>\n+#include <rte_memcpy.h>\n+#include <rte_dev.h>\n+#include <rte_emudev.h>\n+#include <rte_bus_vdev.h>\n+#include <rte_test.h>\n+\n+#include \"iavf_emu_internal.h\"\n+\n+#define TEST_DEV_NAME \"emu_iavf\"\n+#define TEST_SUCCESS 0\n+#define TEST_FAILED -1\n+\n+#define EMUDEV_TEST_RUN(setup, teardown, test) \\\n+\temudev_test_run(setup, teardown, test, #test)\n+static uint16_t test_dev_id;\n+static int total;\n+static int passed;\n+static int failed;\n+static int unsupported;\n+\n+static int\n+testsuite_setup(void)\n+{\n+\tuint8_t count;\n+\tcount = rte_emudev_count();\n+\tif (!count) {\n+\t\tEMU_IAVF_LOG(INFO, \"No existing emu dev; \"\n+\t\t\t\t  \"Creating emu_iavf\\n\");\n+\t\treturn rte_vdev_init(TEST_DEV_NAME, NULL);\n+\t}\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static void\n+testsuite_teardown(void)\n+{\n+\trte_vdev_uninit(TEST_DEV_NAME);\n+}\n+\n+static void emudev_test_run(int (*setup)(void),\n+\t\t\t     void (*teardown)(void),\n+\t\t\t     int (*test)(void),\n+\t\t\t     const char *name)\n+{\n+\tint ret = 0;\n+\n+\tif (setup) {\n+\t\tret = setup();\n+\t\tif (ret < 0) {\n+\t\t\tEMU_IAVF_LOG(INFO, \"Error setting up test %s\\n\", name);\n+\t\t\tunsupported++;\n+\t\t}\n+\t}\n+\n+\tif (test) {\n+\t\tret = test();\n+\t\tif (ret < 0) {\n+\t\t\tfailed++;\n+\t\t\tEMU_IAVF_LOG(INFO, \"%s Failed\\n\", name);\n+\t\t} else {\n+\t\t\tpassed++;\n+\t\t\tEMU_IAVF_LOG(INFO, \"%s Passed\\n\", name);\n+\t\t}\n+\t}\n+\n+\tif (teardown)\n+\t\tteardown();\n+\n+\ttotal++;\n+}\n+\n+static int\n+test_emu_dev_count(void)\n+{\n+\tuint8_t count;\n+\tcount = rte_emudev_count();\n+\tRTE_TEST_ASSERT(count > 0, \"Invalid emudev count %\" PRIu8, count);\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_emu_dev_get_dev_id(void)\n+{\n+\tint ret;\n+\tret = rte_emudev_get_dev_id(\"Invalid_emu_dev_device\\n\");\n+\tRTE_TEST_ASSERT_FAIL(ret, \"Expected <0 for invalid dev name, ret=%d\",\n+\t\t\t     ret);\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_emu_dev_configure(void)\n+{\n+\tint ret;\n+\tstruct rte_emudev_info dev_conf;\n+\tstruct rte_iavf_emu_config iavf_conf_set = {.qp_num = 1};\n+\tstruct rte_iavf_emu_config iavf_conf_get = {0};\n+\n+\trte_emudev_stop(test_dev_id);\n+\n+\t/* Check invalid configuration */\n+\tret = rte_emudev_configure(test_dev_id, NULL);\n+\tRTE_TEST_ASSERT(ret == -EINVAL,\n+\t\t\t\"Null configure; Expected -EINVAL, got %d\", ret);\n+\n+\t/* Valid configuration test */\n+\tdev_conf.dev_priv = (rte_emudev_obj_t)&iavf_conf_get;\n+\tret = rte_emudev_get_dev_info(test_dev_id, &dev_conf);\n+\tRTE_TEST_ASSERT_SUCCESS(ret,\n+\t\t\t\t\"Failed to obtain emudev configuration (%d)\",\n+\t\t\t\tret);\n+\tdev_conf.dev_priv = (rte_emudev_obj_t)&iavf_conf_set;\n+\tret = rte_emudev_configure(test_dev_id, &dev_conf);\n+\tRTE_TEST_ASSERT_SUCCESS(ret, \"Failed to configure emudev (%d)\", ret);\n+\n+\tmemset(&iavf_conf_get, 0, sizeof(iavf_conf_get));\n+\tdev_conf.dev_priv = (rte_emudev_obj_t)&iavf_conf_get;\n+\tret = rte_emudev_get_dev_info(test_dev_id, &dev_conf);\n+\tRTE_TEST_ASSERT_SUCCESS(ret,\n+\t\t\t\t\"Failed to obtain emudev configuration (%d)\",\n+\t\t\t\tret);\n+\n+\tRTE_TEST_ASSERT_EQUAL(iavf_conf_set.qp_num,\n+\t\t\t      iavf_conf_get.qp_num,\n+\t\t\t      \"Configuration test failed; num_queues (%d)(%d)\",\n+\t\t\t      iavf_conf_set.qp_num,\n+\t\t\t      iavf_conf_get.qp_num);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_emu_dev_start_stop(void)\n+{\n+\tint ret;\n+\tret = rte_emudev_start(test_dev_id);\n+\tRTE_TEST_ASSERT_SUCCESS(ret, \"Failed to start emudev (%d)\", ret);\n+\n+\trte_emudev_stop(test_dev_id);\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+int iavf_emu_selftest(uint16_t dev_id)\n+{\n+\ttest_dev_id = dev_id;\n+\ttestsuite_setup();\n+\n+\tEMUDEV_TEST_RUN(NULL, NULL, test_emu_dev_count);\n+\tEMUDEV_TEST_RUN(NULL, NULL, test_emu_dev_get_dev_id);\n+\tEMUDEV_TEST_RUN(NULL, NULL, test_emu_dev_configure);\n+\tEMUDEV_TEST_RUN(NULL, NULL, test_emu_dev_start_stop);\n+\n+\ttestsuite_teardown();\n+\n+\tEMU_IAVF_LOG(INFO, \"Total tests   : %d\\n\", total);\n+\tEMU_IAVF_LOG(INFO, \"Passed        : %d\\n\", passed);\n+\tEMU_IAVF_LOG(INFO, \"Failed        : %d\\n\", failed);\n+\tEMU_IAVF_LOG(INFO, \"Not supported : %d\\n\", unsupported);\n+\n+\tif (failed)\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\ndiff --git a/drivers/emu/iavf/meson.build b/drivers/emu/iavf/meson.build\nindex 3cab2226b7..613783e407 100644\n--- a/drivers/emu/iavf/meson.build\n+++ b/drivers/emu/iavf/meson.build\n@@ -10,7 +10,7 @@ endif\n ext_deps += librt\n \n sources = files('iavf_emu.c', 'iavf_vfio_user.c',\n-\t'iavf_emudev.c')\n+\t'iavf_emu_test.c', 'iavf_emudev.c')\n \n deps += ['bus_vdev', 'emudev', 'vfio_user', 'common_iavf']\n \n",
    "prefixes": [
        "v2",
        "7/8"
    ]
}