Re: [PATCH 5/6] test: py: gpt: Bind the disk image in test_gpt_write_part_type()
Alexey Charkov <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <CAKTNdwF6p-to_zwXfwO17GL8SP6q8BsSb5g69O6_aW8hz8TSjA@mail.gmail.com> |
On Wed, Aug 26, 2026 at 1:41 AM Heinrich Schuchardt <[email protected]> wrote: > > On 7/31/26 14:40, Alexey Charkov wrote: > > Unlike every other test in this file, test_gpt_write_part_type() never > > binds the disk image it operates on. It has worked since it was added > > only because some test that ran before it left host 0 bound to the > > image this fixture provides. > > > > That breaks as soon as a test which binds something else is added > > above it, and it means the test silently depends on collection order > > rather than on its own fixture. Bind the image like the other tests do. > > > > Fixes: 7a598e633a53 ("test/py: tests: gpt: add test_gpt_write_part_type") > > Signed-off-by: Alexey Charkov <[email protected]> > > --- > > test/py/tests/test_gpt.py | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py > > index e6d8792ac1fc..fb4c8ba67d48 100644 > > --- a/test/py/tests/test_gpt.py > > +++ b/test/py/tests/test_gpt.py > > @@ -338,6 +338,7 @@ def test_gpt_write(state_disk_image, ubman): > > def test_gpt_write_part_type(state_disk_image, ubman): > > """Test the gpt command with part type uuid.""" > > > > + ubman.run_command('host bind 0 ' + state_disk_image.path) > > The "0" in the `host bind 0` command is not the device number but a > label. If a prior `host bind` command used a different label your device > "0" may not have device number 0 as assumed below. > > Here is an example: > > => host bind 1 ../sandbox.img > => host bind 0 ../sandbox.img > => host info > dev blocks blksz label path > 0 131072 512 1 ../sandbox.img > 1 131072 512 0 ../sandbox.img Wow, that's very intuitive indeed :-D > Each test that uses host bind should unbind the device at the end of the > test. This also applies to test_gpt_write_part_type(). Added an unbind in my newly introduced test in v2. Shall I produce a separate patch to add unbind in the other tests here? Or wait for your patch to get merged, so that the tests can be converted to take the device number from a variable instead of hardcoding 0? > For reliable testing we need a host sub-command that writes the > device-number (dev_seq(dev)) for a label to a variable. We should extend > the `host info` command for this purpose: > > [PATCH 1/1] cmd/host: allow to retrieve sequence number for label > https://lists.u-boot-project.org/pipermail/u-boot/2026-August/629880.html Best regards, Alexey