get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2222462,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2222462/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260412013451.2929001-9-sjg@chromium.org/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/1.1/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
    },
    "msgid": "<20260412013451.2929001-9-sjg@chromium.org>",
    "date": "2026-04-12T01:34:36",
    "name": "[08/12] test: Add type-checked argument accessor functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "69ffd329cc61af995a485ca77588083f902971d3",
    "submitter": {
        "id": 6170,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/6170/?format=api",
        "name": "Simon Glass",
        "email": "sjg@chromium.org"
    },
    "delegate": {
        "id": 3184,
        "url": "http://patchwork.ozlabs.org/api/1.1/users/3184/?format=api",
        "username": "sjg",
        "first_name": "Simon",
        "last_name": "Glass",
        "email": "sjg@chromium.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260412013451.2929001-9-sjg@chromium.org/mbox/",
    "series": [
        {
            "id": 499582,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/499582/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=499582",
            "date": "2026-04-12T01:34:28",
            "name": "test: Add support for passing arguments to C unit tests",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/499582/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2222462/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2222462/checks/",
    "tags": {},
    "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=i57ciLkN;\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=\"i57ciLkN\";\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 4ftY6H4jl5z1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 12 Apr 2026 11:36:23 +1000 (AEST)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 9ECEC8423E;\n\tSun, 12 Apr 2026 03:35:46 +0200 (CEST)",
            "by phobos.denx.de (Postfix, from userid 109)\n id 3280784228; Sun, 12 Apr 2026 03:35:44 +0200 (CEST)",
            "from mail-ot1-x333.google.com (mail-ot1-x333.google.com\n [IPv6:2607:f8b0:4864:20::333])\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 5365D84119\n for <u-boot@lists.denx.de>; Sun, 12 Apr 2026 03:35:40 +0200 (CEST)",
            "by mail-ot1-x333.google.com with SMTP id\n 46e09a7af769-7d9bba96f7dso1758442a34.1\n for <u-boot@lists.denx.de>; Sat, 11 Apr 2026 18:35:40 -0700 (PDT)",
            "from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id\n 46e09a7af769-7dc2d1aca3asm4242826a34.6.2026.04.11.18.35.30\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 11 Apr 2026 18:35:30 -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=1775957737; x=1776562537; 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=zt2N+wp3Hs5kTRDQsJEthMcS45mGIUKbolsmUpj/Nc8=;\n b=i57ciLkNt25NeK9gT1yGdGHzghMN13j9ZxwWuaAkeNnNS3CbWqt/0WHrX0EaxHVxoU\n Ii9CPTU1Rsuud+9BECLFHnm01EUYXLVQ00/pStIZRelOcSl5+0f8lXGT05LOU7C92WWG\n ynMqCH2h6uPqLa8MAgURHMXbQpi7YXiGxOg4E=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775957737; x=1776562537;\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=zt2N+wp3Hs5kTRDQsJEthMcS45mGIUKbolsmUpj/Nc8=;\n b=KTQDUWwPosMQFiVWVtu0I7zl2Yf7vardS5UU4xR/WjH3+1k5JBGtn07qVJY27MgGjt\n XRODpSlV0eIty96n6n2edMN5UFAhN3oJsrHEWpLiPcwisXdglTgZD7LStO5GviYX8+x6\n eJKIoKw0t45oADvVyCHm0zGv6ucvb9zF2sxOujXqen+A2TE3NXoCX0X25iY/QFDE2Reo\n YHxfJND6KQ9gBkCyDEej/+Fg/TkBuuRwJcPW1u2zMMsEn7Dmt7VBwO+WbIQi59FiHbZl\n Ade0Dj+meo653c5fC4PbxG8/2GZIP0z+0huohElq/QkzdtqQfbhdMs2MaefWIiYRwcdk\n joYg==",
        "X-Gm-Message-State": "AOJu0YzQ3/4H4Lx5F+qtoV8+x73z5IC5UEePasMvkDcjw/odraQNPNsy\n qRuDSYwnPozsvvenvb89u9XgeiQse3/8vmwzq14k54zMOEGOfDr2r0l/D5WqysAtigIehTZ1jSO\n qZvfnIg==",
        "X-Gm-Gg": "AeBDievxCBUV8MIXmHD1Umi0SuCN85s8xboQaXHiXzcYol4zt/3TY10mRMMlZ0Qb1HS\n rBMlJavLcaGkgrlwZwqKYgecCQnm/zUMuoUefoXjEAaR0bwahnjL6xclftuCn2//bhwexzO9PDn\n 2PvJTXqW1ampTuCaLpyuV8jsnVhgGwCEUbLGMLU3iMAqD8HvRMHZVAwUcJrWtq93v7Ido1DSuus\n Fjc0DfmxEAsVz9bAgRmZa9ZjaYAuaJVaLsOGoVksJLhnIcZGFw0UIzB8PlSdnqN8ruq3DiWIyT/\n AWHfWs6T/+u/O/3NrRQzwrJ5SnWCW/UgpBndnjfDlRQ55DCyHNaRsAoUniuFnoxKOyM7le1FWrD\n l6CDqsLpgXH7PoLdmy5WQjkPeoTjzS5/zSmvnfYahcD03llEDpvbxSjDiN0OThaBueh3xaJw0vo\n NdwrJnVl7JUGvu3QM8nA==",
        "X-Received": "by 2002:a05:6830:f96:b0:7d7:d54c:5b53 with SMTP id\n 46e09a7af769-7dc27e6d91amr4755692a34.29.1775957736964;\n Sat, 11 Apr 2026 18:35:36 -0700 (PDT)",
        "From": "Simon Glass <sjg@chromium.org>",
        "To": "u-boot@lists.denx.de",
        "Cc": "Heinrich Schuchardt <xypron.glpk@gmx.de>, Tom Rini <trini@konsulko.com>,\n Simon Glass <simon.glass@canonical.com>, Simon Glass <sjg@chromium.org>,\n Andrew Goodbody <andrew.goodbody@linaro.org>",
        "Subject": "[PATCH 08/12] test: Add type-checked argument accessor functions",
        "Date": "Sat, 11 Apr 2026 19:34:36 -0600",
        "Message-ID": "<20260412013451.2929001-9-sjg@chromium.org>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20260412013451.2929001-1-sjg@chromium.org>",
        "References": "<20260412013451.2929001-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": "From: Simon Glass <simon.glass@canonical.com>\n\nAdd 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 <simon.glass@canonical.com>\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\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": [
        "08/12"
    ]
}