Hi Frieder,

On 2026-10-27T14:16:39+11:00, Frieder Schrempf <[email protected]> wrote:
> test: blk: Check that partition devices are unbound on remove
>
> Add a test that removes and probes a block device with a GPT several
> times and checks that its partition devices are unbound on remove and
> bound again only once on probe. Also remove the block device with the
> flags used before booting an OS, which don't match the partition
> driver.
>
> Assisted-by: LLM
> Signed-off-by: Frieder Schrempf <[email protected]>
>
>  test/dm/blk.c | 64 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 64 insertions(+)

> diff --git a/test/dm/blk.c b/test/dm/blk.c
> @@ -291,3 +292,66 @@ static int dm_test_blk_foreach(struct unit_test_state 
> *uts)
> +     /*
> +      * Removing only the active devices, as done before booting an OS,
> +      * removes the block device but doesn't match the partition driver
> +      */
> +     ut_assertok(device_remove(blk, DM_REMOVE_ACTIVE_ALL));
> +     ut_assert(!device_active(blk));
> +     ut_asserteq(0, count_part_devs(blk));

The test passes on sandbox, but I'm not sure this part tests what the
comment says. As mentioned on patch 1, once 'mmc_blk' matches
DM_FLAG_OS_PREPARE, device_remove() calls device_chld_remove() with
'flags & ~DM_REMOVE_ACTIVE_ALL' (i.e. 0), so the partition devices are
removed before blk_pre_remove() runs. This part of the test would pass
without the device_chld_remove() call in patch 1. Please can you
update the comment and the commit message to match?

Regards,
Simon

Reply via email to