get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 133827,
    "url": "http://patchwork.dpdk.org/api/patches/133827/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20231103095325.47843-3-fengchengwen@huawei.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20231103095325.47843-3-fengchengwen@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231103095325.47843-3-fengchengwen@huawei.com",
    "date": "2023-11-03T09:53:20",
    "name": "[2/7] app/test: extract basic token count testcase for kvargs",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "7dac707a06325af099972bb1933e19b66ec51438",
    "submitter": {
        "id": 2146,
        "url": "http://patchwork.dpdk.org/api/people/2146/?format=api",
        "name": "fengchengwen",
        "email": "fengchengwen@huawei.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20231103095325.47843-3-fengchengwen@huawei.com/mbox/",
    "series": [
        {
            "id": 30133,
            "url": "http://patchwork.dpdk.org/api/series/30133/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=30133",
            "date": "2023-11-03T09:53:18",
            "name": "refactor kvargs test",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/30133/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/133827/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/133827/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 67D3843279;\n\tFri,  3 Nov 2023 10:56:33 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 2CC4B42D83;\n\tFri,  3 Nov 2023 10:56:13 +0100 (CET)",
            "from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187])\n by mails.dpdk.org (Postfix) with ESMTP id DDEAD402EB\n for <dev@dpdk.org>; Fri,  3 Nov 2023 10:56:08 +0100 (CET)",
            "from dggpeml100024.china.huawei.com (unknown [172.30.72.54])\n by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SMGN32K1qzvQbZ;\n Fri,  3 Nov 2023 17:56:03 +0800 (CST)",
            "from localhost.localdomain (10.50.165.33) by\n dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2507.31; Fri, 3 Nov 2023 17:56:04 +0800"
        ],
        "From": "Chengwen Feng <fengchengwen@huawei.com>",
        "To": "<thomas@monjalon.net>, <ferruh.yigit@amd.com>",
        "CC": "<dev@dpdk.org>",
        "Subject": "[PATCH 2/7] app/test: extract basic token count testcase for kvargs",
        "Date": "Fri, 3 Nov 2023 09:53:20 +0000",
        "Message-ID": "<20231103095325.47843-3-fengchengwen@huawei.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20231103095325.47843-1-fengchengwen@huawei.com>",
        "References": "<20231103095325.47843-1-fengchengwen@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.50.165.33]",
        "X-ClientProxiedBy": "dggems704-chm.china.huawei.com (10.3.19.181) To\n dggpeml100024.china.huawei.com (7.185.36.115)",
        "X-CFilter-Loop": "Reflected",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "The test_valid_kvargs() function is too long to understand, extract\nthe basic token count tests as one stand-alone testcase.\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n app/test/test_kvargs.c | 120 ++++++++++++++++-------------------------\n 1 file changed, 45 insertions(+), 75 deletions(-)",
    "diff": "diff --git a/app/test/test_kvargs.c b/app/test/test_kvargs.c\nindex 9aeb9aa0aa..a27b2aabfb 100644\n--- a/app/test/test_kvargs.c\n+++ b/app/test/test_kvargs.c\n@@ -36,25 +36,6 @@ static int check_handler(const char *key, const char *value,\n \treturn 0;\n }\n \n-/* test parsing. */\n-static int test_kvargs_parsing(const char *args, unsigned int n)\n-{\n-\tstruct rte_kvargs *kvlist;\n-\n-\tkvlist = rte_kvargs_parse(args, NULL);\n-\tif (kvlist == NULL) {\n-\t\tprintf(\"rte_kvargs_parse() error: %s\\n\", args);\n-\t\treturn -1;\n-\t}\n-\tif (kvlist->count != n) {\n-\t\tprintf(\"invalid count value %d: %s\\n\", kvlist->count, args);\n-\t\trte_kvargs_free(kvlist);\n-\t\treturn -1;\n-\t}\n-\trte_kvargs_free(kvlist);\n-\treturn 0;\n-}\n-\n /* test a valid case */\n static int test_valid_kvargs(void)\n {\n@@ -62,29 +43,6 @@ static int test_valid_kvargs(void)\n \tconst char *args;\n \tconst char *valid_keys_list[] = { \"foo\", \"check\", NULL };\n \tconst char **valid_keys;\n-\tstatic const struct {\n-\t\tunsigned int expected;\n-\t\tconst char *input;\n-\t} valid_inputs[] = {\n-\t\t{ 2, \"foo=1,foo=\" },\n-\t\t{ 2, \"foo=1,foo=\" },\n-\t\t{ 2, \"foo=1,foo\" },\n-\t\t{ 2, \"foo=1,=2\" },\n-\t\t{ 1, \"foo=[1,2\" },\n-\t\t{ 1, \",=\" },\n-\t\t{ 1, \"foo=[\" },\n-\t};\n-\tunsigned int i;\n-\n-\t/* empty args is valid */\n-\targs = \"\";\n-\tvalid_keys = NULL;\n-\tkvlist = rte_kvargs_parse(args, valid_keys);\n-\tif (kvlist == NULL) {\n-\t\tprintf(\"rte_kvargs_parse() error\");\n-\t\tgoto fail;\n-\t}\n-\trte_kvargs_free(kvlist);\n \n \t/* first test without valid_keys */\n \targs = \"foo=1234,check=value0,check=value1\";\n@@ -128,14 +86,6 @@ static int test_valid_kvargs(void)\n \t\trte_kvargs_free(kvlist);\n \t\tgoto fail;\n \t}\n-\t/* count all entries */\n-\tcount = rte_kvargs_count(kvlist, NULL);\n-\tif (count != 3) {\n-\t\tprintf(\"invalid count value %d after rte_kvargs_count(NULL)\\n\",\n-\t\t\tcount);\n-\t\trte_kvargs_free(kvlist);\n-\t\tgoto fail;\n-\t}\n \t/* count all entries with key=\"nonexistent_key\" */\n \tcount = rte_kvargs_count(kvlist, \"nonexistent_key\");\n \tif (count != 0) {\n@@ -190,19 +140,6 @@ static int test_valid_kvargs(void)\n \t}\n \trte_kvargs_free(kvlist);\n \n-\t/* test using empty string (it is valid) */\n-\targs = \"\";\n-\tkvlist = rte_kvargs_parse(args, NULL);\n-\tif (kvlist == NULL) {\n-\t\tprintf(\"rte_kvargs_parse() error\\n\");\n-\t\tgoto fail;\n-\t}\n-\tif (rte_kvargs_count(kvlist, NULL) != 0) {\n-\t\tprintf(\"invalid count value\\n\");\n-\t\tgoto fail;\n-\t}\n-\trte_kvargs_free(kvlist);\n-\n \t/* test using empty elements (it is valid) */\n \targs = \"foo=1,,check=value2,,\";\n \tkvlist = rte_kvargs_parse(args, NULL);\n@@ -210,10 +147,6 @@ static int test_valid_kvargs(void)\n \t\tprintf(\"rte_kvargs_parse() error\\n\");\n \t\tgoto fail;\n \t}\n-\tif (rte_kvargs_count(kvlist, NULL) != 2) {\n-\t\tprintf(\"invalid count value\\n\");\n-\t\tgoto fail;\n-\t}\n \tif (rte_kvargs_count(kvlist, \"foo\") != 1) {\n \t\tprintf(\"invalid count value for 'foo'\\n\");\n \t\tgoto fail;\n@@ -224,14 +157,6 @@ static int test_valid_kvargs(void)\n \t}\n \trte_kvargs_free(kvlist);\n \n-\tvalid_keys = NULL;\n-\n-\tfor (i = 0; i < RTE_DIM(valid_inputs); ++i) {\n-\t\targs = valid_inputs[i].input;\n-\t\tif (test_kvargs_parsing(args, valid_inputs[i].expected))\n-\t\t\tgoto fail;\n-\t}\n-\n \treturn 0;\n \n  fail:\n@@ -246,6 +171,50 @@ static int test_valid_kvargs(void)\n \treturn -1;\n }\n \n+static int\n+test_basic_token_count(void)\n+{\n+\tstatic const struct {\n+\t\tunsigned int expected;\n+\t\tconst char *input;\n+\t} valid_inputs[] = {\n+\t\t{ 3, \"foo=1,check=1,check=2\" },\n+\t\t{ 3, \"foo=1,check,check=2\"   },\n+\t\t{ 2, \"foo=1,foo=\"            },\n+\t\t{ 2, \"foo=1,foo=\"            },\n+\t\t{ 2, \"foo=1,foo\"             },\n+\t\t{ 2, \"foo=1,=2\"              },\n+\t\t{ 2, \"foo=1,,foo=2,,\"        },\n+\t\t{ 1, \"foo=[1,2\"              },\n+\t\t{ 1, \",=\"                    },\n+\t\t{ 1, \"foo=[\"                 },\n+\t\t{ 0, \"\"                      },\n+\t};\n+\tstruct rte_kvargs *kvlist;\n+\tunsigned int count;\n+\tconst char *args;\n+\tunsigned int i;\n+\n+\tfor (i = 0; i < RTE_DIM(valid_inputs); i++) {\n+\t\targs = valid_inputs[i].input;\n+\t\tkvlist = rte_kvargs_parse(args, NULL);\n+\t\tif (kvlist == NULL) {\n+\t\t\tprintf(\"rte_kvargs_parse() error: %s\\n\", args);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tcount = rte_kvargs_count(kvlist, NULL);\n+\t\tif (count != valid_inputs[i].expected) {\n+\t\t\tprintf(\"invalid count value %u (expected %u): %s\\n\",\n+\t\t\t       count, valid_inputs[i].expected, args);\n+\t\t\trte_kvargs_free(kvlist);\n+\t\t\treturn -1;\n+\t\t}\n+\t\trte_kvargs_free(kvlist);\n+\t}\n+\n+\treturn 0;\n+}\n+\n /* test several error cases */\n static int test_invalid_kvargs(void)\n {\n@@ -287,6 +256,7 @@ static struct unit_test_suite kvargs_test_suite  = {\n \t.teardown = NULL,\n \t.unit_test_cases = {\n \t\tTEST_CASE(test_valid_kvargs),\n+\t\tTEST_CASE(test_basic_token_count),\n \t\tTEST_CASE(test_invalid_kvargs),\n \t\tTEST_CASES_END() /**< NULL terminate unit test array */\n \t}\n",
    "prefixes": [
        "2/7"
    ]
}