diff mbox series

[v2,4/5] test/py: Update test_bind

Message ID 20200429122031.31279-5-patrice.chotard@st.com
State Superseded
Headers show
Series cmd: bind allow to bind driver with driver_data | expand

Commit Message

Patrice CHOTARD April 29, 2020, 12:20 p.m. UTC
As bind-test is now binded at sandbox startup and no more by
test_bind.py, bind-test nodes are not located at the end of
"dm tree" output, but can be located everywwhere in the tree, so
bind-test output could either be:

 simple_bus    0  [   ]   generic_simple_bus    |-- bind-test
 phy           0  [   ]   phy_sandbox           |   |-- bind-test-child1
 simple_bus    1  [   ]   generic_simple_bus    |   `-- bind-test-child2

or:

 simple_bus    5  [   ]   generic_simple_bus    `-- bind-test
 phy           2  [   ]   phy_sandbox               |-- bind-test-child1
 simple_bus    6  [   ]   generic_simple_bus        `-- bind-test-child2

in_tree() function need to be updated to take care of that change.

Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
---

Changes in v2: None

 test/py/tests/test_bind.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Simon Glass April 29, 2020, 6:04 p.m. UTC | #1
On Wed, 29 Apr 2020 at 06:20, Patrice Chotard <patrice.chotard at st.com> wrote:
>
> As bind-test is now binded at sandbox startup and no more by
> test_bind.py, bind-test nodes are not located at the end of
> "dm tree" output, but can be located everywwhere in the tree, so

everywhere

> bind-test output could either be:
>
>  simple_bus    0  [   ]   generic_simple_bus    |-- bind-test
>  phy           0  [   ]   phy_sandbox           |   |-- bind-test-child1
>  simple_bus    1  [   ]   generic_simple_bus    |   `-- bind-test-child2
>
> or:
>
>  simple_bus    5  [   ]   generic_simple_bus    `-- bind-test
>  phy           2  [   ]   phy_sandbox               |-- bind-test-child1
>  simple_bus    6  [   ]   generic_simple_bus        `-- bind-test-child2
>
> in_tree() function need to be updated to take care of that change.
>
> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
> ---
>
> Changes in v2: None
>
>  test/py/tests/test_bind.py | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>
Patrice CHOTARD April 30, 2020, 8:51 a.m. UTC | #2
Hi Simon

On 4/29/20 8:04 PM, Simon Glass wrote:
> On Wed, 29 Apr 2020 at 06:20, Patrice Chotard <patrice.chotard at st.com> wrote:
>> As bind-test is now binded at sandbox startup and no more by
>> test_bind.py, bind-test nodes are not located at the end of
>> "dm tree" output, but can be located everywwhere in the tree, so
> everywhere

will be fixed


Thanks

Patrice

>
>> bind-test output could either be:
>>
>>  simple_bus    0  [   ]   generic_simple_bus    |-- bind-test
>>  phy           0  [   ]   phy_sandbox           |   |-- bind-test-child1
>>  simple_bus    1  [   ]   generic_simple_bus    |   `-- bind-test-child2
>>
>> or:
>>
>>  simple_bus    5  [   ]   generic_simple_bus    `-- bind-test
>>  phy           2  [   ]   phy_sandbox               |-- bind-test-child1
>>  simple_bus    6  [   ]   generic_simple_bus        `-- bind-test-child2
>>
>> in_tree() function need to be updated to take care of that change.
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
>> ---
>>
>> Changes in v2: None
>>
>>  test/py/tests/test_bind.py | 15 +++++++++------
>>  1 file changed, 9 insertions(+), 6 deletions(-)
> Reviewed-by: Simon Glass <sjg at chromium.org>
diff mbox series

Patch

diff --git a/test/py/tests/test_bind.py b/test/py/tests/test_bind.py
index 0b7cd9a808..4753c7ea7b 100644
--- a/test/py/tests/test_bind.py
+++ b/test/py/tests/test_bind.py
@@ -7,13 +7,16 @@  import re
 
 def in_tree(response, name, uclass, drv, depth, last_child):
 	lines = [x.strip() for x in response.splitlines()]
-	leaf = ' ' * 4 * depth;
-	if not last_child:
-		leaf = leaf + r'\|'
-	else:
-		leaf = leaf + '`'
+	leaf = ''
+	if depth != 0:
+		leaf = '   ' + '    ' * (depth - 1) ;
+		if not last_child:
+			leaf = leaf + r'\|'
+		else:
+                        leaf = leaf + '`'
+
 	leaf = leaf + '-- ' + name
-	line = (r' *{:10.10}    [0-9]*  \[ [ +] \]   {:20.20}  {}$'
+	line = (r' *{:10.10}    [0-9]*  \[ [ +] \]   {:20.20}  [` |]{}$'
 	        .format(uclass, drv, leaf))
 	prog = re.compile(line)
 	for l in lines: