Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814355/?format=api
{ "id": 814355, "url": "http://patchwork.ozlabs.org/api/patches/814355/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20170915181938.18122-1-swarren@wwwdotorg.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170915181938.18122-1-swarren@wwwdotorg.org>", "list_archive_url": null, "date": "2017-09-15T18:19:38", "name": "[U-Boot,V2] test/py: gpt: make use of infra-structure", "commit_ref": "110ba62519909df7042cbe71824dfe3844557a85", "pull_url": null, "state": "accepted", "archived": false, "hash": "bbd0a52f9f1db17dc419381881ec072a3a4fc689", "submitter": { "id": 12517, "url": "http://patchwork.ozlabs.org/api/people/12517/?format=api", "name": "Stephen Warren", "email": "swarren@wwwdotorg.org" }, "delegate": { "id": 3651, "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api", "username": "trini", "first_name": "Tom", "last_name": "Rini", "email": "trini@ti.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20170915181938.18122-1-swarren@wwwdotorg.org/mbox/", "series": [ { "id": 3349, "url": "http://patchwork.ozlabs.org/api/series/3349/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=3349", "date": "2017-09-15T18:19:38", "name": "[U-Boot,V2] test/py: gpt: make use of infra-structure", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/3349/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814355/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814355/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)", "Received": [ "from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xv3bL6mDxz9s7h\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 16 Sep 2017 04:19:58 +1000 (AEST)", "by lists.denx.de (Postfix, from userid 105)\n\tid 4DCC4C21DCC; Fri, 15 Sep 2017 18:19:53 +0000 (UTC)", "from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id E77F8C21C72;\n\tFri, 15 Sep 2017 18:19:49 +0000 (UTC)", "by lists.denx.de (Postfix, from userid 105)\n\tid 9D5EFC21C72; Fri, 15 Sep 2017 18:19:47 +0000 (UTC)", "from avon.wwwdotorg.org (avon.wwwdotorg.org [104.237.132.123])\n\tby lists.denx.de (Postfix) with ESMTPS id EB56FC21C3C\n\tfor <u-boot@lists.denx.de>; Fri, 15 Sep 2017 18:19:46 +0000 (UTC)", "from swarren-lx1.nvidia.com (thunderhill.nvidia.com\n\t[216.228.112.22])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby avon.wwwdotorg.org (Postfix) with ESMTPSA id F3FC51C02C7;\n\tFri, 15 Sep 2017 12:19:44 -0600 (MDT)" ], "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\n\tautolearn_force=no version=3.4.0", "X-Virus-Status": "Clean", "X-Virus-Scanned": "clamav-milter 0.99.2 at avon.wwwdotorg.org", "From": "Stephen Warren <swarren@wwwdotorg.org>", "To": "Tom Rini <trini@konsulko.com>", "Date": "Fri, 15 Sep 2017 12:19:38 -0600", "Message-Id": "<20170915181938.18122-1-swarren@wwwdotorg.org>", "X-Mailer": "git-send-email 2.14.1", "X-NVConfidentiality": "public", "Cc": "Alison Chaiken <alison@peloton-tech.com>, u-boot@lists.denx.de,\n\tStephen Warren <swarren@nvidia.com>", "Subject": "[U-Boot] [PATCH V2] test/py: gpt: make use of infra-structure", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.18", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<http://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>" }, "content": "From: Stephen Warren <swarren@nvidia.com>\n\nMake various changes to the GPT test:\n\n1) Reference the disk image using an absolute path in all cases. This\nallows test/py to operate correctly if it's run from a directory other\nthan the root of the U-Boot source tree.\n\n2) Store the disk image in the teswt/py persistent data directory. This\nremoves the need to re-generate it every time the tests are run.\n\n3) Execute sgdisk using u_boot_utils.run_and_log() so that its output is\ncaptured in the test log. This allows debugging any problems running it.\n\n4) Make the disk image a test fixture. This removes the requirement to\nalways run all GPT tests, and run them in order. The current code doesn't\ncreate the disk image if e.g. just test_gpt_uuid() is executed via the\ntest.py -k command-line option.\n\n5) Use @pytest.mark.buildconfigspec for all feature dependencies, rather\nthan manually implementing some of them.\n\n6) Make all tests depend on sandbox, since they use the sandbox-specific\nhost command.\n\nFixes: a2f422555fc8 (\"add pytests for 'gpt guid' command in sandbox\")\nFixes: c5772188ede9 (\"add pytests for 'gpt rename' and 'gpt swap'\")\nSigned-off-by: Stephen Warren <swarren@nvidia.com>\n---\nv2: Add dependency on sandbox.\n---\n test/py/make_test_disk.py | 19 -----------\n test/py/tests/test_gpt.py | 87 +++++++++++++++++++++++++++++++++++------------\n 2 files changed, 66 insertions(+), 40 deletions(-)\n delete mode 100755 test/py/make_test_disk.py", "diff": "diff --git a/test/py/make_test_disk.py b/test/py/make_test_disk.py\ndeleted file mode 100755\nindex 5288295588a7..000000000000\n--- a/test/py/make_test_disk.py\n+++ /dev/null\n@@ -1,19 +0,0 @@\n-# Copyright (c) 2017 Alison Chaiken\n-#\n-# SPDX-License-Identifier: GPL-2.0\n-#\n-# Create a block device for testing of 'gpt' and 'part' commands.\n-\n-import os\n-\n-def makeDisk():\n- if (os.path.exists(\"testdisk.raw\")):\n- os.remove(\"testdisk.raw\")\n- fd = os.open(\"testdisk.raw\", os.O_RDWR|os.O_CREAT )\n- os.ftruncate(fd, 4194304)\n- os.close(fd)\n- os.spawnl(os.P_WAIT, \"/sbin/sgdisk\", \"sgdisk\", \"-U\",\n- \"375a56f7-d6c9-4e81-b5f0-09d41ca89efe\", \"testdisk.raw\")\n- os.spawnl(os.P_WAIT, \"/sbin/sgdisk\", \"sgdisk\", \"--new=1:2048:2560\", \"testdisk.raw\")\n- os.spawnl(os.P_WAIT, \"/sbin/sgdisk\", \"sgdisk\", \"--new=2:4096:4608\", \"testdisk.raw\")\n- os.spawnl(os.P_WAIT, \"/sbin/gdisk\", \"sgdisk\", \"-l\", \"testdisk.raw\")\ndiff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py\nindex 06f24b66cef8..e2bbd08e6d42 100644\n--- a/test/py/tests/test_gpt.py\n+++ b/test/py/tests/test_gpt.py\n@@ -1,4 +1,5 @@\n # Copyright (c) 2017 Alison Chaiken\n+# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.\n #\n # SPDX-License-Identifier: GPL-2.0\n \n@@ -7,42 +8,88 @@\n import os\n import pytest\n import u_boot_utils\n-import make_test_disk\n \n \"\"\"\n-These tests rely on a 4 MB block device called testdisk.raw\n-which is automatically removed at the end of the tests.\n+These tests rely on a 4 MB disk image, which is automatically created by\n+the test.\n \"\"\"\n \n+class GptTestDiskImage(object):\n+ \"\"\"Disk Image used by the GPT tests.\"\"\"\n+\n+ def __init__(self, u_boot_console):\n+ \"\"\"Initialize a new GptTestDiskImage object.\n+\n+ Args:\n+ u_boot_console: A U-Boot console.\n+\n+ Returns:\n+ Nothing.\n+ \"\"\"\n+\n+ filename = 'test_gpt_disk_image.bin'\n+ self.path = u_boot_console.config.persistent_data_dir + '/' + filename\n+\n+ if os.path.exists(self.path):\n+ u_boot_console.log.action('Disk image file ' + self.path +\n+ ' already exists')\n+ else:\n+ u_boot_console.log.action('Generating ' + self.path)\n+ fd = os.open(self.path, os.O_RDWR | os.O_CREAT)\n+ os.ftruncate(fd, 4194304)\n+ os.close(fd)\n+ sgdisk = '/sbin/sgdisk'\n+ cmd = (sgdisk, '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe',\n+ self.path)\n+ u_boot_utils.run_and_log(u_boot_console, cmd)\n+ cmd = (sgdisk, '--new=1:2048:2560', self.path)\n+ u_boot_utils.run_and_log(u_boot_console, cmd)\n+ cmd = (sgdisk, '--new=2:4096:4608', self.path)\n+ u_boot_utils.run_and_log(u_boot_console, cmd)\n+ cmd = (sgdisk, '-l', self.path)\n+ u_boot_utils.run_and_log(u_boot_console, cmd)\n+\n+gtdi = None\n+@pytest.fixture(scope='function')\n+def state_disk_image(u_boot_console):\n+ \"\"\"pytest fixture to provide a GptTestDiskImage object to tests.\n+ This is function-scoped because it uses u_boot_console, which is also\n+ function-scoped. However, we don't need to actually do any function-scope\n+ work, so this simply returns the same object over and over each time.\"\"\"\n+\n+ global gtdi\n+ if not gtdi:\n+ gtdi = GptTestDiskImage(u_boot_console)\n+ return gtdi\n+\n+@pytest.mark.boardspec('sandbox')\n @pytest.mark.buildconfigspec('cmd_gpt')\n-def test_gpt_guid(u_boot_console):\n+def test_gpt_guid(state_disk_image, u_boot_console):\n \"\"\"Test the gpt guid command.\"\"\"\n \n- if u_boot_console.config.buildconfig.get('config_cmd_gpt', 'n') != 'y':\n- pytest.skip('gpt command not supported')\n- make_test_disk.makeDisk()\n- u_boot_console.run_command('host bind 0 testdisk.raw')\n+ u_boot_console.run_command('host bind 0 ' + state_disk_image.path)\n output = u_boot_console.run_command('gpt guid host 0')\n assert '375a56f7-d6c9-4e81-b5f0-09d41ca89efe' in output\n \n+@pytest.mark.boardspec('sandbox')\n @pytest.mark.buildconfigspec('cmd_gpt')\n-def test_gpt_save_guid(u_boot_console):\n+def test_gpt_save_guid(state_disk_image, u_boot_console):\n \"\"\"Test the gpt guid command to save GUID into a string.\"\"\"\n \n if u_boot_console.config.buildconfig.get('config_cmd_gpt', 'n') != 'y':\n pytest.skip('gpt command not supported')\n- u_boot_console.run_command('host bind 0 testdisk.raw')\n+ u_boot_console.run_command('host bind 0 ' + state_disk_image.path)\n output = u_boot_console.run_command('gpt guid host 0 newguid')\n output = u_boot_console.run_command('printenv newguid')\n assert '375a56f7-d6c9-4e81-b5f0-09d41ca89efe' in output\n \n+@pytest.mark.boardspec('sandbox')\n @pytest.mark.buildconfigspec('cmd_gpt')\n-def test_gpt_rename_partition(u_boot_console):\n+@pytest.mark.buildconfigspec('cmd_gpt_rename')\n+def test_gpt_rename_partition(state_disk_image, u_boot_console):\n \"\"\"Test the gpt rename command to write partition names.\"\"\"\n \n- if u_boot_console.config.buildconfig.get('config_cmd_gpt_rename', 'n') != 'y':\n- pytest.skip('gpt rename command not supported')\n- u_boot_console.run_command('host bind 0 testdisk.raw')\n+ u_boot_console.run_command('host bind 0 ' + state_disk_image.path)\n u_boot_console.run_command('gpt rename host 0 1 first')\n output = u_boot_console.run_command('gpt read host 0')\n assert 'name first' in output\n@@ -50,15 +97,14 @@ def test_gpt_rename_partition(u_boot_console):\n output = u_boot_console.run_command('gpt read host 0')\n assert 'name second' in output\n \n+@pytest.mark.boardspec('sandbox')\n @pytest.mark.buildconfigspec('cmd_gpt')\n-def test_gpt_swap_partitions(u_boot_console):\n+@pytest.mark.buildconfigspec('cmd_gpt_rename')\n+@pytest.mark.buildconfigspec('cmd_part')\n+def test_gpt_swap_partitions(state_disk_image, u_boot_console):\n \"\"\"Test the gpt swap command to exchange two partition names.\"\"\"\n \n- if u_boot_console.config.buildconfig.get('config_cmd_gpt_rename', 'n') != 'y':\n- pytest.skip('gpt rename command not supported')\n- if u_boot_console.config.buildconfig.get('config_cmd_part', 'n') != 'y':\n- pytest.skip('gpt swap test needs CMD_PART')\n- u_boot_console.run_command('host bind 0 testdisk.raw')\n+ u_boot_console.run_command('host bind 0 ' + state_disk_image.path)\n output = u_boot_console.run_command('part list host 0')\n assert '0x000007ff\t\"first\"' in output\n assert '0x000017ff\t\"second\"' in output\n@@ -66,4 +112,3 @@ def test_gpt_swap_partitions(u_boot_console):\n output = u_boot_console.run_command('part list host 0')\n assert '0x000007ff\t\"second\"' in output\n assert '0x000017ff\t\"first\"' in output\n- os.remove('testdisk.raw')\n", "prefixes": [ "U-Boot", "V2" ] }