diff options
author | Joshua Watt <jpewhacker@gmail.com> | 2023-08-31 10:51:38 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-09-11 16:24:46 -0400 |
commit | a1e793add5dd21c2a1b08bc57ac99e43183913b6 (patch) | |
tree | 7d90e30cff6e713daa3d8e40dbfb2c6f4c7b5017 /test/py/tests/test_gpt.py | |
parent | b1433affd9a9de10150c31929564f68ca338911a (diff) |
cmd: gpt: Add command to set bootable flags
Adds a command that can be used to modify the GPT partition table to
indicate which partitions should have the bootable flag set
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'test/py/tests/test_gpt.py')
-rw-r--r-- | test/py/tests/test_gpt.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py index 946858800d..5d23f9b292 100644 --- a/test/py/tests/test_gpt.py +++ b/test/py/tests/test_gpt.py @@ -222,6 +222,28 @@ def test_gpt_swap_partitions(state_disk_image, u_boot_console): assert '0x00000800 0x00000fff "part2"' in output assert '0x00001000 0x00001bff "part1"' in output +@pytest.mark.buildconfigspec('cmd_gpt') +@pytest.mark.buildconfigspec('cmd_gpt_rename') +@pytest.mark.buildconfigspec('cmd_part') +@pytest.mark.requiredtool('sgdisk') +def test_gpt_set_bootable(state_disk_image, u_boot_console): + """Test the gpt set-bootable command.""" + + u_boot_console.run_command('host bind 0 ' + state_disk_image.path) + parts = ('part2', 'part1') + for bootable in parts: + output = u_boot_console.run_command(f'gpt set-bootable host 0 {bootable}') + assert 'success!' in output + + for p in parts: + output = u_boot_console.run_command(f'gpt setenv host 0 {p}') + assert 'success!' in output + output = u_boot_console.run_command('echo ${gpt_partition_bootable}') + if p == bootable: + assert output.rstrip() == '1' + else: + assert output.rstrip() == '0' + @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @pytest.mark.buildconfigspec('cmd_part') |