All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Delaunay <patrick.delaunay@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/5] test/py: gpt: add test for sub-command read/verify/write
Date: Mon, 16 Oct 2017 18:17:32 +0200	[thread overview]
Message-ID: <1508170655-17707-3-git-send-email-patrick.delaunay@st.com> (raw)
In-Reply-To: <1508170655-17707-1-git-send-email-patrick.delaunay@st.com>

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---
The write test failed on error
"Writing GPT: Partition overlap"

./test/py/test.py -k gpt --build

this regression is corrected in next commit of the patchset

Changes in v2: None

 test/py/tests/test_gpt.py | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index e58bf61..8d5980c 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -68,6 +68,31 @@ def state_disk_image(u_boot_console):
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
+ at pytest.mark.buildconfigspec('cmd_part')
+ at pytest.mark.requiredtool('sgdisk')
+def test_gpt_read(state_disk_image, u_boot_console):
+    """Test the gpt read command."""
+
+    u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
+    output = u_boot_console.run_command('gpt read host 0')
+    assert 'Start 1MiB, size 0MiB' in output
+    assert 'Start 2MiB, size 0MiB' in output
+    output = u_boot_console.run_command('part list host 0')
+    assert '0x00000800	0x00000a00	""' in output
+    assert '0x00001000	0x00001200	""' in output
+
+ at pytest.mark.boardspec('sandbox')
+ at pytest.mark.buildconfigspec('cmd_gpt')
+ at pytest.mark.requiredtool('sgdisk')
+def test_gpt_verify(state_disk_image, u_boot_console):
+    """Test the gpt verify command."""
+
+    u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
+    output = u_boot_console.run_command('gpt verify host 0')
+    assert 'Verify GPT: success!' in output
+
+ at pytest.mark.boardspec('sandbox')
+ at pytest.mark.buildconfigspec('cmd_gpt')
 @pytest.mark.requiredtool('sgdisk')
 def test_gpt_guid(state_disk_image, u_boot_console):
     """Test the gpt guid command."""
@@ -120,3 +145,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
+
+ at pytest.mark.boardspec('sandbox')
+ at pytest.mark.buildconfigspec('cmd_gpt')
+ at pytest.mark.buildconfigspec('cmd_part')
+ at 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
-- 
2.7.4

  parent reply	other threads:[~2017-10-16 16:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 16:17 [U-Boot] [PATCH v2 0/5] solve issues in gpt management Patrick Delaunay
2017-10-16 16:17 ` [U-Boot] [PATCH v2 1/5] test/py: gpt: copy persistent file Patrick Delaunay
2017-10-16 16:47   ` Stephen Warren
2017-10-16 16:17 ` Patrick Delaunay [this message]
2017-10-16 16:56   ` [U-Boot] [PATCH v2 2/5] test/py: gpt: add test for sub-command read/verify/write Stephen Warren
2017-10-16 16:17 ` [U-Boot] [PATCH v2 3/5] disk: efi: correct the overlap check on GPT header and PTE Patrick Delaunay
2017-10-22 14:34   ` Simon Glass
2017-10-16 16:17 ` [U-Boot] [PATCH v2 4/5] test/py: gpt: test start LBA for sub-command rename and swap Patrick Delaunay
2017-10-16 17:00   ` Stephen Warren
2017-10-16 16:17 ` [U-Boot] [PATCH v2 5/5] cmd: gpt: solve issue for swap Patrick Delaunay
2017-10-22 14:34   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1508170655-17707-3-git-send-email-patrick.delaunay@st.com \
    --to=patrick.delaunay@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.