mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
test/py: Shorten u_boot_console
This fixture name is quite long and results in lots of verbose code. We know this is U-Boot so the 'u_boot_' part is not necessary. But it is also a bit of a misnomer, since it provides access to all the information available to tests. It is not just the console. It would be too confusing to use con as it would be confused with config and it is probably too short. So shorten it to 'ubman'. Signed-off-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/u-boot/CAFLszTgPa4aT_J9h9pqeTtLCVn4x2JvLWRcWRD8NaN3uoSAtyA@mail.gmail.com/
This commit is contained in:
@@ -506,24 +506,24 @@ Writing tests
|
||||
Please refer to the pytest documentation for details of writing pytest tests.
|
||||
Details specific to the U-Boot test suite are described below.
|
||||
|
||||
A test fixture named `u_boot_console` should be used by each test function. This
|
||||
A test fixture named `ubman` should be used by each test function. This
|
||||
provides the means to interact with the U-Boot console, and retrieve board and
|
||||
environment configuration information.
|
||||
|
||||
The function `u_boot_console.run_command()` executes a shell command on the
|
||||
The function `ubman.run_command()` executes a shell command on the
|
||||
U-Boot console, and returns all output from that command. This allows
|
||||
validation or interpretation of the command output. This function validates
|
||||
that certain strings are not seen on the U-Boot console. These include shell
|
||||
error messages and the U-Boot sign-on message (in order to detect unexpected
|
||||
board resets). See the source of `u_boot_console_base.py` for a complete list of
|
||||
"bad" strings. Some test scenarios are expected to trigger these strings. Use
|
||||
`u_boot_console.disable_check()` to temporarily disable checking for specific
|
||||
`ubman.disable_check()` to temporarily disable checking for specific
|
||||
strings. See `test_unknown_cmd.py` for an example.
|
||||
|
||||
Board- and board-environment configuration values may be accessed as sub-fields
|
||||
of the `u_boot_console.config` object, for example
|
||||
`u_boot_console.config.ram_base`.
|
||||
of the `ubman.config` object, for example
|
||||
`ubman.config.ram_base`.
|
||||
|
||||
Build configuration values (from `.config`) may be accessed via the dictionary
|
||||
`u_boot_console.config.buildconfig`, with keys equal to the Kconfig variable
|
||||
`ubman.config.buildconfig`, with keys equal to the Kconfig variable
|
||||
names.
|
||||
|
||||
@@ -116,19 +116,19 @@ below are approximate, as measured on an AMD 2950X system. Here is is the test
|
||||
in Python::
|
||||
|
||||
@pytest.mark.buildconfigspec('cmd_memory')
|
||||
def test_md(u_boot_console):
|
||||
def test_md(ubman):
|
||||
"""Test that md reads memory as expected, and that memory can be modified
|
||||
using the mw command."""
|
||||
|
||||
ram_base = u_boot_utils.find_ram_base(u_boot_console)
|
||||
ram_base = u_boot_utils.find_ram_base(ubman)
|
||||
addr = '%08x' % ram_base
|
||||
val = 'a5f09876'
|
||||
expected_response = addr + ': ' + val
|
||||
u_boot_console.run_command('mw ' + addr + ' 0 10')
|
||||
response = u_boot_console.run_command('md ' + addr + ' 10')
|
||||
ubman.run_command('mw ' + addr + ' 0 10')
|
||||
response = ubman.run_command('md ' + addr + ' 10')
|
||||
assert(not (expected_response in response))
|
||||
u_boot_console.run_command('mw ' + addr + ' ' + val)
|
||||
response = u_boot_console.run_command('md ' + addr + ' 10')
|
||||
ubman.run_command('mw ' + addr + ' ' + val)
|
||||
response = ubman.run_command('md ' + addr + ' 10')
|
||||
assert(expected_response in response)
|
||||
|
||||
This runs a few commands and checks the output. Note that it runs a command,
|
||||
|
||||
Reference in New Issue
Block a user