get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 130296,
    "url": "https://patches.dpdk.org/api/patches/130296/?format=api",
    "web_url": "https://patches.dpdk.org/project/ci/patch/20230814182104.470270-6-bruce.richardson@intel.com/",
    "project": {
        "id": 5,
        "url": "https://patches.dpdk.org/api/projects/5/?format=api",
        "name": "CI",
        "link_name": "ci",
        "list_id": "ci.dpdk.org",
        "list_email": "ci@dpdk.org",
        "web_url": "",
        "scm_url": "git://dpdk.org/tools/dpdk-ci",
        "webscm_url": "https://git.dpdk.org/tools/dpdk-ci/",
        "list_archive_url": "https://inbox.dpdk.org/ci",
        "list_archive_url_format": "https://inbox.dpdk.org/ci/{}",
        "commit_url_format": ""
    },
    "msgid": "<20230814182104.470270-6-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/ci/20230814182104.470270-6-bruce.richardson@intel.com",
    "date": "2023-08-14T18:21:01",
    "name": "[v3,5/8] app/test: define unit tests suites based on test macros",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "6db1cca81e1a65e9d03ec01e6f2dde62ede9fdb8",
    "submitter": {
        "id": 20,
        "url": "https://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/ci/patch/20230814182104.470270-6-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 29221,
            "url": "https://patches.dpdk.org/api/series/29221/?format=api",
            "web_url": "https://patches.dpdk.org/project/ci/list/?series=29221",
            "date": "2023-08-14T18:20:57",
            "name": "[v3,1/8] app/test: add new macros for various test types",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/29221/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/130296/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/130296/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ci-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 2E2A043064;\n\tMon, 14 Aug 2023 20:21:34 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 8D0AC432EB;\n\tMon, 14 Aug 2023 20:21:24 +0200 (CEST)",
            "from mgamail.intel.com (mgamail.intel.com [134.134.136.65])\n by mails.dpdk.org (Postfix) with ESMTP id 182DD432DD;\n Mon, 14 Aug 2023 20:21:21 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 14 Aug 2023 11:21:21 -0700",
            "from silpixa00401385.ir.intel.com ([10.237.214.14])\n by orsmga002.jf.intel.com with ESMTP; 14 Aug 2023 11:21:20 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1692037282; x=1723573282;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=TI9k2EjFAtEc1iqIRzDLK0ujuWCDEWYKrViEoPsQb0o=;\n b=bEUxLKyP6z8RBn59KxL7TLL5EMT/pK/F7nqDhVFpVfBk4nEuA8Qv2u3i\n hyythOFcrlKDQDcWroRA7NNbctufra9np66XSR8m4luEuZTOdnUdKJd6+\n HG84orvN1uO2qT3wZyQd9L2SMkos0pOobIKf7c1rpcE+g33EhneOYlaSN\n ZKJp1Ruyvf1uaHzuU9sBay2E8UXfpxQR/OOkUddt2MYi0O7wueMpvGNXM\n DYkDK85nv2Ind/v4f1AkONSgYNupvmYXM0Fw+twjAXNTHcKCo8iJF7/VA\n Yj/hyRvFmfeCSs/MRcSbj37Oav8Mmy07+nGP1Dy6d9HnY7xYOwRZNYdnq g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10802\"; a=\"375831115\"",
            "E=Sophos;i=\"6.01,173,1684825200\"; d=\"scan'208\";a=\"375831115\"",
            "E=McAfee;i=\"6600,9927,10802\"; a=\"733545518\"",
            "E=Sophos;i=\"6.01,173,1684825200\"; d=\"scan'208\";a=\"733545518\""
        ],
        "X-ExtLoop1": "1",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "ci@dpdk.org,\n\tBruce Richardson <bruce.richardson@intel.com>",
        "Subject": "[PATCH v3 5/8] app/test: define unit tests suites based on test\n macros",
        "Date": "Mon, 14 Aug 2023 19:21:01 +0100",
        "Message-Id": "<20230814182104.470270-6-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20230814182104.470270-1-bruce.richardson@intel.com>",
        "References": "<20230721115125.55137-1-bruce.richardson@intel.com>\n <20230814182104.470270-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "ci@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK CI discussions <ci.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/ci>,\n <mailto:ci-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/ci/>",
        "List-Post": "<mailto:ci@dpdk.org>",
        "List-Help": "<mailto:ci-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/ci>,\n <mailto:ci-request@dpdk.org?subject=subscribe>",
        "Errors-To": "ci-bounces@dpdk.org"
    },
    "content": "Rather than having the test suites listed out in the meson.build files\nand having to have them enabled/disabled selectively based on what libs\nare being built, pull the tests to run from the source files which were\nadded to the build.\n\nMost test suites require no additional info other than the list of test\nnames in the suite. However the fast-test are special that they have\nadditional parameters associated with them. This requires some\nadditional work in the test extraction script and in the meson.build\nfile for processing the output.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n app/meson.build                               |  7 +-\n app/test/suites/meson.build                   | 76 +++++++++++++++++++\n buildtools/get-test-suites.py                 | 33 ++++++++\n .../has-hugepages.py                          |  0\n buildtools/meson.build                        |  2 +\n 5 files changed, 117 insertions(+), 1 deletion(-)\n create mode 100644 app/test/suites/meson.build\n create mode 100644 buildtools/get-test-suites.py\n rename app/test/has_hugepage.py => buildtools/has-hugepages.py (100%)",
    "diff": "diff --git a/app/meson.build b/app/meson.build\nindex 0d8b618e7f..c14dc80892 100644\n--- a/app/meson.build\n+++ b/app/meson.build\n@@ -101,7 +101,7 @@ foreach app:apps\n         link_libs = dpdk_static_libraries + dpdk_drivers\n     endif\n \n-    executable('dpdk-' + name,\n+    exec = executable('dpdk-' + name,\n             sources,\n             c_args: cflags,\n             link_args: ldflags,\n@@ -110,4 +110,9 @@ foreach app:apps\n             include_directories: includes,\n             install_rpath: join_paths(get_option('prefix'), driver_install_path),\n             install: true)\n+    if name == 'test'\n+        dpdk_test = exec\n+        autotest_sources = sources\n+        subdir('test/suites')  # define the pre-canned test suites\n+    endif\n endforeach\ndiff --git a/app/test/suites/meson.build b/app/test/suites/meson.build\nnew file mode 100644\nindex 0000000000..df0c66ff0d\n--- /dev/null\n+++ b/app/test/suites/meson.build\n@@ -0,0 +1,76 @@\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2023 Intel Corporation\n+\n+# some perf tests (eg: memcpy perf autotest)take very long\n+# to complete, so timeout to 10 minutes\n+timeout_seconds = 600\n+timeout_seconds_fast = 10\n+\n+test_no_huge_args = ['--no-huge', '-m', '2048']\n+has_hugepage = run_command(has_hugepages_cmd, check: true).stdout().strip() != '0'\n+message('hugepage availability: @0@'.format(has_hugepage))\n+\n+# process source files to determine the different unit test suites\n+# - fast_tests\n+# - perf_tests\n+# - driver_tests\n+test_suites = run_command(get_test_suites_cmd, autotest_sources,\n+         check: true).stdout().strip().split()\n+foreach suite:test_suites\n+    # simple cases - tests without parameters or special handling\n+    suite = suite.split('=')\n+    suite_name = suite[0]\n+    suite_tests = suite[1].split(',')\n+    if suite_name != 'fast-tests'\n+        # simple cases - tests without parameters or special handling\n+        foreach t: suite_tests\n+            test(t, dpdk_test,\n+                    args: ['--', t],\n+                    timeout: timeout_seconds,\n+                    is_parallel: false,\n+                    suite: suite_name)\n+        endforeach\n+    else\n+    # special fast-test handling here\n+        foreach t: suite_tests\n+            params = t.split(':')\n+            test_name = params[0]\n+            nohuge = params[1] == 'true'\n+            asan = params[2] == 'true'\n+\n+            test_args = []\n+            if nohuge\n+                test_args += test_no_huge_args\n+            elif not has_hugepage\n+                continue  #skip this tests\n+            endif\n+            if not asan and (get_option('b_sanitize') == 'address'\n+                    or get_option('b_sanitize') == 'address,undefined')\n+                continue  # skip this test\n+            endif\n+\n+            if (get_option('default_library') == 'shared'\n+                    and test_name == 'event_eth_tx_adapter_autotest')\n+                test_args += ['-d', dpdk_drivers_build_dir]\n+            endif\n+            if is_linux\n+                test_args += ['--file-prefix=@0@'.format(arg[0])]\n+            endif\n+\n+            test(test_name, dpdk_test,\n+                args : test_args + ['--', test_name],\n+                timeout : timeout_seconds_fast,\n+                is_parallel : false,\n+                suite : 'fast-tests')\n+            if not is_windows and test_name == 'trace_autotest'\n+                test_args += ['--trace=.*']\n+                test_args += ['--trace-dir=@0@'.format(meson.current_build_dir())]\n+                test(test_name + '_with_traces', dpdk_test,\n+                    args : test_args + ['--', test_name],\n+                    timeout : timeout_seconds_fast,\n+                    is_parallel : false,\n+                    suite : 'fast-tests')\n+            endif\n+        endforeach\n+    endif\n+endforeach\ndiff --git a/buildtools/get-test-suites.py b/buildtools/get-test-suites.py\nnew file mode 100644\nindex 0000000000..95a9cad4c8\n--- /dev/null\n+++ b/buildtools/get-test-suites.py\n@@ -0,0 +1,33 @@\n+#! /usr/bin/env python3\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2023 Intel Corporation\n+\n+import sys\n+import re\n+\n+input_list = sys.argv[1:]\n+test_def_regex = re.compile(\"REGISTER_([A-Z]+)_TEST\\s*\\(\\s*([a-z0-9_]+)\")\n+test_suites = {}\n+\n+def get_fast_test_params(test_name, ln):\n+    \"Extract the extra fast-test parameters from the line\"\n+    #print(f\"ln: {ln.rstrip()}, test_name: {test_name}, split: {ln.split(test_name, 1)}\")\n+    (_, rest_of_line) = ln.split(test_name, 1)\n+    (_, nohuge, asan, _func) = rest_of_line.split(',', 3)\n+    return f\":{nohuge.strip().lower()}:{asan.strip().lower()}\"\n+\n+for fname in input_list:\n+    with open(fname) as f:\n+        contents = [ln for ln in f.readlines() if test_def_regex.match(ln.strip())]\n+    for ln in contents:\n+        (test_suite, test_name) = test_def_regex.match(ln).group(1, 2)\n+        suite_name = f\"{test_suite.lower()}-tests\"\n+        if suite_name in test_suites:\n+            test_suites[suite_name].append(test_name)\n+        else:\n+            test_suites[suite_name] = [test_name]\n+        if suite_name == \"fast-tests\":\n+            test_suites[\"fast-tests\"][-1] += get_fast_test_params(test_name, ln)\n+\n+for suite in test_suites.keys():\n+    print(f\"{suite}={','.join(test_suites[suite])}\")\ndiff --git a/app/test/has_hugepage.py b/buildtools/has-hugepages.py\nsimilarity index 100%\nrename from app/test/has_hugepage.py\nrename to buildtools/has-hugepages.py\ndiff --git a/buildtools/meson.build b/buildtools/meson.build\nindex e1c600e40f..ac5e4dcf08 100644\n--- a/buildtools/meson.build\n+++ b/buildtools/meson.build\n@@ -18,6 +18,8 @@ map_to_win_cmd = py3 + files('map_to_win.py')\n sphinx_wrapper = py3 + files('call-sphinx-build.py')\n get_cpu_count_cmd = py3 + files('get-cpu-count.py')\n get_numa_count_cmd = py3 + files('get-numa-count.py')\n+get_test_suites_cmd = py3 + files('get-test-suites.py')\n+has_hugepages_cmd = py3 + files('has-hugepages.py')\n binutils_avx512_check = (py3 + files('binutils-avx512-check.py') +\n                         [objdump] + cc.cmd_array())\n \n",
    "prefixes": [
        "v3",
        "5/8"
    ]
}