On 10/16/2017 10:17 AM, Patrick Delaunay wrote:
Signed-off-by: Patrick Delaunay <patrick.delau...@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')
+@pytest.mark.buildconfigspec('cmd_part')
+@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.
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to