aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJoshua Watt2023-08-31 10:51:37 -0600
committerTom Rini2023-09-11 16:24:46 -0400
commitb1433affd9a9de10150c31929564f68ca338911a (patch)
treeb4248a39d38a0dfc0182071138fcc038a224681b /test
parenta3eb350649757efc5eac3bfe41d1fbf0e51b0690 (diff)
cmd: gpt: Add gpt_partition_bootable variable
Adds an additional variable called gpt_partition_bootable that indicates if the given partition is bootable or not. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_gpt.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index 339468bc127..946858800d6 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -49,6 +49,7 @@ class GptTestDiskImage(object):
u_boot_utils.run_and_log(u_boot_console, cmd)
# part1 offset 1MB size 1MB
cmd = ('sgdisk', '--new=1:2048:4095', '--change-name=1:part1',
+ '-A 1:set:2',
persistent)
# part2 offset 2MB size 1.5MB
u_boot_utils.run_and_log(u_boot_console, cmd)
@@ -120,6 +121,38 @@ def test_gpt_guid(state_disk_image, u_boot_console):
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('cmd_gpt')
@pytest.mark.requiredtool('sgdisk')
+def test_gpt_setenv(state_disk_image, u_boot_console):
+ """Test the gpt setenv command."""
+ u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
+ output = u_boot_console.run_command('gpt setenv host 0 part1')
+ assert 'success!' in output
+ output = u_boot_console.run_command('echo ${gpt_partition_addr}')
+ assert output.rstrip() == '800'
+ output = u_boot_console.run_command('echo ${gpt_partition_size}')
+ assert output.rstrip() == '800'
+ output = u_boot_console.run_command('echo ${gpt_partition_name}')
+ assert output.rstrip() == 'part1'
+ output = u_boot_console.run_command('echo ${gpt_partition_entry}')
+ assert output.rstrip() == '1'
+ output = u_boot_console.run_command('echo ${gpt_partition_bootable}')
+ assert output.rstrip() == '1'
+
+ output = u_boot_console.run_command('gpt setenv host 0 part2')
+ assert 'success!' in output
+ output = u_boot_console.run_command('echo ${gpt_partition_addr}')
+ assert output.rstrip() == '1000'
+ output = u_boot_console.run_command('echo ${gpt_partition_size}')
+ assert output.rstrip() == 'c00'
+ output = u_boot_console.run_command('echo ${gpt_partition_name}')
+ assert output.rstrip() == 'part2'
+ output = u_boot_console.run_command('echo ${gpt_partition_entry}')
+ assert output.rstrip() == '2'
+ output = u_boot_console.run_command('echo ${gpt_partition_bootable}')
+ assert output.rstrip() == '0'
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_gpt')
+@pytest.mark.requiredtool('sgdisk')
def test_gpt_save_guid(state_disk_image, u_boot_console):
"""Test the gpt guid command to save GUID into a string."""