From patchwork Wed Dec 6 17:08:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 845261 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3ysQ7D4sDMz9rxj for ; Thu, 7 Dec 2017 04:08:40 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2B7E5C21C40; Wed, 6 Dec 2017 17:08:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id BA435C21C59; Wed, 6 Dec 2017 17:08:29 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 22F4BC21D72; Wed, 6 Dec 2017 17:08:28 +0000 (UTC) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by lists.denx.de (Postfix) with ESMTPS id B8BD9C21C59 for ; Wed, 6 Dec 2017 17:08:27 +0000 (UTC) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vB6H4OrE026042; Wed, 6 Dec 2017 18:08:27 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2ena4aupsj-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 06 Dec 2017 18:08:27 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 200AF3A; Wed, 6 Dec 2017 17:08:24 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E264659A8; Wed, 6 Dec 2017 17:08:23 +0000 (GMT) Received: from SAFEX1HUBCAS24.st.com (10.75.90.95) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 6 Dec 2017 18:08:23 +0100 Received: from localhost (10.201.23.85) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.352.0; Wed, 6 Dec 2017 18:08:23 +0100 From: Patrick Delaunay To: Date: Wed, 6 Dec 2017 18:08:20 +0100 Message-ID: <1512580100-15225-1-git-send-email-patrick.delaunay@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.201.23.85] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-12-06_07:, , signatures=0 Cc: Alison Chaiken , Stephen Warren Subject: [U-Boot] [PATCH] test/py: gpt: update size of gpt partition X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" - avoid disturbing 0MiB partition size (in fact < 1MiB) - test overlap limit between part1 and part2 - test gpt write with data with modifier 'M' for MiB Signed-off-by: Patrick Delaunay Reviewed-by: Stephen Warren --- test ok on v2018.01-rc1 ./test/py/test.py -B sandbox => test/py/tests/test_gpt.py ....... Modification was initially proposed by Stephen Warren in review of [PATCH v1 1/3] test/py: gpt: update test_gpt From: Stephen Warren [mailto:swarren@wwwdotorg.org] If you're looking for more things to change(!), perhaps change the sgdisk commands so that the partitions are big enough that 'gpt read host 0' says something other than 'size 0MiB' for the partitions; when I saw that, I was initially rather confused until I realized that the partitions were less than 1MiB! Patrick Delaunay wrote: I don't really looking... but I agree: size 0MiB is confusing, I had the same reaction the first time. So I will propose something when this serie will be accepted, just update the test to have 2 partitions with different size and > 1MiB. test/py/tests/test_gpt.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py index 4329b69..886df43 100644 --- a/test/py/tests/test_gpt.py +++ b/test/py/tests/test_gpt.py @@ -44,9 +44,11 @@ class GptTestDiskImage(object): cmd = ('sgdisk', '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe', persistent) u_boot_utils.run_and_log(u_boot_console, cmd) - cmd = ('sgdisk', '--new=1:2048:2560', '-c 1:part1', persistent) + # part1 offset 1MB size 1MB + cmd = ('sgdisk', '--new=1:2048:4095', '-c 1:part1', persistent) + # part2 offset 2MB size 1.5MB u_boot_utils.run_and_log(u_boot_console, cmd) - cmd = ('sgdisk', '--new=2:4096:4608', '-c 2:part2', persistent) + cmd = ('sgdisk', '--new=2:4096:7167', '-c 2:part2', persistent) u_boot_utils.run_and_log(u_boot_console, cmd) cmd = ('sgdisk', '-l', persistent) u_boot_utils.run_and_log(u_boot_console, cmd) @@ -76,13 +78,13 @@ def test_gpt_read(state_disk_image, u_boot_console): 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 1MiB, size 1MiB' in output assert 'Block size 512, name part1' in output - assert 'Start 2MiB, size 0MiB' in output + assert 'Start 2MiB, size 1MiB' in output assert 'Block size 512, name part2' in output output = u_boot_console.run_command('part list host 0') - assert '0x00000800 0x00000a00 "part1"' in output - assert '0x00001000 0x00001200 "part2"' in output + assert '0x00000800 0x00000fff "part1"' in output + assert '0x00001000 0x00001bff "part2"' in output @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @@ -133,8 +135,8 @@ def test_gpt_rename_partition(state_disk_image, u_boot_console): output = u_boot_console.run_command('gpt read host 0') assert 'name second' in output output = u_boot_console.run_command('part list host 0') - assert '0x00000800 0x00000a00 "first"' in output - assert '0x00001000 0x00001200 "second"' in output + assert '0x00000800 0x00000fff "first"' in output + assert '0x00001000 0x00001bff "second"' in output @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @@ -146,12 +148,12 @@ def test_gpt_swap_partitions(state_disk_image, u_boot_console): u_boot_console.run_command('host bind 0 ' + state_disk_image.path) output = u_boot_console.run_command('part list host 0') - assert '0x00000800 0x00000a00 "first"' in output - assert '0x00001000 0x00001200 "second"' in output + assert '0x00000800 0x00000fff "first"' in output + assert '0x00001000 0x00001bff "second"' in output u_boot_console.run_command('gpt swap host 0 first second') output = u_boot_console.run_command('part list host 0') - assert '0x00000800 0x00000a00 "second"' in output - assert '0x00001000 0x00001200 "first"' in output + assert '0x00000800 0x00000fff "second"' in output + assert '0x00001000 0x00001bff "first"' in output @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_gpt') @@ -165,10 +167,10 @@ def test_gpt_write(state_disk_image, u_boot_console): 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;"') + output = u_boot_console.run_command('gpt write host 0 "uuid_disk=375a56f7-d6c9-4e81-b5f0-09d41ca89efe;name=first,start=1M,size=1M;name=second,start=0x200000,size=0x180000;"') 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 + assert '0x00000800 0x00000fff "first"' in output + assert '0x00001000 0x00001bff "second"' in output output = u_boot_console.run_command('gpt guid host 0') assert '375a56f7-d6c9-4e81-b5f0-09d41ca89efe' in output