]> git.sur5r.net Git - u-boot/commitdiff
test/py: fix spawn.expect multiple match handling
authorStephen Warren <swarren@nvidia.com>
Thu, 28 Jan 2016 06:57:47 +0000 (23:57 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 29 Jan 2016 04:01:24 +0000 (21:01 -0700)
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>
Acked-by: Simon Glass <sjg@chromium.org>
test/py/u_boot_spawn.py

index d508075990272f3bc0f9f3ed30e169a215784381..7451455671b9b52ab6797949f4de2cfaf712f1a9 100644 (file)
@@ -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