From: Stephen Warren Date: Thu, 28 Jan 2016 06:57:47 +0000 (-0700) Subject: test/py: fix spawn.expect multiple match handling X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=44ac762b1437b274daf9e6f2dc924088b6332a54;p=u-boot.git test/py: fix spawn.expect multiple match handling 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 Acked-by: Simon Glass --- diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index d508075990..7451455671 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