diff mbox series

[U-Boot,v3,5/6] test/py: gpt: test start LBA for sub-command rename and swap

Message ID 1508332268-2280-6-git-send-email-patrick.delaunay@st.com
State Accepted
Commit 0cf02ff612c05800cb65fb496ac55454c36df64b
Delegated to: Tom Rini
Headers show
Series solve issues in gpt management | expand

Commit Message

Patrick DELAUNAY Oct. 18, 2017, 1:11 p.m. UTC
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

After rename, the last LBA change and it is a error in current U-Boot code
+ "first" = 0x7ff : invalid value (<start)
+ "second" = 0x17ff => size increasing !

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

Before rename
0x00000800  0x00000a00      "part1"
0x00001000  0x00001200      "part2"

And after rename last LBA are invalid
0x00000800	0x000007ff "first"
0x00001000	0x000017ff	"second"

this issue will be corrected in next commit of the patchset

Changes in v3:
- Indicate LBA end error for rename command in test/py and commit message

Changes in v2: None

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

Comments

Tom Rini Oct. 24, 2017, 6:15 p.m. UTC | #1
On Wed, Oct 18, 2017 at 03:11:07PM +0200, 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
> 
> After rename, the last LBA change and it is a error in current U-Boot code
> + "first" = 0x7ff : invalid value (<start)
> + "second" = 0x17ff => size increasing !
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index 2eb07a1..b7adc10 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -119,6 +119,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."""
@@ -130,6 +131,13 @@  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 '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 !
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
@@ -141,12 +149,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 '0x000007ff	"first"' in output
-    assert '0x000017ff	"second"' in output
+    assert '0x00000800	0x000007ff	"first"' in output
+    assert '0x00001000	0x000017ff	"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 '0x000007ff	"second"' in output
-    assert '0x000017ff	"first"' in output
+    assert '0x00000800	0x000007ff	"second"' in output
+    assert '0x00001000	0x000017ff	"first"' in output
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')