All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
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 10:56:10 -0600	[thread overview]
Message-ID: <17e4173b-e39b-045b-d186-2dee7618749b@wwwdotorg.org> (raw)
In-Reply-To: <1508170655-17707-3-git-send-email-patrick.delaunay@st.com>

On 10/16/2017 10:17 AM, Patrick Delaunay wrote:
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

There needs to be a patch description here, so anyone looking at git 
history knows what this patch is intended to do.

> ---
> 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

Does this mean the test doesn't pass with this patch applied? That's 
wrong. All tests should pass at any git commit. Instead, add this test 
and validate the current expected data (even if it's wrong), and put a 
comment in the code and commit description describing the issue. Then, 
in the commit that fixes the bug in the code, also update the test to 
validate the new (now correct) expected data.

Or, add the new tests after the code is fixed.

> diff --git 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

Can those commands include that partion name/number/... in the text they 
assert is in the output? That way, the test will verify that the 
expected/correct partition has the expected start/size, not simply that 
/some/ partition has the expected start/size.

> +    output = u_boot_console.run_command('part list host 0')
> +    assert '0x00000800	0x00000a00	""' in output
> +    assert '0x00001000	0x00001200	""' in output

Do the partitions not have names in the test GPT image? I ask because of 
the empty "" in the text that's verified above. Perhaps we can modify 
the code that creates the GPT image to give the partitions names, so 
that they can be verified here.

  reply	other threads:[~2017-10-16 16:56 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 ` [U-Boot] [PATCH v2 2/5] test/py: gpt: add test for sub-command read/verify/write Patrick Delaunay
2017-10-16 16:56   ` Stephen Warren [this message]
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=17e4173b-e39b-045b-d186-2dee7618749b@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --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.