diff mbox series

[RESEND,v2,2/4] test: Allow hush tests to run in parallel

Message ID 20210919211451.3825645-3-sjg@chromium.org
State Accepted
Commit ea3164eeb040bdff65323f8717f5dc2296f548a4
Delegated to: Tom Rini
Headers show
Series test: Try to deal with some co-dependent tests | expand

Commit Message

Simon Glass Sept. 19, 2021, 9:14 p.m. UTC
The -z tests don't really need to be part of the main set. Separate them
out so we can drop the test setup/cleans functions and thus run all tests
in parallel.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 test/py/tests/test_hush_if_test.py | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

Comments

Tom Rini Oct. 5, 2021, 10:02 p.m. UTC | #1
On Sun, Sep 19, 2021 at 03:14:49PM -0600, Simon Glass wrote:

> The -z tests don't really need to be part of the main set. Separate them
> out so we can drop the test setup/cleans functions and thus run all tests
> in parallel.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py
index d117921a6ac..37c1608bb22 100644
--- a/test/py/tests/test_hush_if_test.py
+++ b/test/py/tests/test_hush_if_test.py
@@ -119,11 +119,6 @@  subtests = (
     ('test ! ! aaa != aaa -o ! ! bbb = bbb', True),
     ('test ! ! aaa = aaa -o ! ! bbb != bbb', True),
     ('test ! ! aaa = aaa -o ! ! bbb = bbb', True),
-
-    # -z operator.
-
-    ('test -z "$ut_var_nonexistent"', True),
-    ('test -z "$ut_var_exists"', False),
 )
 
 def exec_hush_if(u_boot_console, expr, result):
@@ -141,12 +136,6 @@  def exec_hush_if(u_boot_console, expr, result):
     response = u_boot_console.run_command(cmd)
     assert response.strip() == str(result).lower()
 
-def test_hush_if_test_setup(u_boot_console):
-    """Set up environment variables used during the "if" tests."""
-
-    u_boot_console.run_command('setenv ut_var_nonexistent')
-    u_boot_console.run_command('setenv ut_var_exists 1')
-
 @pytest.mark.buildconfigspec('cmd_echo')
 @pytest.mark.parametrize('expr,result', subtests)
 def test_hush_if_test(u_boot_console, expr, result):
@@ -154,9 +143,12 @@  def test_hush_if_test(u_boot_console, expr, result):
 
     exec_hush_if(u_boot_console, expr, result)
 
-def test_hush_if_test_teardown(u_boot_console):
-    """Clean up environment variables used during the "if" tests."""
-
+def test_hush_z(u_boot_console):
+    """Test the -z operator"""
+    u_boot_console.run_command('setenv ut_var_nonexistent')
+    u_boot_console.run_command('setenv ut_var_exists 1')
+    exec_hush_if(u_boot_console, 'test -z "$ut_var_nonexistent"', True)
+    exec_hush_if(u_boot_console, 'test -z "$ut_var_exists"', False)
     u_boot_console.run_command('setenv ut_var_exists')
 
 # We might test this on real filesystems via UMS, DFU, 'save', etc.