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
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().
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
Heinrich
output = ubman.run_command('gpt write host 0
"name=part1,type=data,size=1M;name=part2,size=512K,type=system;name=part3,size=65536,type=u-boot-env;name=part4,size=65536,type=375a56f7-d6c9-4e81-b5f0-09d41ca89efe;name=part5,size=-,type=linux"')
assert 'Writing GPT: success!' in output
output = ubman.run_command('part list host 0')