get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2222496,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2222496/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260412111958.943933-9-sjg@chromium.org/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260412111958.943933-9-sjg@chromium.org>",
    "list_archive_url": null,
    "date": "2026-04-12T11:19:45",
    "name": "[v2,08/12] test: Add type-checked argument accessor functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "69ffd329cc61af995a485ca77588083f902971d3",
    "submitter": {
        "id": 6170,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/6170/?format=api",
        "name": "Simon Glass",
        "email": "sjg@chromium.org"
    },
    "delegate": {
        "id": 3651,
        "url": "http://patchwork.ozlabs.org/api/1.2/users/3651/?format=api",
        "username": "trini",
        "first_name": "Tom",
        "last_name": "Rini",
        "email": "trini@ti.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260412111958.943933-9-sjg@chromium.org/mbox/",
    "series": [
        {
            "id": 499596,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/499596/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=499596",
            "date": "2026-04-12T11:19:37",
            "name": "test: Add support for passing arguments to C unit tests",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/499596/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2222496/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2222496/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256\n header.s=google header.b=OpjdVFK4;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org\n header.b=\"OpjdVFK4\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=sjg@chromium.org"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4ftp9V0mcFz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 12 Apr 2026 21:25:02 +1000 (AEST)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id DF23F841CD;\n\tSun, 12 Apr 2026 13:24:27 +0200 (CEST)",
            "by phobos.denx.de (Postfix, from userid 109)\n id 04739839D5; Sun, 12 Apr 2026 13:24:27 +0200 (CEST)",
            "from mail-oa1-x31.google.com (mail-oa1-x31.google.com\n [IPv6:2001:4860:4864:20::31])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id B16BE841CD\n for <u-boot@lists.denx.de>; Sun, 12 Apr 2026 13:24:24 +0200 (CEST)",
            "by mail-oa1-x31.google.com with SMTP id\n 586e51a60fabf-40ef10ec84cso2403452fac.2\n for <u-boot@lists.denx.de>; Sun, 12 Apr 2026 04:24:24 -0700 (PDT)",
            "from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id\n 586e51a60fabf-423dd395606sm6622071fac.1.2026.04.12.04.24.20\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 12 Apr 2026 04:24:21 -0700 (PDT)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=chromium.org; s=google; t=1775993063; x=1776597863; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=TntcstSuO60GougXCwCwNigTK8sl/33dvalNsrtzqUw=;\n b=OpjdVFK4oVPsmZWzCTUzyrWtOGhBqbuReyreQ10OBOO3lVFdc4BMPvJGd4aiF+/5tH\n jIDwo1PXVeoyXs381LsV9JN8EM31+E+tClQ+CTsDao/IpgVmtiVw629m/5qa4F9fCeYO\n y1v+pxS26cArlPOXXE3dTgYiuk2n8Na3RLC6w=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775993063; x=1776597863;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=TntcstSuO60GougXCwCwNigTK8sl/33dvalNsrtzqUw=;\n b=C2K/z+9LZYV9L/GYbr3b0E2YV3Klv2sTjojd+xb1Kj95BHCoXg48cnNUF196tkUjza\n mPb5wLNmbJi2L0WEwjykfW6DaMGGIUZ6L4y+cvJn4VOgAGmx7Y7wCq3t6wBFEEGifDwE\n m0RvV66Z7Bm7qYwJFYFwn0f7w7Z6WiEdKCz+4DnuzTwuDXttVW6dP7iJPOp1LAOHpVwl\n Z5cYzxGpU85b7Kz7TVKVizVO5tKDkoN5xlHQqlDddMzLd+YzaLxdlNRTgNoQKfWvNFjQ\n ZoFkTqeiL3pnwP9GVb5RQm+O5Pf4iIBJUAJydZXcGFz+9FITDWJgKcjHXoGPawZhiKOK\n BqPw==",
        "X-Gm-Message-State": "AOJu0YyDt8puwFrdXXoK8LieoAaVSGb2HFGwNJcNVk+UFY/M3sWCr8IR\n BTWT9LK6e5DwODeg6sd6AAOQDz6n4wu4wCK6BEqAnHfmguuneU56R1O4CIu3f4aPjk0KncTs9os\n IsP4=",
        "X-Gm-Gg": "AeBDievNBF5EQa+diKBHRkAXGK5QC0MJqzcu5Hoz+Zo7q1nGtl8lPEJ3DoGuBjOt41S\n cv97yuk/lGJNBjhG8C1tLKM3bbFlLbq6Mdy6Wtr5ntLBzmrNoiTDC76K8vuGD2Es3f6uxsvOkTN\n FGiBNDg8vgkCxoQsPz3od6Nqh1d3qkys+rrTes1BG4XYkQh9sBBbfRvdzFENME57jbYcBU1Hq9e\n sL30MyL51+YUJSuP1yFChRQrUI7rUHgevxKFo+6Gjsn0yR1CYKze6/vMJFny0WnjpbnJ5PGcmcx\n DNcl3EZCV4fFgE1HQZEM+FEuGCsepo8KkFA+zEV8r1lGlkhpRaVoH7+AJCG62TLxZJVf9b46JOa\n xg81Sz8NUKpGtPN20eB+ypOtBUMPv+YtVob+v4SynWB4c0XuO1r0RFcfPprzeoAbtM3gpWG1+kc\n Iu99IgVy0FPlTCfoQBPNLclZJ7w9e4",
        "X-Received": "by 2002:a05:6871:7586:b0:3fa:aa1:5b1c with SMTP id\n 586e51a60fabf-423e113c1fcmr4979808fac.30.1775993062818;\n Sun, 12 Apr 2026 04:24:22 -0700 (PDT)",
        "From": "Simon Glass <sjg@chromium.org>",
        "To": "u-boot@lists.denx.de",
        "Cc": "Tom Rini <trini@konsulko.com>, Heinrich Schuchardt <xypron.glpk@gmx.de>,\n Simon Glass <sjg@chromium.org>,\n Andrew Goodbody <andrew.goodbody@linaro.org>",
        "Subject": "[PATCH v2 08/12] test: Add type-checked argument accessor functions",
        "Date": "Sun, 12 Apr 2026 05:19:45 -0600",
        "Message-ID": "<20260412111958.943933-9-sjg@chromium.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260412111958.943933-1-sjg@chromium.org>",
        "References": "<20260412111958.943933-1-sjg@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.39",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "Add ut_get_str(), ut_get_int(), and ut_get_bool() functions with\ncorresponding ut_str(), ut_int(), and ut_bool() macros for accessing\ntest arguments with type checking.\n\nThese functions check that the argument index is within bounds and the\ntype matches what was requested.\n\nThe first failure for a test is reported via ut_failf() which should\nmake it fairly easy to debug the test.\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\n(no changes since v1)\n\n include/test/test.h |  2 ++\n include/test/ut.h   | 50 ++++++++++++++++++++++++++++++++++\n test/test-main.c    |  1 +\n test/ut.c           | 66 +++++++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 119 insertions(+)",
    "diff": "diff --git a/include/test/test.h b/include/test/test.h\nindex bd47025ce50..f435d6f8c6a 100644\n--- a/include/test/test.h\n+++ b/include/test/test.h\n@@ -95,6 +95,7 @@ struct ut_arg {\n  * @priv: Private data for tests to use as needed\n  * @args: Parsed argument values for current test\n  * @arg_count: Number of parsed arguments\n+ * @arg_error: Set if ut_str/int/bool() detects a type mismatch\n  */\n struct unit_test_state {\n \tstruct ut_stats cur;\n@@ -123,6 +124,7 @@ struct unit_test_state {\n \tchar priv[UT_PRIV_SIZE];\n \tstruct ut_arg args[UT_MAX_ARGS];\n \tint arg_count;\n+\tbool arg_error;\n };\n \n /* Test flags for each test */\ndiff --git a/include/test/ut.h b/include/test/ut.h\nindex 1c4ee390fd8..6115711574c 100644\n--- a/include/test/ut.h\n+++ b/include/test/ut.h\n@@ -692,4 +692,54 @@ int ut_run_list(struct unit_test_state *uts, const char *category,\n  */\n void ut_report(struct ut_stats *stats, int run_count);\n \n+/**\n+ * ut_get_str() - Get a string test argument\n+ *\n+ * Fails the test if the argument type is not UT_ARG_STR.\n+ *\n+ * @uts: Test state\n+ * @n: Argument index\n+ * @file: Filename of caller\n+ * @line: Line number of caller\n+ * @func: Function name of caller\n+ * Return: String value, or NULL if type mismatch\n+ */\n+const char *ut_get_str(struct unit_test_state *uts, int n, const char *file,\n+\t\t       int line, const char *func);\n+\n+/**\n+ * ut_get_int() - Get an integer test argument\n+ *\n+ * Fails the test if the argument type is not UT_ARG_INT.\n+ *\n+ * @uts: Test state\n+ * @n: Argument index\n+ * @file: Filename of caller\n+ * @line: Line number of caller\n+ * @func: Function name of caller\n+ * Return: Integer value, or 0 if type mismatch\n+ */\n+long ut_get_int(struct unit_test_state *uts, int n, const char *file,\n+\t\tint line, const char *func);\n+\n+/**\n+ * ut_get_bool() - Get a boolean test argument\n+ *\n+ * Fails the test if the argument type is not UT_ARG_BOOL.\n+ *\n+ * @uts: Test state\n+ * @n: Argument index\n+ * @file: Filename of caller\n+ * @line: Line number of caller\n+ * @func: Function name of caller\n+ * Return: Boolean value, or false if type mismatch\n+ */\n+bool ut_get_bool(struct unit_test_state *uts, int n, const char *file,\n+\t\t int line, const char *func);\n+\n+/* Helpers for accessing test arguments with type checking */\n+#define ut_str(n)\tut_get_str(uts, n, __FILE__, __LINE__, __func__)\n+#define ut_int(n)\tut_get_int(uts, n, __FILE__, __LINE__, __func__)\n+#define ut_bool(n)\tut_get_bool(uts, n, __FILE__, __LINE__, __func__)\n+\n #endif\ndiff --git a/test/test-main.c b/test/test-main.c\nindex 9d8ab794db8..9fc4bca8e20 100644\n--- a/test/test-main.c\n+++ b/test/test-main.c\n@@ -636,6 +636,7 @@ static int ut_run_test(struct unit_test_state *uts, struct unit_test *test,\n \tif (ret)\n \t\treturn ret;\n \n+\tuts->arg_error = false;\n \tret = test->func(uts);\n \tif (ret == -EAGAIN)\n \t\tskip_test(uts);\ndiff --git a/test/ut.c b/test/ut.c\nindex b0cc0f3e8ff..a13e4825eac 100644\n--- a/test/ut.c\n+++ b/test/ut.c\n@@ -284,3 +284,69 @@ void ut_set_skip_delays(struct unit_test_state *uts, bool skip_delays)\n \tstate_set_skip_delays(skip_delays);\n #endif\n }\n+\n+const char *ut_get_str(struct unit_test_state *uts, int n, const char *file,\n+\t\t       int line, const char *func)\n+{\n+\tif (n < 0 || n >= uts->arg_count) {\n+\t\tif (!uts->arg_error)\n+\t\t\tut_failf(uts, file, line, func, \"ut_str() arg check\",\n+\t\t\t\t \"arg %d is invalid (arg_count=%d)\", n,\n+\t\t\t\t uts->arg_count);\n+\t\tuts->arg_error = true;\n+\t\treturn NULL;\n+\t}\n+\tif (uts->args[n].type != UT_ARG_STR) {\n+\t\tif (!uts->arg_error)\n+\t\t\tut_failf(uts, file, line, func, \"ut_str() type check\",\n+\t\t\t\t \"arg %d is not a string\", n);\n+\t\tuts->arg_error = true;\n+\t\treturn NULL;\n+\t}\n+\n+\treturn uts->args[n].vstr;\n+}\n+\n+long ut_get_int(struct unit_test_state *uts, int n, const char *file,\n+\t\tint line, const char *func)\n+{\n+\tif (n < 0 || n >= uts->arg_count) {\n+\t\tif (!uts->arg_error)\n+\t\t\tut_failf(uts, file, line, func, \"ut_int() arg check\",\n+\t\t\t\t \"arg %d is invalid (arg_count=%d)\", n,\n+\t\t\t\t uts->arg_count);\n+\t\tuts->arg_error = true;\n+\t\treturn 0;\n+\t}\n+\tif (uts->args[n].type != UT_ARG_INT) {\n+\t\tif (!uts->arg_error)\n+\t\t\tut_failf(uts, file, line, func, \"ut_int() type check\",\n+\t\t\t\t \"arg %d is not an int\", n);\n+\t\tuts->arg_error = true;\n+\t\treturn 0;\n+\t}\n+\n+\treturn uts->args[n].vint;\n+}\n+\n+bool ut_get_bool(struct unit_test_state *uts, int n, const char *file,\n+\t\t int line, const char *func)\n+{\n+\tif (n < 0 || n >= uts->arg_count) {\n+\t\tif (!uts->arg_error)\n+\t\t\tut_failf(uts, file, line, func, \"ut_bool() arg check\",\n+\t\t\t\t \"arg %d is invalid (arg_count=%d)\", n,\n+\t\t\t\t uts->arg_count);\n+\t\tuts->arg_error = true;\n+\t\treturn false;\n+\t}\n+\tif (uts->args[n].type != UT_ARG_BOOL) {\n+\t\tif (!uts->arg_error)\n+\t\t\tut_failf(uts, file, line, func, \"ut_bool() type check\",\n+\t\t\t\t \"arg %d is not a bool\", n);\n+\t\tuts->arg_error = true;\n+\t\treturn false;\n+\t}\n+\n+\treturn uts->args[n].vbool;\n+}\n",
    "prefixes": [
        "v2",
        "08/12"
    ]
}