diff mbox

[U-Boot,2/9] test/py: fix spawn.expect multiple match handling

Message ID 1453964274-9129-2-git-send-email-swarren@wwwdotorg.org
State Accepted
Commit 44ac762b1437b274daf9e6f2dc924088b6332a54
Delegated to: Simon Glass
Headers show

Commit Message

Stephen Warren Jan. 28, 2016, 6:57 a.m. UTC
From: Stephen Warren <swarren@nvidia.com>

Multiple patterns may be passed to spawn.expect(). The pattern which
matches at the earliest position should be designated as the match. This
aspect works correctly. When multiple patterns match at the same position,
priority should be given the the earliest entry in the list of patterns.
This aspect does not work correctly. This patch fixes it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 test/py/u_boot_spawn.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass Jan. 29, 2016, 3:47 a.m. UTC | #1
On 27 January 2016 at 23:57, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> Multiple patterns may be passed to spawn.expect(). The pattern which
> matches at the earliest position should be designated as the match. This
> aspect works correctly. When multiple patterns match at the same position,
> priority should be given the the earliest entry in the list of patterns.
> This aspect does not work correctly. This patch fixes it.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  test/py/u_boot_spawn.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Jan. 29, 2016, 4:02 a.m. UTC | #2
On 28 January 2016 at 20:47, Simon Glass <sjg@chromium.org> wrote:
> On 27 January 2016 at 23:57, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> Multiple patterns may be passed to spawn.expect(). The pattern which
>> matches at the earliest position should be designated as the match. This
>> aspect works correctly. When multiple patterns match at the same position,
>> priority should be given the the earliest entry in the list of patterns.
>> This aspect does not work correctly. This patch fixes it.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>>  test/py/u_boot_spawn.py | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!
diff mbox

Patch

diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index d50807599027..7451455671b9 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -132,7 +132,7 @@  class Spawn(object):
                     m = pattern.search(self.buf)
                     if not m:
                         continue
-                    if earliest_m and m.start() > earliest_m.start():
+                    if earliest_m and m.start() >= earliest_m.start():
                         continue
                     earliest_m = m
                     earliest_pi = pi