doc: pytest: Document the test_bootstage test
Add this test to the documentation. We need to move the import to follow the main comment so that it renders correctly, and add a code-block annotation to the example and indent it correctly. Next, neither of the functions had comments themselves, so document them now. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:

committed by
Heinrich Schuchardt

parent
45d325ba09
commit
58b2f0895b
@@ -18,5 +18,6 @@ Individual tests
|
|||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
test_000_version
|
test_000_version
|
||||||
|
test_bootstage
|
||||||
test_net
|
test_net
|
||||||
test_net_boot
|
test_net_boot
|
||||||
|
8
doc/develop/pytest/test_bootstage.rst
Normal file
8
doc/develop/pytest/test_bootstage.rst
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
test_bootstage
|
||||||
|
==============
|
||||||
|
|
||||||
|
.. automodule:: test_bootstage
|
||||||
|
:synopsis:
|
||||||
|
:member-order: bysource
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
@@ -1,8 +1,6 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
# (C) Copyright 2023, Advanced Micro Devices, Inc.
|
# (C) Copyright 2023, Advanced Micro Devices, Inc.
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Test the bootstage command.
|
Test the bootstage command.
|
||||||
|
|
||||||
@@ -15,16 +13,32 @@ common/bootstage.c). Without this, bootstage stash and unstash tests will be
|
|||||||
automatically skipped.
|
automatically skipped.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
env__bootstage_cmd_file = {
|
|
||||||
'addr': 0x200000,
|
.. code-block:: python
|
||||||
'size': 0x1000,
|
|
||||||
'bootstage_magic_addr': 0xb00757a3,
|
env__bootstage_cmd_file = {
|
||||||
}
|
'addr': 0x200000,
|
||||||
|
'size': 0x1000,
|
||||||
|
'bootstage_magic_addr': 0xb00757a3,
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
@pytest.mark.buildconfigspec('bootstage')
|
@pytest.mark.buildconfigspec('bootstage')
|
||||||
@pytest.mark.buildconfigspec('cmd_bootstage')
|
@pytest.mark.buildconfigspec('cmd_bootstage')
|
||||||
def test_bootstage_report(ubman):
|
def test_bootstage_report(ubman):
|
||||||
|
"""Test the bootstage report subcommand
|
||||||
|
|
||||||
|
This will run the 'bootstage report' subcommand and ensure that we are
|
||||||
|
reporting:
|
||||||
|
|
||||||
|
- A timer summary in microseconds
|
||||||
|
- The accumulated time
|
||||||
|
- That at least the phrase 'dm_r' is in the output
|
||||||
|
|
||||||
|
Note that the time values are not checked.
|
||||||
|
"""
|
||||||
output = ubman.run_command('bootstage report')
|
output = ubman.run_command('bootstage report')
|
||||||
assert 'Timer summary in microseconds' in output
|
assert 'Timer summary in microseconds' in output
|
||||||
assert 'Accumulated time:' in output
|
assert 'Accumulated time:' in output
|
||||||
@@ -34,6 +48,13 @@ def test_bootstage_report(ubman):
|
|||||||
@pytest.mark.buildconfigspec('cmd_bootstage')
|
@pytest.mark.buildconfigspec('cmd_bootstage')
|
||||||
@pytest.mark.buildconfigspec('bootstage_stash')
|
@pytest.mark.buildconfigspec('bootstage_stash')
|
||||||
def test_bootstage_stash_and_unstash(ubman):
|
def test_bootstage_stash_and_unstash(ubman):
|
||||||
|
"""Test the bootstage stash and unstash subcommands
|
||||||
|
|
||||||
|
After checking that we have configured an environment file to use, we will
|
||||||
|
use the stash subcommand to save information. Then we will use the md
|
||||||
|
command to verify the contents in memory. Finally we confirm the unstash
|
||||||
|
subcommand runs successfully.
|
||||||
|
"""
|
||||||
f = ubman.config.env.get('env__bootstage_cmd_file', None)
|
f = ubman.config.env.get('env__bootstage_cmd_file', None)
|
||||||
if not f:
|
if not f:
|
||||||
pytest.skip('No bootstage environment file is defined')
|
pytest.skip('No bootstage environment file is defined')
|
||||||
|
Reference in New Issue
Block a user