[U-Boot] [PATCH v2 4/5] test/py: gpt: test start LBA for sub-command rename and swap

2017-10-16 Thread Patrick Delaunay
Add test of first and last LBA in gpt for rename and swap.
Only the name is expected to change, so test 3 columns
for part command
1: first LBA (start)
2: last LBA (end)
3: partition name

Signed-off-by: Patrick Delaunay 
---
WARNING: the last LBA are invalid after rename

before rename
0x0800  0x0a00  ""
0x1000  0x1200  ""

after rename, the last LBA change
=> 7ff for first = invalid ( 17ff for second (size increase)

0x0800  0x07ff "first"
0x1000  0x17ff  "second"

the issue is corrected in next commit of the patchset


Changes in v2: None

 test/py/tests/test_gpt.py | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index 8d5980c..2554f1f 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -117,6 +117,7 @@ def test_gpt_save_guid(state_disk_image, u_boot_console):
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
 @pytest.mark.buildconfigspec('cmd_gpt_rename')
+@pytest.mark.buildconfigspec('cmd_part')
 @pytest.mark.requiredtool('sgdisk')
 def test_gpt_rename_partition(state_disk_image, u_boot_console):
 """Test the gpt rename command to write partition names."""
@@ -128,6 +129,9 @@ def test_gpt_rename_partition(state_disk_image, 
u_boot_console):
 u_boot_console.run_command('gpt rename host 0 2 second')
 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 '0x0800 0x07ff  "first"' in output
+assert '0x1000 0x17ff  "second"' in output
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
@@ -139,12 +143,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 '0x07ff "first"' in output
-assert '0x17ff "second"' in output
+assert '0x0800 0x07ff  "first"' in output
+assert '0x1000 0x17ff  "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 '0x07ff "second"' in output
-assert '0x17ff "first"' in output
+assert '0x0800 0x07ff  "second"' in output
+assert '0x1000 0x17ff  "first"' in output
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 4/5] test/py: gpt: test start LBA for sub-command rename and swap

2017-10-16 Thread Stephen Warren

On 10/16/2017 10:17 AM, Patrick Delaunay wrote:

Add test of first and last LBA in gpt for rename and swap.
Only the name is expected to change, so test 3 columns
for part command
1: first LBA (start)
2: last LBA (end)
3: partition name

Signed-off-by: Patrick Delaunay 
---
WARNING: the last LBA are invalid after rename

before rename
0x0800  0x0a00  ""
0x1000  0x1200  ""

after rename, the last LBA change
=> 7ff for first = invalid ( 17ff for second (size increase)

0x0800  0x07ff "first"
0x1000  0x17ff  "second"

the issue is corrected in next commit of the patchset


That issue should be described in the commit description, and also as a 
comment in the code.

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot