public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Joshua Watt <jpewhacker@gmail.com>
To: u-boot@lists.denx.de
Cc: Joshua Watt <JPEWhacker@gmail.com>,
	Enric Balletbo i Serra <eballetb@redhat.com>,
	Simon Glass <sjg@chromium.org>
Subject: [PATCH v4 3/8] tests: gpt: Remove test order dependency
Date: Mon, 28 Aug 2023 15:56:10 -0600	[thread overview]
Message-ID: <20230828215623.3727536-4-JPEWhacker@gmail.com> (raw)
In-Reply-To: <20230828215623.3727536-1-JPEWhacker@gmail.com>

Re-create a clean disk image for each test to prevent modifications from
one test affecting another

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 test/py/tests/test_gpt.py | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index 73bfbf77a2..339468bc12 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -61,18 +61,14 @@ class GptTestDiskImage(object):
         cmd = ('cp', persistent, self.path)
         u_boot_utils.run_and_log(u_boot_console, cmd)
 
-gtdi = None
 @pytest.fixture(scope='function')
 def state_disk_image(u_boot_console):
     """pytest fixture to provide a GptTestDiskImage object to tests.
     This is function-scoped because it uses u_boot_console, which is also
-    function-scoped. However, we don't need to actually do any function-scope
-    work, so this simply returns the same object over and over each time."""
+    function-scoped. A new disk is returned each time to prevent tests from
+    interfering with each other."""
 
-    global gtdi
-    if not gtdi:
-        gtdi = GptTestDiskImage(u_boot_console)
-    return gtdi
+    return GptTestDiskImage(u_boot_console)
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
@@ -186,12 +182,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	0x00000fff	"first"' in output
-    assert '0x00001000	0x00001bff	"second"' in output
-    u_boot_console.run_command('gpt swap host 0 first second')
+    assert '0x00000800	0x00000fff	"part1"' in output
+    assert '0x00001000	0x00001bff	"part2"' in output
+    u_boot_console.run_command('gpt swap host 0 part1 part2')
     output = u_boot_console.run_command('part list host 0')
-    assert '0x00000800	0x00000fff	"second"' in output
-    assert '0x00001000	0x00001bff	"first"' in output
+    assert '0x00000800	0x00000fff	"part2"' in output
+    assert '0x00001000	0x00001bff	"part1"' in output
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
-- 
2.33.0


  parent reply	other threads:[~2023-08-28 21:57 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 16:26 [PATCH 0/6] cmd: gpt: GPT manipulation improvements Joshua Watt
2023-08-15 16:26 ` [PATCH 1/6] cmd: gpt: Remove confusing help text Joshua Watt
2023-08-18 14:23   ` Tom Rini
2023-08-23 23:57   ` Simon Glass
2023-08-15 16:26 ` [PATCH 2/6] cmd: gpt: Add command to set bootable flags Joshua Watt
2023-08-15 18:39   ` Simon Glass
2023-08-15 16:26 ` [PATCH 3/6] cmd: gpt: Add gpt_partition_bootable variable Joshua Watt
2023-08-15 16:26 ` [PATCH 4/6] cmd: gpt: Preserve type GUID if enabled Joshua Watt
2023-08-15 16:26 ` [PATCH 5/6] cmd: gpt: Preserve bootable flag Joshua Watt
2023-08-15 16:27 ` [PATCH 6/6] cmd: gpt: Add command to swap partition order Joshua Watt
2023-08-23 23:57   ` Simon Glass
2023-08-23 16:47 ` [PATCH v2 0/8] cmd: gpt: GPT manipulation improvements Joshua Watt
2023-08-23 16:47   ` [PATCH v2 1/8] cmd: gpt: Remove confusing help text Joshua Watt
2023-08-23 18:15     ` Tom Rini
2023-08-23 16:47   ` [PATCH v2 2/8] doc: Add gpt command documentation Joshua Watt
2023-08-23 18:15     ` Tom Rini
2023-08-23 23:57     ` Simon Glass
2023-08-23 16:47   ` [PATCH v2 3/8] tests: gpt: Remove test order dependency Joshua Watt
2023-08-23 23:57     ` Simon Glass
2023-08-24  3:29       ` Joshua Watt
2023-08-23 16:47   ` [PATCH v2 4/8] cmd: gpt: Add gpt_partition_bootable variable Joshua Watt
2023-08-23 23:57     ` Simon Glass
2023-08-23 16:47   ` [PATCH v2 5/8] cmd: gpt: Add command to set bootable flags Joshua Watt
2023-08-23 23:57     ` Simon Glass
2023-08-23 16:47   ` [PATCH v2 6/8] cmd: gpt: Preserve type GUID if enabled Joshua Watt
2023-08-23 23:57     ` Simon Glass
2023-08-23 16:47   ` [PATCH v2 7/8] cmd: gpt: Preserve bootable flag Joshua Watt
2023-08-23 23:57     ` Simon Glass
2023-08-23 16:47   ` [PATCH v2 8/8] cmd: gpt: Add command to swap partition order Joshua Watt
2023-08-25 19:38   ` [PATCH v3 0/8] cmd: gpt: GPT manipulation improvements Joshua Watt
2023-08-25 19:38     ` [PATCH v3 1/8] cmd: gpt: Remove confusing help text Joshua Watt
2023-08-25 19:38     ` [PATCH v3 2/8] doc: Add gpt command documentation Joshua Watt
2023-08-25 23:53       ` Simon Glass
2023-08-28 21:52         ` Joshua Watt
2023-08-26  1:57       ` Heinrich Schuchardt
2023-08-28 19:29         ` Joshua Watt
2023-08-28 20:01           ` Heinrich Schuchardt
2023-08-28 21:01             ` Joshua Watt
2023-08-25 19:38     ` [PATCH v3 3/8] tests: gpt: Remove test order dependency Joshua Watt
2023-08-25 19:38     ` [PATCH v3 4/8] cmd: gpt: Add gpt_partition_bootable variable Joshua Watt
2023-08-25 23:53       ` Simon Glass
2023-08-25 19:38     ` [PATCH v3 5/8] cmd: gpt: Add command to set bootable flags Joshua Watt
2023-08-25 19:38     ` [PATCH v3 6/8] cmd: gpt: Preserve type GUID if enabled Joshua Watt
2023-08-25 23:53       ` Simon Glass
2023-08-26  0:37       ` Heinrich Schuchardt
2023-08-25 19:38     ` [PATCH v3 7/8] cmd: gpt: Preserve bootable flag Joshua Watt
2023-08-25 19:38     ` [PATCH v3 8/8] cmd: gpt: Add command to swap partition order Joshua Watt
2023-08-25 23:53       ` Simon Glass
2023-08-26  1:00       ` Heinrich Schuchardt
2023-08-28 21:56     ` [PATCH v4 0/8] cmd: gpt: GPT manipulation improvements Joshua Watt
2023-08-28 21:56       ` [PATCH v4 1/8] cmd: gpt: Remove confusing help text Joshua Watt
2023-08-28 22:05         ` Heinrich Schuchardt
2023-08-28 21:56       ` [PATCH v4 2/8] doc: Add gpt command documentation Joshua Watt
2023-08-28 22:45         ` Heinrich Schuchardt
2023-08-28 22:59           ` Heinrich Schuchardt
2023-08-29 13:22             ` Joshua Watt
2023-08-28 21:56       ` Joshua Watt [this message]
2023-08-28 21:56       ` [PATCH v4 4/8] cmd: gpt: Add gpt_partition_bootable variable Joshua Watt
2023-08-28 21:56       ` [PATCH v4 5/8] cmd: gpt: Add command to set bootable flags Joshua Watt
2023-08-28 22:54         ` Heinrich Schuchardt
2023-08-29 13:24           ` Joshua Watt
2023-08-28 21:56       ` [PATCH v4 6/8] cmd: gpt: Preserve type GUID if enabled Joshua Watt
2023-08-28 21:56       ` [PATCH v4 7/8] cmd: gpt: Preserve bootable flag Joshua Watt
2023-08-28 21:56       ` [PATCH v4 8/8] cmd: gpt: Add command to swap partition order Joshua Watt
2023-08-31 16:51       ` [PATCH v5 0/8] cmd: gpt: GPT manipulation improvements Joshua Watt
2023-08-31 16:51         ` [PATCH v5 1/8] cmd: gpt: Remove confusing help text Joshua Watt
2023-08-31 16:51         ` [PATCH v5 2/8] doc: Add gpt command documentation Joshua Watt
2023-08-31 16:51         ` [PATCH v5 3/8] tests: gpt: Remove test order dependency Joshua Watt
2023-09-12 15:17           ` Tom Rini
2023-08-31 16:51         ` [PATCH v5 4/8] cmd: gpt: Add gpt_partition_bootable variable Joshua Watt
2023-08-31 16:51         ` [PATCH v5 5/8] cmd: gpt: Add command to set bootable flags Joshua Watt
2023-08-31 16:51         ` [PATCH v5 6/8] cmd: gpt: Preserve type GUID if enabled Joshua Watt
2023-08-31 16:51         ` [PATCH v5 7/8] cmd: gpt: Preserve bootable flag Joshua Watt
2023-08-31 16:51         ` [PATCH v5 8/8] cmd: gpt: Add command to swap partition order Joshua Watt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230828215623.3727536-4-JPEWhacker@gmail.com \
    --to=jpewhacker@gmail.com \
    --cc=eballetb@redhat.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox