diff mbox series

[v2,5/5] test/py: Add usb gadget binding test

Message ID 20210419094534.9748-6-patrice.chotard@foss.st.com
State New
Delegated to: Lukasz Majewski
Headers show
Series cmd: bind: Fix driver binding | expand

Commit Message

Patrice CHOTARD April 19, 2021, 9:45 a.m. UTC
Add a specific usb gadget binding test which check that
binding a driver without compatible string is working as expected.

the command "bind /usb@1 usb_ether" should give the following "dm tree"
command output:

[...]
 usb           0  [   ]   usb_sandbox           |-- usb@1
 usb_hub       0  [   ]   usb_hub               |   |-- hub
 usb_emul      0  [   ]   usb_sandbox_hub       |   |   `-- hub-emul
 usb_emul      1  [   ]   usb_sandbox_flash     |   |       |-- flash-stick@0
 usb_emul      2  [   ]   usb_sandbox_flash     |   |       |-- flash-stick@1
 usb_emul      3  [   ]   usb_sandbox_flash     |   |       |-- flash-stick@2
 usb_emul      4  [   ]   usb_sandbox_keyb      |   |       `-- keyb@3
 eth           4  [   ]   usb_ether             |   `-- usb@1
[...]

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Herbert Poetzl <herbert@13thfloor.at>

---

Changes in v2:
  - add bind test

 test/py/tests/test_bind.py | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Simon Glass April 29, 2021, 4:10 p.m. UTC | #1
On Mon, 19 Apr 2021 at 02:58, Patrice Chotard
<patrice.chotard@foss.st.com> wrote:
>
> Add a specific usb gadget binding test which check that
> binding a driver without compatible string is working as expected.
>
> the command "bind /usb@1 usb_ether" should give the following "dm tree"
> command output:
>
> [...]
>  usb           0  [   ]   usb_sandbox           |-- usb@1
>  usb_hub       0  [   ]   usb_hub               |   |-- hub
>  usb_emul      0  [   ]   usb_sandbox_hub       |   |   `-- hub-emul
>  usb_emul      1  [   ]   usb_sandbox_flash     |   |       |-- flash-stick@0
>  usb_emul      2  [   ]   usb_sandbox_flash     |   |       |-- flash-stick@1
>  usb_emul      3  [   ]   usb_sandbox_flash     |   |       |-- flash-stick@2
>  usb_emul      4  [   ]   usb_sandbox_keyb      |   |       `-- keyb@3
>  eth           4  [   ]   usb_ether             |   `-- usb@1
> [...]
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Herbert Poetzl <herbert@13thfloor.at>
>
> ---
>
> Changes in v2:
>   - add bind test
>
>  test/py/tests/test_bind.py | 7 +++++++
>  1 file changed, 7 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/test/py/tests/test_bind.py b/test/py/tests/test_bind.py
index 6703325c0b..56edd78863 100644
--- a/test/py/tests/test_bind.py
+++ b/test/py/tests/test_bind.py
@@ -33,6 +33,13 @@  def test_bind_unbind_with_node(u_boot_console):
 	assert in_tree(tree, 'bind-test-child1', 'phy', 'phy_sandbox', 1, False)
 	assert in_tree(tree, 'bind-test-child2', 'simple_bus', 'simple_bus', 1, True)
 
+	#bind usb_ether driver (which has no compatible) to usb@1 node.
+	##New entry usb_ether should appear in the dm tree
+	response = u_boot_console.run_command('bind  /usb@1 usb_ether')
+	assert response == ''
+	tree = u_boot_console.run_command('dm tree')
+	assert in_tree(tree, 'usb@1', 'eth', 'usb_ether', 1, True)
+
 	#Unbind child #1. No error expected and all devices should be there except for bind-test-child1
 	response = u_boot_console.run_command('unbind  /bind-test/bind-test-child1')
 	assert response == ''