mirror of
https://xff.cz/git/u-boot/
synced 2025-10-27 08:33:10 +01:00
test/py: gpt: add test for sub-command read and verify
add sandbox test for some gpt sub-command - gpt read / part list : read the gpt partition created by sgdisk on host test start, size, LBA and name output - gpt verify : verify the gpt partition create by sgdisk on host PS: persistent data test_gpt_disk_image.bin are udpated Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
committed by
Tom Rini
parent
da4c4bbd61
commit
30ef7cbb81
@@ -43,9 +43,9 @@ class GptTestDiskImage(object):
|
|||||||
cmd = ('sgdisk', '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe',
|
cmd = ('sgdisk', '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe',
|
||||||
persistent)
|
persistent)
|
||||||
u_boot_utils.run_and_log(u_boot_console, cmd)
|
u_boot_utils.run_and_log(u_boot_console, cmd)
|
||||||
cmd = ('sgdisk', '--new=1:2048:2560', persistent)
|
cmd = ('sgdisk', '--new=1:2048:2560', '-c 1:part1', persistent)
|
||||||
u_boot_utils.run_and_log(u_boot_console, cmd)
|
u_boot_utils.run_and_log(u_boot_console, cmd)
|
||||||
cmd = ('sgdisk', '--new=2:4096:4608', persistent)
|
cmd = ('sgdisk', '--new=2:4096:4608', '-c 2:part2', persistent)
|
||||||
u_boot_utils.run_and_log(u_boot_console, cmd)
|
u_boot_utils.run_and_log(u_boot_console, cmd)
|
||||||
cmd = ('sgdisk', '-l', persistent)
|
cmd = ('sgdisk', '-l', persistent)
|
||||||
u_boot_utils.run_and_log(u_boot_console, cmd)
|
u_boot_utils.run_and_log(u_boot_console, cmd)
|
||||||
@@ -66,6 +66,33 @@ def state_disk_image(u_boot_console):
|
|||||||
gtdi = GptTestDiskImage(u_boot_console)
|
gtdi = GptTestDiskImage(u_boot_console)
|
||||||
return gtdi
|
return gtdi
|
||||||
|
|
||||||
|
@pytest.mark.boardspec('sandbox')
|
||||||
|
@pytest.mark.buildconfigspec('cmd_gpt')
|
||||||
|
@pytest.mark.buildconfigspec('cmd_part')
|
||||||
|
@pytest.mark.requiredtool('sgdisk')
|
||||||
|
def test_gpt_read(state_disk_image, u_boot_console):
|
||||||
|
"""Test the gpt read command."""
|
||||||
|
|
||||||
|
u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
|
||||||
|
output = u_boot_console.run_command('gpt read host 0')
|
||||||
|
assert 'Start 1MiB, size 0MiB' in output
|
||||||
|
assert 'Block size 512, name part1' in output
|
||||||
|
assert 'Start 2MiB, size 0MiB' in output
|
||||||
|
assert 'Block size 512, name part2' in output
|
||||||
|
output = u_boot_console.run_command('part list host 0')
|
||||||
|
assert '0x00000800 0x00000a00 "part1"' in output
|
||||||
|
assert '0x00001000 0x00001200 "part2"' in output
|
||||||
|
|
||||||
|
@pytest.mark.boardspec('sandbox')
|
||||||
|
@pytest.mark.buildconfigspec('cmd_gpt')
|
||||||
|
@pytest.mark.requiredtool('sgdisk')
|
||||||
|
def test_gpt_verify(state_disk_image, u_boot_console):
|
||||||
|
"""Test the gpt verify command."""
|
||||||
|
|
||||||
|
u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
|
||||||
|
output = u_boot_console.run_command('gpt verify host 0')
|
||||||
|
assert 'Verify GPT: success!' in output
|
||||||
|
|
||||||
@pytest.mark.boardspec('sandbox')
|
@pytest.mark.boardspec('sandbox')
|
||||||
@pytest.mark.buildconfigspec('cmd_gpt')
|
@pytest.mark.buildconfigspec('cmd_gpt')
|
||||||
@pytest.mark.requiredtool('sgdisk')
|
@pytest.mark.requiredtool('sgdisk')
|
||||||
|
|||||||
Reference in New Issue
Block a user