From: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
To: u-boot@lists.denx.de, Sumit Garg <sumit.garg@kernel.org>,
u-boot-qcom@groups.io
Cc: "Tom Rini" <trini@konsulko.com>,
"Quentin Schulz" <quentin.schulz@cherry.de>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
"Javier Tia" <javier.tia@linaro.org>,
"Varadarajan Narayanan" <quic_varada@quicinc.com>,
"Rasmus Villemoes" <ravi@prevas.dk>,
"Mikhail Kshevetskiy" <mikhail.kshevetskiy@iopsys.eu>,
"Javier Martinez Canillas" <javierm@redhat.com>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
"João Marcos Costa" <joaomarcos.costa@bootlin.com>,
"Tien Fong Chee" <tien.fong.chee@altera.com>,
"Richard Genoud" <richard.genoud@bootlin.com>,
"Jan Kiszka" <jan.kiszka@siemens.com>,
"David Lechner" <dlechner@baylibre.com>,
"Casey Connolly" <casey.connolly@linaro.org>,
"Simon Glass" <simon.glass@canonical.com>,
"Marek Vasut" <marek.vasut+renesas@mailbox.org>,
"Christian Marangi" <ansuelsmth@gmail.com>,
"Michael Walle" <mwalle@kernel.org>,
"Sumit Garg" <sumit.garg@oss.qualcomm.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Aswin Murugan" <aswin.murugan@oss.qualcomm.com>,
"Varadarajan Narayanan" <varadarajan.narayanan@oss.qualcomm.com>,
"Simon Glass" <sjg@chromium.org>,
"Mattijs Korpershoek" <mkorpershoek@kernel.org>,
"Jerome Forissier" <jerome.forissier@arm.com>,
"Balaji Selvanathan" <balaji.selvanathan@oss.qualcomm.com>
Subject: [PATCH v3 5/5] test: dm: Add partition type GUID lookup test
Date: Sun, 19 Apr 2026 15:54:07 +0530 [thread overview]
Message-ID: <20260419-type-v3-5-ec49acd6870e@oss.qualcomm.com> (raw)
In-Reply-To: <20260419-type-v3-0-ec49acd6870e@oss.qualcomm.com>
Add a unit test for the partition type GUID lookup functionality. The
test verifies that partitions can be correctly identified by their type
GUID, specifically testing the ChromeOS kernel partition lookup.
Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
---
Changes in v3:
- Add unit test for the partition type GUID lookup functionality
---
test/dm/part.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/test/dm/part.c b/test/dm/part.c
index caae23bd4aa..41fb6efe5e4 100644
--- a/test/dm/part.c
+++ b/test/dm/part.c
@@ -8,9 +8,13 @@
#include <mmc.h>
#include <part.h>
#include <part_efi.h>
+#include <asm/global_data.h>
+#include <dm/lists.h>
#include <dm/test.h>
#include <test/ut.h>
+DECLARE_GLOBAL_DATA_PTR;
+
static int do_test(struct unit_test_state *uts, int expected,
const char *part_str, bool whole)
{
@@ -195,3 +199,47 @@ static int dm_test_part_get_info_by_type(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_part_get_info_by_type, UTF_SCAN_PDATA | UTF_SCAN_FDT);
+
+static int dm_test_part_get_info_by_type_guid(struct unit_test_state *uts)
+{
+ struct udevice *dev, *blk_dev;
+ struct blk_desc *desc;
+ struct disk_partition info;
+ ofnode root, node;
+ int partnum;
+
+ if (!IS_ENABLED(CONFIG_PARTITION_TYPE_GUID))
+ return -EOPNOTSUPP;
+
+ /* Bind the mmc5 node (ChromeOS image with type GUIDs) */
+ root = oftree_root(oftree_default());
+ node = ofnode_find_subnode(root, "mmc5");
+ ut_assert(ofnode_valid(node));
+ ut_assertok(lists_bind_fdt(gd->dm_root, node, &dev, NULL, false));
+
+ /* Get the MMC device (probes it), then walk MMC -> BLK parent link */
+ ut_assertok(uclass_get_device_by_seq(UCLASS_MMC, 5, &dev));
+ ut_assertok(blk_get_from_parent(dev, &blk_dev));
+ desc = dev_get_uclass_plat(blk_dev);
+ ut_assert(desc);
+
+ /*
+ * Test: look up the first ChromeOS kernel partition by type GUID.
+ * In the ChromeOS image KERN_A is the first partition carrying the
+ * ChromeOS kernel type GUID (fe3a2a5d-...).
+ */
+ partnum = part_get_info_by_type_guid(desc,
+ "FE3A2A5D-4F32-41A7-B725-ACCC3285A309",
+ &info);
+ ut_assert(partnum > 0);
+
+ /* Test: non-existent GUID must return -ENOENT */
+ ut_asserteq(-ENOENT,
+ part_get_info_by_type_guid(desc,
+ "00000000-0000-0000-0000-000000000000",
+ &info));
+
+ return 0;
+}
+
+DM_TEST(dm_test_part_get_info_by_type_guid, UTF_SCAN_PDATA | UTF_SCAN_FDT);
--
2.34.1
prev parent reply other threads:[~2026-04-19 10:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-19 10:24 [PATCH v3 0/5] Add partition type GUID support for environment Balaji Selvanathan
2026-04-19 10:24 ` [PATCH v3 1/5] disk: Add partition lookup by type GUID functionality Balaji Selvanathan
2026-04-19 10:24 ` [PATCH v3 2/5] scsi: Add partition lookup by type GUID for SCSI devices Balaji Selvanathan
2026-04-19 10:24 ` [PATCH v3 3/5] env: scsi: Add support for partition type GUID based environment Balaji Selvanathan
2026-04-19 10:24 ` [PATCH v3 4/5] configs: Enable partition type GUID for QCM6490 and QCS615 boards Balaji Selvanathan
2026-04-19 10:24 ` Balaji Selvanathan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260419-type-v3-5-ec49acd6870e@oss.qualcomm.com \
--to=balaji.selvanathan@oss.qualcomm.com \
--cc=ansuelsmth@gmail.com \
--cc=aswin.murugan@oss.qualcomm.com \
--cc=casey.connolly@linaro.org \
--cc=dlechner@baylibre.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jan.kiszka@siemens.com \
--cc=javier.tia@linaro.org \
--cc=javierm@redhat.com \
--cc=jerome.forissier@arm.com \
--cc=joaomarcos.costa@bootlin.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=mikhail.kshevetskiy@iopsys.eu \
--cc=miquel.raynal@bootlin.com \
--cc=mkorpershoek@kernel.org \
--cc=mwalle@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=quentin.schulz@cherry.de \
--cc=quic_varada@quicinc.com \
--cc=ravi@prevas.dk \
--cc=richard.genoud@bootlin.com \
--cc=simon.glass@canonical.com \
--cc=sjg@chromium.org \
--cc=sumit.garg@kernel.org \
--cc=sumit.garg@oss.qualcomm.com \
--cc=tien.fong.chee@altera.com \
--cc=trini@konsulko.com \
--cc=u-boot-qcom@groups.io \
--cc=u-boot@lists.denx.de \
--cc=varadarajan.narayanan@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox