diff mbox series

[v3,4/4] test/py: gpt: add test for the gpt partition type GUID identifier

Message ID 20230110161936.526455-5-eballetbo@redhat.com
State Accepted
Commit 601d1bfe9e313938e24a83f64d2d45aa62a16abd
Delegated to: Tom Rini
Headers show
Series cmd: part: Add partition-related type command | expand

Commit Message

Enric Balletbo i Serra Jan. 10, 2023, 4:19 p.m. UTC
Add sandbox test for the gpt partition type command, the test uses the
persistent data test_gpt_disk_image.bin to check that the first
partition type GUID that identifies the type of the partition has the
"Linux filesystem data" type ( 0FC63DAF-8483-4772-8E79-3D69D8477DE4 ).

Signed-off-by: Enric Balletbo i Serra <eballetbo@redhat.com>
---

(no changes since v1)

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

Comments

Tom Rini Jan. 19, 2023, 2:45 p.m. UTC | #1
On Tue, Jan 10, 2023 at 05:19:35PM +0100, Enric Balletbo i Serra wrote:

> Add sandbox test for the gpt partition type command, the test uses the
> persistent data test_gpt_disk_image.bin to check that the first
> partition type GUID that identifies the type of the partition has the
> "Linux filesystem data" type ( 0FC63DAF-8483-4772-8E79-3D69D8477DE4 ).
> 
> Signed-off-by: Enric Balletbo i Serra <eballetbo@redhat.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 cb44e1d789..73bfbf77a2 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -134,6 +134,29 @@  def test_gpt_save_guid(state_disk_image, u_boot_console):
     output = u_boot_console.run_command('printenv newguid')
     assert '375a56f7-d6c9-4e81-b5f0-09d41ca89efe' in output
 
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_gpt')
+@pytest.mark.requiredtool('sgdisk')
+def test_gpt_part_type_uuid(state_disk_image, u_boot_console):
+    """Test the gpt partittion type UUID command."""
+
+    u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
+    output = u_boot_console.run_command('part type host 0:1')
+    assert '0fc63daf-8483-4772-8e79-3d69d8477de4' in output
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_gpt')
+@pytest.mark.requiredtool('sgdisk')
+def test_gpt_part_type_save_uuid(state_disk_image, u_boot_console):
+    """Test the gpt partittion type to save UUID into a string."""
+
+    if u_boot_console.config.buildconfig.get('config_cmd_gpt', 'n') != 'y':
+        pytest.skip('gpt command not supported')
+    u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
+    output = u_boot_console.run_command('part type host 0:1 newguid')
+    output = u_boot_console.run_command('printenv newguid')
+    assert '0fc63daf-8483-4772-8e79-3d69d8477de4' in output
+
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
 @pytest.mark.buildconfigspec('cmd_gpt_rename')