summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2017-10-18 15:11:08 +0200
committerTom Rini <trini@konsulko.com>2017-10-23 17:28:11 -0400
commit3a2605fa875bc02962d62b5a21c795640621bf45 (patch)
tree86d87bda4b5945780c8d06ebc700c23a759c5aaf /test
parent0cf02ff612c05800cb65fb496ac55454c36df64b (diff)
cmd: gpt: solve issue for swap and rename command
don't use prettyprint_part_size() in create_gpt_partitions_list() that avoid to align offset and size to 1 MiB and increase precision for start and size. This patch avoid the risk to change partition size and lost data during rename or swap. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_gpt.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index b7adc1096e6..b9b5e5fbb04 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -132,12 +132,8 @@ def test_gpt_rename_partition(state_disk_image, u_boot_console):
output = u_boot_console.run_command('gpt read host 0')
assert 'name second' in output
output = u_boot_console.run_command('part list host 0')
- assert '0x00000800 0x000007ff "first"' in output
- assert '0x00001000 0x000017ff "second"' in output
- # command error here because 'end LBA' (column 2) change after rename
- # (previous value can be found in test_gpt_read)
- # "first" 0xa00 => 0x7ff : it is an invalid value < start LBA !
- # "seconf" 0x1200 => 0x17ff : size is increasing !
+ assert '0x00000800 0x00000a00 "first"' in output
+ assert '0x00001000 0x00001200 "second"' in output
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('cmd_gpt')
@@ -149,12 +145,12 @@ def test_gpt_swap_partitions(state_disk_image, u_boot_console):
u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
output = u_boot_console.run_command('part list host 0')
- assert '0x00000800 0x000007ff "first"' in output
- assert '0x00001000 0x000017ff "second"' in output
+ assert '0x00000800 0x00000a00 "first"' in output
+ assert '0x00001000 0x00001200 "second"' in output
u_boot_console.run_command('gpt swap host 0 first second')
output = u_boot_console.run_command('part list host 0')
- assert '0x00000800 0x000007ff "second"' in output
- assert '0x00001000 0x000017ff "first"' in output
+ assert '0x00000800 0x00000a00 "second"' in output
+ assert '0x00001000 0x00001200 "first"' in output
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('cmd_gpt')