[PATCH v3 5/5] test: dm: Add partition type GUID lookup test
Simon Glass
sjg at chromium.org
Mon Apr 20 03:18:16 CEST 2026
Hi Balaji,
On 2026-04-19T10:24:02, Balaji Selvanathan
<balaji.selvanathan at oss.qualcomm.com> wrote:
> test: dm: Add partition type GUID lookup test
>
> 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 at oss.qualcomm.com>
>
> test/dm/part.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 48 insertions(+)
> diff --git a/test/dm/part.c b/test/dm/part.c
> @@ -195,3 +199,47 @@ static int dm_test_part_get_info_by_type(struct unit_test_state *uts)
> + if (!IS_ENABLED(CONFIG_PARTITION_TYPE_GUID))
> + return -EOPNOTSUPP;
Please can you return -EAGAIN instead? The test framework uses -EAGAIN
to indicate a test should be skipped (see test-main.c lines 486 and
492). Returning -EOPNOTSUPP will cause the test to fail rather than
skip when the config is not enabled.
> diff --git a/test/dm/part.c b/test/dm/part.c
> @@ -195,3 +199,47 @@ static int dm_test_part_get_info_by_type(struct unit_test_state *uts)
> + partnum = part_get_info_by_type_guid(desc,
> + "FE3A2A5D-4F32-41A7-B725-ACCC3285A309",
> + &info);
> + ut_assert(partnum > 0);
How about ut_asserteq(2, partnum) here, since the first ChromeOS
kernel partition (KERN_A) is at partition 2 in the test image. This
makes the test more precise and would catch regressions if the search
order changes. Alternatively, you could verify the partition name
using:
ut_asserteq_str("KERN_A", info.name)
Reviewed-by: Simon Glass <sjg at chromium.org>
Regards,
Simon
More information about the U-Boot
mailing list