summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2017-10-18 15:11:06 +0200
committerTom Rini <trini@konsulko.com>2017-10-23 17:27:58 -0400
commitb61a3b5c8d3de4a5f141effe412a457b21ba6060 (patch)
treeeef1ee20a6e438552382eb7545d8331f4eb61369 /test
parentae0e0228e664f31ac3c6093758ddc85b664e2d08 (diff)
test/py: gpt: add test for sub-command write
+ test write for one partition on all the device (size=0) + test write with disk uuid and 2 partitions Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_gpt.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index 5cfbf1fa1c..2eb07a1d2b 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -147,3 +147,23 @@ def test_gpt_swap_partitions(state_disk_image, u_boot_console):
output = u_boot_console.run_command('part list host 0')
assert '0x000007ff "second"' in output
assert '0x000017ff "first"' in output
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_gpt')
+@pytest.mark.buildconfigspec('cmd_part')
+@pytest.mark.requiredtool('sgdisk')
+def test_gpt_write(state_disk_image, u_boot_console):
+ """Test the gpt write command."""
+
+ u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
+ output = u_boot_console.run_command('gpt write host 0 "name=all,size=0"')
+ assert 'Writing GPT: success!' in output
+ output = u_boot_console.run_command('part list host 0')
+ assert '0x00000022 0x00001fde "all"' in output
+ output = u_boot_console.run_command('gpt write host 0 "uuid_disk=375a56f7-d6c9-4e81-b5f0-09d41ca89efe;name=first,start=0x100000,size=0x40200;name=second,start=0x200000,size=0x40200;"')
+ assert 'Writing GPT: success!' in output
+ output = u_boot_console.run_command('part list host 0')
+ assert '0x00000800 0x00000a00 "first"' in output
+ assert '0x00001000 0x00001200 "second"' in output
+ output = u_boot_console.run_command('gpt guid host 0')
+ assert '375a56f7-d6c9-4e81-b5f0-09d41ca89efe' in output