doc: pytest: Document the test_bind test
Add this test to the documentation. None of the functions had comments, so attempt to explain what each does. 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
6c3c08c478
commit
4964cc9caa
@@ -18,6 +18,7 @@ Individual tests
|
|||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
test_000_version
|
test_000_version
|
||||||
|
test_bind
|
||||||
test_bootstage
|
test_bootstage
|
||||||
test_efi_loader
|
test_efi_loader
|
||||||
test_net
|
test_net
|
||||||
|
8
doc/develop/pytest/test_bind.rst
Normal file
8
doc/develop/pytest/test_bind.rst
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
test_bind
|
||||||
|
=========
|
||||||
|
|
||||||
|
.. automodule:: test_bind
|
||||||
|
:synopsis:
|
||||||
|
:member-order: bysource
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
@@ -7,6 +7,7 @@ import re
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
def in_tree(response, name, uclass, drv, depth, last_child):
|
def in_tree(response, name, uclass, drv, depth, last_child):
|
||||||
|
"""A helper function to confirm contents of the device tree """
|
||||||
lines = [x.strip() for x in response.splitlines()]
|
lines = [x.strip() for x in response.splitlines()]
|
||||||
leaf = ''
|
leaf = ''
|
||||||
if depth != 0:
|
if depth != 0:
|
||||||
@@ -28,7 +29,12 @@ def in_tree(response, name, uclass, drv, depth, last_child):
|
|||||||
@pytest.mark.boardspec('sandbox')
|
@pytest.mark.boardspec('sandbox')
|
||||||
@pytest.mark.buildconfigspec('cmd_bind')
|
@pytest.mark.buildconfigspec('cmd_bind')
|
||||||
def test_bind_unbind_with_node(ubman):
|
def test_bind_unbind_with_node(ubman):
|
||||||
|
"""Test the bind and unbind commands of a node
|
||||||
|
|
||||||
|
Verify that the dm tree output contains some expected nodes, and then bind
|
||||||
|
and unbind a USB via node device while verifying that the dm tree output
|
||||||
|
matches the expected values at each step.
|
||||||
|
"""
|
||||||
tree = ubman.run_command('dm tree')
|
tree = ubman.run_command('dm tree')
|
||||||
assert in_tree(tree, 'bind-test', 'simple_bus', 'simple_bus', 0, True)
|
assert in_tree(tree, 'bind-test', 'simple_bus', 'simple_bus', 0, True)
|
||||||
assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False)
|
assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False)
|
||||||
@@ -106,6 +112,7 @@ def test_bind_unbind_with_node(ubman):
|
|||||||
assert response == ''
|
assert response == ''
|
||||||
|
|
||||||
def get_next_line(tree, name):
|
def get_next_line(tree, name):
|
||||||
|
"""A helper function to strip content out of dm tree output"""
|
||||||
treelines = [x.strip() for x in tree.splitlines() if x.strip()]
|
treelines = [x.strip() for x in tree.splitlines() if x.strip()]
|
||||||
child_line = ''
|
child_line = ''
|
||||||
for idx, line in enumerate(treelines):
|
for idx, line in enumerate(treelines):
|
||||||
@@ -121,6 +128,11 @@ def get_next_line(tree, name):
|
|||||||
@pytest.mark.buildconfigspec('cmd_bind')
|
@pytest.mark.buildconfigspec('cmd_bind')
|
||||||
@pytest.mark.singlethread
|
@pytest.mark.singlethread
|
||||||
def test_bind_unbind_with_uclass(ubman):
|
def test_bind_unbind_with_uclass(ubman):
|
||||||
|
"""Test the bind and unbind commands of a class
|
||||||
|
|
||||||
|
Bind and unbind the simple_bus class while verifying that the dm tree
|
||||||
|
output matches the expected values at each step.
|
||||||
|
"""
|
||||||
#bind /bind-test
|
#bind /bind-test
|
||||||
response = ubman.run_command('bind /bind-test simple_bus')
|
response = ubman.run_command('bind /bind-test simple_bus')
|
||||||
assert response == ''
|
assert response == ''
|
||||||
|
Reference in New Issue
Block a user