From: <rs@ti.com>
To: <robertcnelson@gmail.com>, <ayush@beagleboard.org>,
<Erik.Welsh@octavosystems.com>, <anshuld@ti.com>, <bb@ti.com>,
<trini@konsulko.com>, <afd@ti.com>, <xypron.glpk@gmx.de>,
<ilias.apalodimas@linaro.org>, <sjg@chromium.org>
Cc: <u-boot@lists.denx.de>
Subject: [PATCHv10 2/4] test_ut: add a ut_ubman fixture to clean up tests
Date: Thu, 4 Jun 2026 10:50:36 -0500 [thread overview]
Message-ID: <20260604155038.3182-3-rs@ti.com> (raw)
In-Reply-To: <20260604155038.3182-1-rs@ti.com>
From: Randolph Sapp <rs@ti.com>
Add a ut_ubman fixture to clean up after certain problematic tests
without negatively affecting the current assert based testing.
Currently this catches "bootstd bootflow_cmd_boot" and "bootstd
bootflow_scan_boot" ut_subtests, as these will change the sandbox state
a little too much to be recoverable from.
Signed-off-by: Randolph Sapp <rs@ti.com>
---
v10:
- Init
---
test/py/tests/test_ut.py | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index dce5a37dd35..fa50c8008a5 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -631,7 +631,23 @@ def test_ut_dm_init_bootstd(ubman):
ubman.restart_uboot()
-def test_ut(ubman, ut_subtest):
+@pytest.fixture(name="ut_ubman")
+def ut_ubman_fixture(ubman, ut_subtest):
+ """Fixture to restart the sandbox after known problematic tests.
+
+ Args:
+ ubman (ConsoleBase): U-Boot console
+ ut_subtest (str): test to be executed via command ut, e.g 'foo bar' to
+ execute command 'ut foo bar'
+ """
+
+ yield ubman
+
+ if ut_subtest in ("bootstd bootflow_cmd_boot", "bootstd bootflow_scan_boot"):
+ ubman.restart_uboot()
+
+
+def test_ut(ut_ubman, ut_subtest):
"""Execute a "ut" subtest.
The subtests are collected in function generate_ut_subtest() from linker
@@ -644,18 +660,18 @@ def test_ut(ubman, ut_subtest):
implemented in C function foo_test_bar().
Args:
- ubman (ConsoleBase): U-Boot console
+ ut_ubman (ConsoleBase): U-Boot console
ut_subtest (str): test to be executed via command ut, e.g 'foo bar' to
execute command 'ut foo bar'
"""
if ut_subtest == 'hush hush_test_simple_dollar':
# ut hush hush_test_simple_dollar prints "Unknown command" on purpose.
- with ubman.disable_check('unknown_command'):
- output = ubman.run_command('ut ' + ut_subtest)
+ with ut_ubman.disable_check('unknown_command'):
+ output = ut_ubman.run_command('ut ' + ut_subtest)
assert 'Unknown command \'quux\' - try \'help\'' in output
else:
- output = ubman.run_command('ut ' + ut_subtest)
+ output = ut_ubman.run_command('ut ' + ut_subtest)
assert output.endswith('failures: 0')
lastline = output.splitlines()[-1]
if "skipped: 0," not in lastline:
--
2.54.0
next prev parent reply other threads:[~2026-06-04 15:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 15:50 [PATCHv10 0/4] various memory related fixups rs
2026-06-04 15:50 ` [PATCHv10 1/4] boot: image-fdt: free old dtb reservations rs
2026-06-04 15:50 ` rs [this message]
2026-06-14 11:47 ` [PATCHv10 2/4] test_ut: add a ut_ubman fixture to clean up tests Simon Glass
2026-06-04 15:50 ` [PATCHv10 3/4] test: boot: add a fdt reserved region check rs
2026-06-04 15:50 ` [PATCHv10 4/4] memory: reserve from start_addr_sp to initial_relocaddr rs
2026-06-04 20:19 ` Ilias Apalodimas
2026-06-04 20:31 ` Ilias Apalodimas
2026-06-15 18:53 ` [PATCHv10 0/4] various memory related fixups Tom Rini
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=20260604155038.3182-3-rs@ti.com \
--to=rs@ti.com \
--cc=Erik.Welsh@octavosystems.com \
--cc=afd@ti.com \
--cc=anshuld@ti.com \
--cc=ayush@beagleboard.org \
--cc=bb@ti.com \
--cc=ilias.apalodimas@linaro.org \
--cc=robertcnelson@gmail.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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