get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 90474,
    "url": "http://patches.dpdk.org/api/patches/90474/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210402142424.1353789-3-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": "<20210402142424.1353789-3-ciara.power@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210402142424.1353789-3-ciara.power@intel.com",
    "date": "2021-04-02T14:24:20",
    "name": "[v2,2/6] test: introduce parent testsuite format",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "81fe3b44cd783dc866f08aa083cf53074727377e",
    "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/20210402142424.1353789-3-ciara.power@intel.com/mbox/",
    "series": [
        {
            "id": 16085,
            "url": "http://patches.dpdk.org/api/series/16085/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=16085",
            "date": "2021-04-02T14:24:18",
            "name": "test: refactor crypto unit test framework",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/16085/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/90474/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/90474/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 2B3E2A0548;\n\tFri,  2 Apr 2021 16:24:55 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4E862140FF7;\n\tFri,  2 Apr 2021 16:24:48 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n by mails.dpdk.org (Postfix) with ESMTP id DF94A140FE6\n for <dev@dpdk.org>; Fri,  2 Apr 2021 16:24:45 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 02 Apr 2021 07:24:45 -0700",
            "from silpixa00400355.ir.intel.com (HELO\n silpixa00400355.ger.corp.intel.com) ([10.237.223.148])\n by fmsmga008.fm.intel.com with ESMTP; 02 Apr 2021 07:24:43 -0700"
        ],
        "IronPort-SDR": [
            "\n M6wVoYmFB86dLrv4Y7TZSZFeVh7w+xym+1hJy3v7c99A91bnHzX0Z8bYKuxbKPe2wVRu+O1iD1\n 2BykN5woLfZA==",
            "\n sYic2JVRYxlz+50py3xDyrNl3rEEduQhkvlKqk3jsPw/k2RHFQYP2JH5oc3G49vQguOgDEd03F\n WXyGMw4h/NtA=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9942\"; a=\"192512452\"",
            "E=Sophos;i=\"5.81,300,1610438400\"; d=\"scan'208\";a=\"192512452\"",
            "E=Sophos;i=\"5.81,300,1610438400\"; d=\"scan'208\";a=\"413199574\""
        ],
        "X-ExtLoop1": "1",
        "From": "Ciara Power <ciara.power@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "declan.doherty@intel.com, gakhil@marvell.com, aconole@redhat.com,\n hemant.agrawal@nxp.com, anoobj@marvell.com, ruifeng.wang@arm.com,\n asomalap@amd.com, ajit.khaparde@broadcom.com, g.singh@nxp.com,\n Ciara Power <ciara.power@intel.com>",
        "Date": "Fri,  2 Apr 2021 14:24:20 +0000",
        "Message-Id": "<20210402142424.1353789-3-ciara.power@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210402142424.1353789-1-ciara.power@intel.com>",
        "References": "<20210402142424.1353789-1-ciara.power@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v2 2/6] test: introduce parent testsuite format",
        "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": "The current structure for unit testing only allows for running a\ntest suite with nested test cases. This means all test cases for an\nautotest must be in one suite, which is not ideal.\nFor example, in some cases we may want to run multiple lists of test\ncases that each require different setup, so should be in separate suites.\n\nThe unit test suite struct is modified to hold a pointer to a list of\nsub-testsuite pointers, along with the list of testcases as before.\nBoth should not be used at once, if there are sub-testsuite pointers,\nthat takes precedence over testcases.\n\nSigned-off-by: Ciara Power <ciara.power@intel.com>\n\n---\nv2:\n  - Added macro to loop sub-testsuites.\n  - Added sub-testsuite summary detail.\n---\n app/test/test.c | 168 ++++++++++++++++++++++++++++++++++--------------\n app/test/test.h |   1 +\n 2 files changed, 122 insertions(+), 47 deletions(-)",
    "diff": "diff --git a/app/test/test.c b/app/test/test.c\nindex a795cba1bb..e401de0fdf 100644\n--- a/app/test/test.c\n+++ b/app/test/test.c\n@@ -41,6 +41,11 @@ extern cmdline_parse_ctx_t main_ctx[];\n \t\tsuite->unit_test_cases[iter].testcase;\t\t\t\\\n \t\titer++, case = suite->unit_test_cases[iter])\n \n+#define FOR_EACH_SUITE_TESTSUITE(iter, suite, sub_ts)\t\t\t\\\n+\tfor (iter = 0, sub_ts = suite->unit_test_suites[0];\t\t\\\n+\t\tsuite->unit_test_suites[iter]->suite_name != NULL;\t\\\n+\t\titer++, sub_ts = suite->unit_test_suites[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@@ -214,21 +219,46 @@ main(int argc, char **argv)\n \n static void\n unit_test_suite_count_tcs_on_setup_fail(struct unit_test_suite *suite,\n-\t\tint test_success)\n+\t\tint test_success, unsigned int *sub_ts_failed,\n+\t\tunsigned int *sub_ts_skipped, unsigned int *sub_ts_total)\n {\n \tstruct unit_test_case tc;\n-\n-\tFOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {\n-\t\tif (!tc.enabled || test_success == TEST_SKIPPED)\n-\t\t\tsuite->skipped++;\n-\t\telse\n-\t\t\tsuite->failed++;\n+\tstruct unit_test_suite *ts;\n+\tint i;\n+\n+\tif (suite->unit_test_suites) {\n+\t\tFOR_EACH_SUITE_TESTSUITE(i, suite, ts) {\n+\t\t\tunit_test_suite_count_tcs_on_setup_fail(\n+\t\t\t\tts, test_success, sub_ts_failed,\n+\t\t\t\tsub_ts_skipped, sub_ts_total);\n+\t\t\tsuite->total += ts->total;\n+\t\t\tsuite->failed += ts->failed;\n+\t\t\tsuite->skipped += ts->skipped;\n+\t\t\tif (ts->failed)\n+\t\t\t\t(*sub_ts_failed)++;\n+\t\t\telse\n+\t\t\t\t(*sub_ts_skipped)++;\n+\t\t\t(*sub_ts_total)++;\n+\t\t}\n+\t} else {\n+\t\tFOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {\n+\t\t\tif (!tc.enabled || test_success == TEST_SKIPPED)\n+\t\t\t\tsuite->skipped++;\n+\t\t\telse\n+\t\t\t\tsuite->failed++;\n+\t\t}\n \t}\n }\n \n static void\n unit_test_suite_reset_counts(struct unit_test_suite *suite)\n {\n+\tstruct unit_test_suite *ts;\n+\tint i;\n+\n+\tif (suite->unit_test_suites)\n+\t\tFOR_EACH_SUITE_TESTSUITE(i, suite, ts)\n+\t\t\tunit_test_suite_reset_counts(ts);\n \tsuite->total = 0;\n \tsuite->executed = 0;\n \tsuite->succeeded = 0;\n@@ -240,9 +270,12 @@ unit_test_suite_reset_counts(struct unit_test_suite *suite)\n int\n unit_test_suite_runner(struct unit_test_suite *suite)\n {\n-\tint test_success;\n+\tint test_success, i, ret;\n \tconst char *status;\n \tstruct unit_test_case tc;\n+\tstruct unit_test_suite *ts;\n+\tunsigned int sub_ts_succeeded = 0, sub_ts_failed = 0;\n+\tunsigned int sub_ts_skipped = 0, sub_ts_total = 0;\n \n \tunit_test_suite_reset_counts(suite);\n \n@@ -259,70 +292,111 @@ unit_test_suite_runner(struct unit_test_suite *suite)\n \t\t\t * mark them as failed/skipped\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\t\t\ttest_success, &sub_ts_failed,\n+\t\t\t\t\t&sub_ts_skipped, &sub_ts_total);\n \t\t\tgoto suite_summary;\n \t\t}\n \t}\n \n \tprintf(\" + ------------------------------------------------------- +\\n\");\n \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\tsuite->executed++;\n+\tif (suite->unit_test_suites) {\n+\t\tFOR_EACH_SUITE_TESTSUITE(i, suite, ts) {\n+\t\t\tret = unit_test_suite_runner(ts);\n+\t\t\tif (ret == TEST_SUCCESS)\n+\t\t\t\tsub_ts_succeeded++;\n+\t\t\telse if (ret == TEST_SKIPPED)\n+\t\t\t\tsub_ts_skipped++;\n+\t\t\telse\n+\t\t\t\tsub_ts_failed++;\n+\t\t\tsub_ts_total++;\n \t\t}\n+\t} else {\n+\t\tFOR_EACH_SUITE_TESTCASE(suite->total, suite, tc) {\n+\t\t\tif (!tc.enabled) {\n+\t\t\t\tsuite->skipped++;\n+\t\t\t\tcontinue;\n+\t\t\t} else {\n+\t\t\t\tsuite->executed++;\n+\t\t\t}\n+\n+\t\t\t/* run test case setup */\n+\t\t\tif (tc.setup)\n+\t\t\t\ttest_success = tc.setup();\n+\t\t\telse\n+\t\t\t\ttest_success = TEST_SUCCESS;\n+\n+\t\t\tif (test_success == TEST_SUCCESS) {\n+\t\t\t\t/* run the test case */\n+\t\t\t\ttest_success = tc.testcase();\n+\t\t\t\tif (test_success == TEST_SUCCESS)\n+\t\t\t\t\tsuite->succeeded++;\n+\t\t\t\telse if (test_success == TEST_SKIPPED)\n+\t\t\t\t\tsuite->skipped++;\n+\t\t\t\telse if (test_success == -ENOTSUP)\n+\t\t\t\t\tsuite->unsupported++;\n+\t\t\t\telse\n+\t\t\t\t\tsuite->failed++;\n+\t\t\t} else if (test_success == -ENOTSUP) {\n+\t\t\t\tsuite->unsupported++;\n+\t\t\t} else {\n+\t\t\t\tsuite->failed++;\n+\t\t\t}\n \n-\t\t/* run test case setup */\n-\t\tif (tc.setup)\n-\t\t\ttest_success = tc.setup();\n-\t\telse\n-\t\t\ttest_success = TEST_SUCCESS;\n+\t\t\t/* run the test case teardown */\n+\t\t\tif (tc.teardown)\n+\t\t\t\ttc.teardown();\n \n-\t\tif (test_success == TEST_SUCCESS) {\n-\t\t\t/* run the test case */\n-\t\t\ttest_success = tc.testcase();\n \t\t\tif (test_success == TEST_SUCCESS)\n-\t\t\t\tsuite->succeeded++;\n+\t\t\t\tstatus = \"succeeded\";\n \t\t\telse if (test_success == TEST_SKIPPED)\n-\t\t\t\tsuite->skipped++;\n+\t\t\t\tstatus = \"skipped\";\n \t\t\telse if (test_success == -ENOTSUP)\n-\t\t\t\tsuite->unsupported++;\n+\t\t\t\tstatus = \"unsupported\";\n \t\t\telse\n-\t\t\t\tsuite->failed++;\n-\t\t} else if (test_success == -ENOTSUP) {\n-\t\t\tsuite->unsupported++;\n-\t\t} else {\n-\t\t\tsuite->failed++;\n-\t\t}\n+\t\t\t\tstatus = \"failed\";\n \n-\t\t/* run the test case 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-\t\telse if (test_success == TEST_SKIPPED)\n-\t\t\tstatus = \"skipped\";\n-\t\telse if (test_success == -ENOTSUP)\n-\t\t\tstatus = \"unsupported\";\n-\t\telse\n-\t\t\tstatus = \"failed\";\n-\n-\t\tprintf(\" + TestCase [%2d] : %s %s\\n\", suite->total,\n-\t\t\t\ttc.name, status);\n+\t\t\tprintf(\" + TestCase [%2d] : %s %s\\n\", suite->total,\n+\t\t\t\t\ttc.name, status);\n+\t\t}\n \t}\n \n \t/* Run test suite teardown */\n \tif (suite->teardown)\n \t\tsuite->teardown();\n \n+\tif (suite->unit_test_suites)\n+\t\tFOR_EACH_SUITE_TESTSUITE(i, suite, ts) {\n+\t\t\tsuite->total += ts->total;\n+\t\t\tsuite->succeeded += ts->succeeded;\n+\t\t\tsuite->failed += ts->failed;\n+\t\t\tsuite->skipped += ts->skipped;\n+\t\t\tsuite->unsupported += ts->unsupported;\n+\t\t\tsuite->executed += ts->executed;\n+\t\t}\n+\n \tgoto suite_summary;\n \n suite_summary:\n \tprintf(\" + ------------------------------------------------------- +\\n\");\n \tprintf(\" + Test Suite Summary : %s\\n\", suite->suite_name);\n+\tprintf(\" + ------------------------------------------------------- +\\n\");\n+\n+\tif (suite->unit_test_suites) {\n+\t\tFOR_EACH_SUITE_TESTSUITE(i, suite, ts)\n+\t\t\tprintf(\" + %s : %d/%d passed, %d/%d skipped, \"\n+\t\t\t\t\"%d/%d failed, %d/%d unsupported\\n\",\n+\t\t\t\tts->suite_name, ts->succeeded, ts->total,\n+\t\t\t\tts->skipped, ts->total, ts->failed, ts->total,\n+\t\t\t\tts->unsupported, ts->total);\n+\t\tprintf(\" + ------------------------------------------------------- +\\n\");\n+\t\tprintf(\" + Sub Testsuites Total :     %2d\\n\", sub_ts_total);\n+\t\tprintf(\" + Sub Testsuites Skipped :   %2d\\n\", sub_ts_skipped);\n+\t\tprintf(\" + Sub Testsuites Passed :    %2d\\n\", sub_ts_succeeded);\n+\t\tprintf(\" + Sub Testsuites Failed :    %2d\\n\", sub_ts_failed);\n+\t\tprintf(\" + ------------------------------------------------------- +\\n\");\n+\t}\n+\n \tprintf(\" + Tests Total :       %2d\\n\", suite->total);\n \tprintf(\" + Tests Skipped :     %2d\\n\", suite->skipped);\n \tprintf(\" + Tests Executed :    %2d\\n\", suite->executed);\ndiff --git a/app/test/test.h b/app/test/test.h\nindex 10c7b496e6..e9bfc365e4 100644\n--- a/app/test/test.h\n+++ b/app/test/test.h\n@@ -144,6 +144,7 @@ struct unit_test_suite {\n \tunsigned int skipped;\n \tunsigned int failed;\n \tunsigned int unsupported;\n+\tstruct unit_test_suite **unit_test_suites;\n \tstruct unit_test_case unit_test_cases[];\n };\n \n",
    "prefixes": [
        "v2",
        "2/6"
    ]
}