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
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: