get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 92086,
    "url": "http://patches.dpdk.org/api/patches/92086/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210423161820.2135053-2-ciara.power@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20210423161820.2135053-2-ciara.power@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210423161820.2135053-2-ciara.power@intel.com",
    "date": "2021-04-23T16:18:14",
    "name": "[v3,1/7] app/test: refactor of unit test suite runner",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "26a06aa42f29ef0e58d94eca6594a81d02a8ee16",
    "submitter": {
        "id": 978,
        "url": "http://patches.dpdk.org/api/people/978/?format=api",
        "name": "Power, Ciara",
        "email": "ciara.power@intel.com"
    },
    "delegate": {
        "id": 6690,
        "url": "http://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210423161820.2135053-2-ciara.power@intel.com/mbox/",
    "series": [
        {
            "id": 16638,
            "url": "http://patches.dpdk.org/api/series/16638/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=16638",
            "date": "2021-04-23T16:18:13",
            "name": "test: refactor crypto unit test framework",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/16638/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/92086/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/92086/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 B058FA0547;\n\tFri, 23 Apr 2021 18:18:52 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 75AD0410FA;\n\tFri, 23 Apr 2021 18:18:50 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by mails.dpdk.org (Postfix) with ESMTP id 04812410D8\n for <dev@dpdk.org>; Fri, 23 Apr 2021 18:18:47 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 Apr 2021 09:18:47 -0700",
            "from silpixa00400355.ir.intel.com (HELO\n silpixa00400355.ger.corp.intel.com) ([10.237.223.148])\n by orsmga008.jf.intel.com with ESMTP; 23 Apr 2021 09:18:45 -0700"
        ],
        "IronPort-SDR": [
            "\n sX9fOqC0p3a3kf/nq7UOAQrXMhQDx1VkpYjxy0eTxmQPgO9za9Tmz8uCjDKxOOPxmrHY9thbXC\n 5j4Vuyew0f2A==",
            "\n 6AoWbZlBdfx6B7ebX0Z54DhBV4TVN6faW18C03yTU/3ZBiHRLBsvXzGsh0/i7/qreGloCVqUP9\n UhDHnPc26JDA=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,9963\"; a=\"183572755\"",
            "E=Sophos;i=\"5.82,246,1613462400\"; d=\"scan'208\";a=\"183572755\"",
            "E=Sophos;i=\"5.82,246,1613462400\"; d=\"scan'208\";a=\"428442294\""
        ],
        "X-ExtLoop1": "1",
        "From": "Ciara Power <ciara.power@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net, declan.doherty@intel.com, gakhil@marvell.com,\n aconole@redhat.com, hemant.agrawal@nxp.com, anoobj@marvell.com,\n ruifeng.wang@arm.com, asomalap@amd.com, ajit.khaparde@broadcom.com,\n g.singh@nxp.com, Ciara Power <ciara.power@intel.com>",
        "Date": "Fri, 23 Apr 2021 16:18:14 +0000",
        "Message-Id": "<20210423161820.2135053-2-ciara.power@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210423161820.2135053-1-ciara.power@intel.com>",
        "References": "<20210423161820.2135053-1-ciara.power@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v3 1/7] app/test: refactor of unit test suite\n runner",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Some small changes were made to the unit test suite runner for\nreadability and to enable reuse of some of the function in a later patch.\n\nOn test suite setup skip/fail, the loop to count testcases as\nskipped/failed has been moved to another function.\nThis will allow for recursion in a later patch when nested sub-testsuites\nare used.\n\nThe unit test suite runner accessed the list of testcases in the suite\nstructure every time the testcase was used. This is now replaced by a\ntestcase variable which improves readability.\n\nA macro has been introduced for readability, instead of using open\ncoded loops.\n\nRather than keep local variable status counts for testcases,\nthese are added to the test suite structure.\n\nThe summary output now prints the suite name, this will be useful later\nwhen multiple nested sub-testsuites are being run.\n\nSigned-off-by: Ciara Power <ciara.power@intel.com>\nAcked-by: Aaron Conole <aconole@redhat.com>\n\n---\nv3:\n  - Fixed index used when counting testcases on setup fail.\nv2:\n  - Added macro to loop testcases in suite.\n  - Testcase counts added to the test suite structure.\n---\n app/test/test.c | 103 +++++++++++++++++++++++++++++-------------------\n app/test/test.h |   6 +++\n 2 files changed, 69 insertions(+), 40 deletions(-)",
    "diff": "diff --git a/app/test/test.c b/app/test/test.c\nindex 94352a95d5..2fb99d0855 100644\n--- a/app/test/test.c\n+++ b/app/test/test.c\n@@ -36,6 +36,11 @@ extern cmdline_parse_ctx_t main_ctx[];\n \n #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1\n \n+#define FOR_EACH_SUITE_TESTCASE(iter, suite, case)\t\t\t\\\n+\tfor (iter = 0, case = suite->unit_test_cases[0];\t\t\\\n+\t\tsuite->unit_test_cases[iter].testcase;\t\t\t\\\n+\t\titer++, case = suite->unit_test_cases[iter])\n+\n const char *prgname; /* to be set to argv[0] */\n \n static const char *recursive_call; /* used in linux for MP and other tests */\n@@ -234,14 +239,41 @@ main(int argc, char **argv)\n \treturn ret;\n }\n \n+static void\n+unit_test_suite_count_tcs_on_setup_fail(struct unit_test_suite *suite,\n+\t\tint test_success)\n+{\n+\tstruct unit_test_case tc;\n+\tint i;\n+\n+\tFOR_EACH_SUITE_TESTCASE(i, suite, tc) {\n+\t\tsuite->total++;\n+\t\tif (!tc.enabled || test_success == TEST_SKIPPED)\n+\t\t\tsuite->skipped++;\n+\t\telse\n+\t\t\tsuite->failed++;\n+\t}\n+}\n+\n+static void\n+unit_test_suite_reset_counts(struct unit_test_suite *suite)\n+{\n+\tsuite->total = 0;\n+\tsuite->executed = 0;\n+\tsuite->succeeded = 0;\n+\tsuite->skipped = 0;\n+\tsuite->failed = 0;\n+\tsuite->unsupported = 0;\n+}\n \n int\n unit_test_suite_runner(struct unit_test_suite *suite)\n {\n \tint test_success;\n-\tunsigned int total = 0, executed = 0, skipped = 0;\n-\tunsigned int succeeded = 0, failed = 0, unsupported = 0;\n \tconst char *status;\n+\tstruct unit_test_case tc;\n+\n+\tunit_test_suite_reset_counts(suite);\n \n \tif (suite->suite_name) {\n \t\tprintf(\" + ------------------------------------------------------- +\\n\");\n@@ -255,55 +287,48 @@ unit_test_suite_runner(struct unit_test_suite *suite)\n \t\t\t * setup did not pass, so count all enabled tests and\n \t\t\t * mark them as failed/skipped\n \t\t\t */\n-\t\t\twhile (suite->unit_test_cases[total].testcase) {\n-\t\t\t\tif (!suite->unit_test_cases[total].enabled ||\n-\t\t\t\t    test_success == TEST_SKIPPED)\n-\t\t\t\t\tskipped++;\n-\t\t\t\telse\n-\t\t\t\t\tfailed++;\n-\t\t\t\ttotal++;\n-\t\t\t}\n+\t\t\tunit_test_suite_count_tcs_on_setup_fail(suite,\n+\t\t\t\t\ttest_success);\n \t\t\tgoto suite_summary;\n \t\t}\n \t}\n \n \tprintf(\" + ------------------------------------------------------- +\\n\");\n \n-\twhile (suite->unit_test_cases[total].testcase) {\n-\t\tif (!suite->unit_test_cases[total].enabled) {\n-\t\t\tskipped++;\n-\t\t\ttotal++;\n+\tFOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {\n+\t\tif (!tc.enabled) {\n+\t\t\tsuite->skipped++;\n \t\t\tcontinue;\n \t\t} else {\n-\t\t\texecuted++;\n+\t\t\tsuite->executed++;\n \t\t}\n \n \t\t/* run test case setup */\n-\t\tif (suite->unit_test_cases[total].setup)\n-\t\t\ttest_success = suite->unit_test_cases[total].setup();\n+\t\tif (tc.setup)\n+\t\t\ttest_success = tc.setup();\n \t\telse\n \t\t\ttest_success = TEST_SUCCESS;\n \n \t\tif (test_success == TEST_SUCCESS) {\n \t\t\t/* run the test case */\n-\t\t\ttest_success = suite->unit_test_cases[total].testcase();\n+\t\t\ttest_success = tc.testcase();\n \t\t\tif (test_success == TEST_SUCCESS)\n-\t\t\t\tsucceeded++;\n+\t\t\t\tsuite->succeeded++;\n \t\t\telse if (test_success == TEST_SKIPPED)\n-\t\t\t\tskipped++;\n+\t\t\t\tsuite->skipped++;\n \t\t\telse if (test_success == -ENOTSUP)\n-\t\t\t\tunsupported++;\n+\t\t\t\tsuite->unsupported++;\n \t\t\telse\n-\t\t\t\tfailed++;\n+\t\t\t\tsuite->failed++;\n \t\t} else if (test_success == -ENOTSUP) {\n-\t\t\tunsupported++;\n+\t\t\tsuite->unsupported++;\n \t\t} else {\n-\t\t\tfailed++;\n+\t\t\tsuite->failed++;\n \t\t}\n \n \t\t/* run the test case teardown */\n-\t\tif (suite->unit_test_cases[total].teardown)\n-\t\t\tsuite->unit_test_cases[total].teardown();\n+\t\tif (tc.teardown)\n+\t\t\ttc.teardown();\n \n \t\tif (test_success == TEST_SUCCESS)\n \t\t\tstatus = \"succeeded\";\n@@ -314,10 +339,8 @@ unit_test_suite_runner(struct unit_test_suite *suite)\n \t\telse\n \t\t\tstatus = \"failed\";\n \n-\t\tprintf(\" + TestCase [%2d] : %s %s\\n\", total,\n-\t\t\t\tsuite->unit_test_cases[total].name, status);\n-\n-\t\ttotal++;\n+\t\tprintf(\" + TestCase [%2d] : %s %s\\n\", suite->total,\n+\t\t\t\ttc.name, status);\n \t}\n \n \t/* Run test suite teardown */\n@@ -328,20 +351,20 @@ unit_test_suite_runner(struct unit_test_suite *suite)\n \n suite_summary:\n \tprintf(\" + ------------------------------------------------------- +\\n\");\n-\tprintf(\" + Test Suite Summary \\n\");\n-\tprintf(\" + Tests Total :       %2d\\n\", total);\n-\tprintf(\" + Tests Skipped :     %2d\\n\", skipped);\n-\tprintf(\" + Tests Executed :    %2d\\n\", executed);\n-\tprintf(\" + Tests Unsupported:  %2d\\n\", unsupported);\n-\tprintf(\" + Tests Passed :      %2d\\n\", succeeded);\n-\tprintf(\" + Tests Failed :      %2d\\n\", failed);\n+\tprintf(\" + Test Suite Summary : %s\\n\", suite->suite_name);\n+\tprintf(\" + Tests Total :       %2d\\n\", suite->total);\n+\tprintf(\" + Tests Skipped :     %2d\\n\", suite->skipped);\n+\tprintf(\" + Tests Executed :    %2d\\n\", suite->executed);\n+\tprintf(\" + Tests Unsupported:  %2d\\n\", suite->unsupported);\n+\tprintf(\" + Tests Passed :      %2d\\n\", suite->succeeded);\n+\tprintf(\" + Tests Failed :      %2d\\n\", suite->failed);\n \tprintf(\" + ------------------------------------------------------- +\\n\");\n \n-\tlast_test_result = failed;\n+\tlast_test_result = suite->failed;\n \n-\tif (failed)\n+\tif (suite->failed)\n \t\treturn TEST_FAILED;\n-\tif (total == skipped)\n+\tif (suite->total == suite->skipped)\n \t\treturn TEST_SKIPPED;\n \treturn TEST_SUCCESS;\n }\ndiff --git a/app/test/test.h b/app/test/test.h\nindex cd047eb26c..55f2850fed 100644\n--- a/app/test/test.h\n+++ b/app/test/test.h\n@@ -138,6 +138,12 @@ struct unit_test_suite {\n \tconst char *suite_name;\n \tint (*setup)(void);\n \tvoid (*teardown)(void);\n+\tunsigned int total;\n+\tunsigned int executed;\n+\tunsigned int succeeded;\n+\tunsigned int skipped;\n+\tunsigned int failed;\n+\tunsigned int unsupported;\n \tstruct unit_test_case unit_test_cases[];\n };\n \n",
    "prefixes": [
        "v3",
        "1/7"
    ]
}