Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2228504/?format=api
{ "id": 2228504, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2228504/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260426153617.2039651-4-dario.binacchi@amarulasolutions.com/", "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": "<20260426153617.2039651-4-dario.binacchi@amarulasolutions.com>", "list_archive_url": null, "date": "2026-04-26T15:35:28", "name": "[v5,3/8] test: cmd: add unit tests for part command", "commit_ref": null, "pull_url": null, "state": "needs-review-ack", "archived": true, "hash": "e7817ee5ee678d70bbca5b52ddcd25491374cb49", "submitter": { "id": 83038, "url": "http://patchwork.ozlabs.org/api/1.2/people/83038/?format=api", "name": "Dario Binacchi", "email": "dario.binacchi@amarulasolutions.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260426153617.2039651-4-dario.binacchi@amarulasolutions.com/mbox/", "series": [ { "id": 501544, "url": "http://patchwork.ozlabs.org/api/1.2/series/501544/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=501544", "date": "2026-04-26T15:35:25", "name": "Support metadata-driven A/B boot for STM32MP25", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/501544/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2228504/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2228504/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=amarulasolutions.com header.i=@amarulasolutions.com\n header.a=rsa-sha256 header.s=google header.b=dfCEcckP;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; 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=amarulasolutions.com", "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=amarulasolutions.com header.i=@amarulasolutions.com\n header.b=\"dfCEcckP\";\n\tdkim-atps=neutral", "phobos.denx.de; dmarc=pass (p=none dis=none)\n header.from=amarulasolutions.com", "phobos.denx.de; spf=pass\n smtp.mailfrom=dario.binacchi@amarulasolutions.com" ], "Received": [ "from phobos.denx.de (phobos.denx.de\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g3W5f0bDzz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 01:36:54 +1000 (AEST)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id E07DC839D9;\n\tSun, 26 Apr 2026 17:36:30 +0200 (CEST)", "by phobos.denx.de (Postfix, from userid 109)\n id 5E25F84105; Sun, 26 Apr 2026 17:36:28 +0200 (CEST)", "from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n [IPv6:2a00:1450:4864:20::329])\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 4B8F484099\n for <u-boot@lists.denx.de>; Sun, 26 Apr 2026 17:36:26 +0200 (CEST)", "by mail-wm1-x329.google.com with SMTP id\n 5b1f17b1804b1-4891c00e7aeso67451055e9.2\n for <u-boot@lists.denx.de>; Sun, 26 Apr 2026 08:36:26 -0700 (PDT)", "from dario-ThinkPad-P14s-Gen-5.amarulasolutions.com\n (host-82-56-22-134.retail.telecomitalia.it. [82.56.22.134])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48a5499b0edsm388438845e9.14.2026.04.26.08.36.24\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 26 Apr 2026 08:36:24 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,\n SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=amarulasolutions.com; s=google; t=1777217785; x=1777822585;\n 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=hw9GLngKjgFma/Ds2VDGbYsokmFxr4udRFfMO00ab54=;\n b=dfCEcckPCUslanF2mi73jPQ7/52ROHQsotSdBIrrJAPBF6H7/7GXTVi+dG2ZDSoRp9\n gcrroBoUp8UGRva98eDneUi0BEBxz1bO0Fpzn4RylUsFbbD0tfEV6PV1y1QD8LzqGF69\n r/pD+JHBuqdd8lephMXu/gqsEFyrp2ELiTpXk=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777217785; x=1777822585;\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=hw9GLngKjgFma/Ds2VDGbYsokmFxr4udRFfMO00ab54=;\n b=i+wo4Ut0dekMkKFYxE1m97TDexqdMqb8QVYs09EnhIgzs1IJhC0k7iIQBlKxf6BKxQ\n hMHBMeJkghSDVrSdnioB6/toLucNS9oDem92l4vfOiOYLubhkaHezYBQfFIpOtmtobJV\n 2XvN7x8s2PZ6+pKRDYjhrMyJNpdjlJ04mUYUcNROE+l3qfG5adrVwwDVwfHhtMft1F5g\n t21xOSTbFgP3++0EPWUJKPgkhFhF8l/NiU30ITyCW2iWHIIsTULXCHksr+uyyUCQwRC7\n S/BaveoEhfJs4dpLXOMUDRm/TDyGzxCwNwHeAUG5bY5d+XA1uOwRx4VKXudns2ijqbMn\n izQg==", "X-Gm-Message-State": "AOJu0YwcSa4vh8CbQ0sKIuAwomjB0uSyVUCvRiOsZOJnw92/FP7JJQ8v\n YKkMaYAKf/Sz1BDQQvDm9EfWMnRHJBiZTDdF+6FkR8TnYFpzs96WqxScGozHC8taON6Googj+NY\n 37AO8", "X-Gm-Gg": "AeBDieuAr4KUjTXY6w6VYUkLHyErRu2jTTDZ7nV5DbmEoo7BmN0mh/tP2i5SDbVpWE/\n cVoOT7hGFlVWdVH8rJ8hPcsZvXwdIdZzz36zGaQHndX6jTsWF175pY38VZFAtR7+9UxVq/FyudT\n RtFxx+5ziiaqE7wgJkJt35ZMXj/qFcsw+ftdRVfQZBDFQFKDFDj9/xocD6rvDnAcxQqoSWpVjz3\n 3eveTpFfqBZ9nVvMwqVRnhZBveUIE/nrcm2yiL8CL2no5Ui42hZY7xDWGkpNiMHYg5SzqPaxjDl\n Jm0LRHHVpaH2sEoPnc6rNUpCHQbJ74HQ9kx0n4XQRlGhKIqyzwCeuNFSmV697PDQ0ZWirPiVwv1\n F0eJHovIgaRzq+1B7+68MJaS8mhEQw2eoO5Q9s84Dqjot6DkC0d9P3J3PiK5BMwc3/0VemB5jWl\n wsUKWFxq23N7LEpcQ7okSHvNuJq2NUD/77+PNK04aoJJ5b2lKA/JfZd+h2Wej8+x1saCkMjoS7x\n Vivbyt/jWXR+elCVPpml0p3B+IB4s2TIKnnQfyawQVj5FfqF+FD6oZdxUXJg/vO+Jk79NT2PypJ\n KEgGVIUGx0OUvaaXsEK8omTZ0t6ifQ==", "X-Received": "by 2002:a05:600c:4707:b0:488:bfc3:efc with SMTP id\n 5b1f17b1804b1-488fb6e8eb5mr550713775e9.0.1777217785396;\n Sun, 26 Apr 2026 08:36:25 -0700 (PDT)", "From": "Dario Binacchi <dario.binacchi@amarulasolutions.com>", "To": "u-boot@lists.denx.de", "Cc": "linux-amarula@amarulasolutions.com,\n Dario Binacchi <dario.binacchi@amarulasolutions.com>,\n Dinesh Maniyam <dinesh.maniyam@altera.com>,\n Heinrich Schuchardt <xypron.glpk@gmx.de>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>,\n Mattijs Korpershoek <mkorpershoek@kernel.org>,\n Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>", "Subject": "[PATCH v5 3/8] test: cmd: add unit tests for part command", "Date": "Sun, 26 Apr 2026 17:35:28 +0200", "Message-ID": "<20260426153617.2039651-4-dario.binacchi@amarulasolutions.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260426153617.2039651-1-dario.binacchi@amarulasolutions.com>", "References": "<20260426153617.2039651-1-dario.binacchi@amarulasolutions.com>", "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 unit tests for the 'part' command, specifically for the 'number',\n'start', and 'size' subcommands.\n\nThese tests establish a baseline for the current partition lookup\nfunctionality by name. This foundation will be used by subsequent\npatches to extend the command, ensuring consistent behavior as new\nfeatures are introduced.\n\nSigned-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>\n\n---\n\n(no changes since v4)\n\nChanges in v4:\n- Place the part command tests in the cmd suite rather than the dm\n suite.\n- Order the include files according the U-Boot coding style.\n\nChanges in v3:\n- Wrap the lines exceeding 80 columns\n- Combine run_command() and ut_asserteq() -> ut_asserteq(1, run_command(\n\n test/cmd/Makefile | 1 +\n test/cmd/part.c | 165 ++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 166 insertions(+)\n create mode 100644 test/cmd/part.c", "diff": "diff --git a/test/cmd/Makefile b/test/cmd/Makefile\nindex 8c9f112782d0..41fe21a4541e 100644\n--- a/test/cmd/Makefile\n+++ b/test/cmd/Makefile\n@@ -26,6 +26,7 @@ obj-$(CONFIG_CMD_LOADM) += loadm.o\n obj-$(CONFIG_CMD_MEMINFO) += meminfo.o\n obj-$(CONFIG_CMD_MEMORY) += mem_copy.o\n obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o\n+obj-$(CONFIG_CMD_PART) += part.o\n ifdef CONFIG_CMD_PCI\n obj-$(CONFIG_CMD_PCI_MPS) += pci_mps.o\n endif\ndiff --git a/test/cmd/part.c b/test/cmd/part.c\nnew file mode 100644\nindex 000000000000..5751dd315dd8\n--- /dev/null\n+++ b/test/cmd/part.c\n@@ -0,0 +1,165 @@\n+// SPDX-License-Identifier: GPL-2.0+\n+/*\n+ * Test for part command\n+ *\n+ * Copyright (C) 2026 Amarula Solutions\n+ * Written by Dario Binacchi <dario.binacchi@amarulasolutions.com>\n+ */\n+\n+#include <command.h>\n+#include <dm.h>\n+#include <env.h>\n+#include <part.h>\n+#include <vsprintf.h>\n+#include <dm/test.h>\n+#include <test/cmd.h>\n+#include <test/test.h>\n+#include <test/ut.h>\n+\n+static struct disk_partition gpt_parts[] = {\n+\t{\n+\t\t.start = 48,\n+\t\t.size = 1,\n+\t\t.name = \"test1\",\n+\t\t.uuid = \"c5bce7a2-03f0-4d03-9048-01ff23b9d527\",\n+\t},\n+\t{\n+\t\t.start = 49,\n+\t\t.size = 2,\n+\t\t.name = \"test2\",\n+\t\t.uuid = \"9df346e8-2c53-4cd8-b9ac-3af83f9a9b74\",\n+\t},\n+};\n+\n+static char disk_guid[UUID_STR_LEN + 1] =\n+\t\"8d60b397-1bb6-4d33-80ee-b1587d24c2f8\";\n+\n+static int setup_gpt_partitions(struct unit_test_state *uts,\n+\t\t\t\tunsigned int mmc_dev_num)\n+{\n+\tstruct blk_desc *mmc_dev_desc;\n+\tchar dev_str[10];\n+\tint i;\n+\n+\tsnprintf(dev_str, sizeof(dev_str), \"%u\", mmc_dev_num);\n+\n+\tut_asserteq(mmc_dev_num, blk_get_device_by_str(\"mmc\", dev_str,\n+\t\t\t\t\t\t &mmc_dev_desc));\n+\n+\tif (CONFIG_IS_ENABLED(RANDOM_UUID)) {\n+\t\tfor (i = 0; i < ARRAY_SIZE(gpt_parts); i++)\n+\t\t\tgen_rand_uuid_str(gpt_parts[i].uuid,\n+\t\t\t\t\t UUID_STR_FORMAT_STD);\n+\n+\t\tgen_rand_uuid_str(disk_guid, UUID_STR_FORMAT_STD);\n+\t}\n+\n+\tut_assertok(gpt_restore(mmc_dev_desc, disk_guid, gpt_parts,\n+\t\t\t\tARRAY_SIZE(gpt_parts)));\n+\treturn 0;\n+}\n+\n+static int cmd_test_part_number(struct unit_test_state *uts)\n+{\n+\tunsigned int mmc_dev_num = 2;\n+\tchar expected[10];\n+\tint i;\n+\n+\tut_assertok(setup_gpt_partitions(uts, mmc_dev_num));\n+\n+\tfor (i = 0; i < ARRAY_SIZE(gpt_parts); i++) {\n+\t\tenv_set(\"partnum\", NULL);\n+\t\tut_assertok(run_commandf(\"part number mmc %u %s partnum\",\n+\t\t\t\t\t mmc_dev_num, gpt_parts[i].name));\n+\t\tsnprintf(expected, sizeof(expected), \"0x%x\", i + 1);\n+\t\tut_asserteq_str(expected, env_get(\"partnum\"));\n+\t}\n+\n+\tenv_set(\"partnum\", NULL);\n+\tut_asserteq(1, run_commandf(\"part number mmc %u bogus partnum\",\n+\t\t\t\t mmc_dev_num));\n+\tut_assertnull(env_get(\"partnum\"));\n+\n+\treturn 0;\n+}\n+CMD_TEST(cmd_test_part_number, UTF_CONSOLE);\n+\n+static int cmd_test_part_start(struct unit_test_state *uts)\n+{\n+\tunsigned int mmc_dev_num = 2;\n+\tchar expected[32];\n+\tint i;\n+\n+\tut_assertok(setup_gpt_partitions(uts, mmc_dev_num));\n+\n+\tfor (i = 0; i < ARRAY_SIZE(gpt_parts); i++) {\n+\t\tenv_set(\"partstart\", NULL);\n+\t\tut_assertok(run_commandf(\"part start mmc %u %d partstart\",\n+\t\t\t\t\t mmc_dev_num, i + 1));\n+\t\tsnprintf(expected, sizeof(expected), \"%lx\",\n+\t\t\t (unsigned long)gpt_parts[i].start);\n+\t\tut_asserteq_str(expected, env_get(\"partstart\"));\n+\t}\n+\n+\tenv_set(\"partstart\", NULL);\n+\tut_asserteq(1, run_commandf(\"part start mmc %u 3 partstart\",\n+\t\t\t\t mmc_dev_num));\n+\tut_assertnull(env_get(\"partstart\"));\n+\n+\tfor (i = 0; i < ARRAY_SIZE(gpt_parts); i++) {\n+\t\tenv_set(\"partstart\", NULL);\n+\t\tut_assertok(run_commandf(\"part start mmc %u %s partstart\",\n+\t\t\t\t\t mmc_dev_num, gpt_parts[i].name));\n+\t\tsnprintf(expected, sizeof(expected), \"%lx\",\n+\t\t\t (unsigned long)gpt_parts[i].start);\n+\t\tut_asserteq_str(expected, env_get(\"partstart\"));\n+\t}\n+\n+\tenv_set(\"partstart\", NULL);\n+\tut_asserteq(1, run_commandf(\"part start mmc %u bogus partstart\",\n+\t\t\t\t mmc_dev_num));\n+\tut_assertnull(env_get(\"partstart\"));\n+\n+\treturn 0;\n+}\n+CMD_TEST(cmd_test_part_start, UTF_CONSOLE);\n+\n+static int cmd_test_part_size(struct unit_test_state *uts)\n+{\n+\tunsigned int mmc_dev_num = 2;\n+\tchar expected[32];\n+\tint i;\n+\n+\tut_assertok(setup_gpt_partitions(uts, mmc_dev_num));\n+\n+\tfor (i = 0; i < ARRAY_SIZE(gpt_parts); i++) {\n+\t\tenv_set(\"partsize\", NULL);\n+\t\tut_assertok(run_commandf(\"part size mmc %u %d partsize\",\n+\t\t\t\t\t mmc_dev_num, i + 1));\n+\t\tsnprintf(expected, sizeof(expected), \"%lx\",\n+\t\t\t (unsigned long)gpt_parts[i].size);\n+\t\tut_asserteq_str(expected, env_get(\"partsize\"));\n+\t}\n+\n+\tenv_set(\"partsize\", NULL);\n+\tut_asserteq(1, run_commandf(\"part size mmc %u 3 partsize\",\n+\t\t\t\t mmc_dev_num));\n+\tut_assertnull(env_get(\"partsize\"));\n+\n+\tfor (i = 0; i < ARRAY_SIZE(gpt_parts); i++) {\n+\t\tenv_set(\"partsize\", NULL);\n+\t\tut_assertok(run_commandf(\"part size mmc %u %s partsize\",\n+\t\t\t\t\t mmc_dev_num, gpt_parts[i].name));\n+\t\tsnprintf(expected, sizeof(expected), \"%lx\",\n+\t\t\t (unsigned long)gpt_parts[i].size);\n+\t\tut_asserteq_str(expected, env_get(\"partsize\"));\n+\t}\n+\n+\tenv_set(\"partsize\", NULL);\n+\tut_asserteq(1, run_commandf(\"part size mmc %u bogus partsize\",\n+\t\t\t\t mmc_dev_num));\n+\tut_assertnull(env_get(\"partsize\"));\n+\n+\treturn 0;\n+}\n+CMD_TEST(cmd_test_part_size, UTF_CONSOLE);\n", "prefixes": [ "v5", "3/8" ] }