[U-Boot] [PATCH v2 2/5] test/py: gpt: add test for sub-command read/verify/write
Stephen Warren
swarren at wwwdotorg.org
Mon Oct 16 16:56:10 UTC 2017
On 10/16/2017 10:17 AM, Patrick Delaunay wrote:
> Signed-off-by: Patrick Delaunay <patrick.delaunay at 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.
More information about the U-Boot
mailing list