All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2 1/2] test/py: fix off-by-one error in spawn matching code
@ 2016-02-06  1:04 Stephen Warren
  2016-02-06  1:04 ` [U-Boot] [PATCH V2 2/2] test/py: capture the entire U-Boot version at boot Stephen Warren
  2016-02-06 20:30 ` [U-Boot] [PATCH V2 1/2] test/py: fix off-by-one error in spawn matching code Simon Glass
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Warren @ 2016-02-06  1:04 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

A regex match object's .end() value is already the index after the match,
not the index of the last character in the match, so there's no need to
add 1 to point past the match.

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

diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index 4b9e81af3efb..3d9cde5ee0d0 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -142,7 +142,7 @@ class Spawn(object):
                     earliest_pi = pi
                 if earliest_m:
                     pos = earliest_m.start()
-                    posafter = earliest_m.end() + 1
+                    posafter = earliest_m.end()
                     self.before = self.buf[:pos]
                     self.after = self.buf[pos:posafter]
                     self.buf = self.buf[posafter:]
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V2 2/2] test/py: capture the entire U-Boot version at boot
  2016-02-06  1:04 [U-Boot] [PATCH V2 1/2] test/py: fix off-by-one error in spawn matching code Stephen Warren
@ 2016-02-06  1:04 ` Stephen Warren
  2016-02-06 20:30   ` Simon Glass
  2016-02-06 20:30 ` [U-Boot] [PATCH V2 1/2] test/py: fix off-by-one error in spawn matching code Simon Glass
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Warren @ 2016-02-06  1:04 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

The existing regex simply ensures that the captured version string doesn't
go past the end of a line. We really want to grab as much as possible. Do
this by explicitly including a ) character at the end of the regex to
match the last character of the version test.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v2: Also remove some now-redundant code. The signon regex now never
matches the text ", Build: ...", so there's no need for explicit code to
chop it out.
---
 test/py/u_boot_console_base.py | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index cc5427335177..7e1e9d430ffa 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -17,8 +17,8 @@ import sys
 import u_boot_spawn
 
 # Regexes for text we expect U-Boot to send to the console.
-pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}-[^\r\n]*)')
-pattern_u_boot_main_signon = re.compile('(U-Boot \\d{4}\\.\\d{2}-[^\r\n]*)')
+pattern_u_boot_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))')
+pattern_u_boot_main_signon = re.compile('(U-Boot \\d{4}\\.\\d{2}[^\r\n]*\\))')
 pattern_stop_autoboot_prompt = re.compile('Hit any key to stop autoboot: ')
 pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'')
 pattern_error_notification = re.compile('## Error: ')
@@ -312,12 +312,7 @@ class ConsoleBase(object):
             if m != 0:
                 raise Exception('Bad pattern found on console: ' +
                                 self.bad_pattern_ids[m - 1])
-            signon = self.p.after
-            build_idx = signon.find(', Build:')
-            if build_idx == -1:
-                self.u_boot_version_string = signon
-            else:
-                self.u_boot_version_string = signon[:build_idx]
+            self.u_boot_version_string = self.p.after
             while True:
                 m = self.p.expect([self.prompt_escaped,
                     pattern_stop_autoboot_prompt] + self.bad_patterns)
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V2 1/2] test/py: fix off-by-one error in spawn matching code
  2016-02-06  1:04 [U-Boot] [PATCH V2 1/2] test/py: fix off-by-one error in spawn matching code Stephen Warren
  2016-02-06  1:04 ` [U-Boot] [PATCH V2 2/2] test/py: capture the entire U-Boot version at boot Stephen Warren
@ 2016-02-06 20:30 ` Simon Glass
  2016-02-06 20:44   ` Simon Glass
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Glass @ 2016-02-06 20:30 UTC (permalink / raw)
  To: u-boot

On 5 February 2016 at 18:04, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> A regex match object's .end() value is already the index after the match,
> not the index of the last character in the match, so there's no need to
> add 1 to point past the match.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> v2: New patch.
> ---
>  test/py/u_boot_spawn.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V2 2/2] test/py: capture the entire U-Boot version at boot
  2016-02-06  1:04 ` [U-Boot] [PATCH V2 2/2] test/py: capture the entire U-Boot version at boot Stephen Warren
@ 2016-02-06 20:30   ` Simon Glass
  2016-02-06 20:45     ` Simon Glass
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2016-02-06 20:30 UTC (permalink / raw)
  To: u-boot

On 5 February 2016 at 18:04, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> The existing regex simply ensures that the captured version string doesn't
> go past the end of a line. We really want to grab as much as possible. Do
> this by explicitly including a ) character at the end of the regex to
> match the last character of the version test.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> v2: Also remove some now-redundant code. The signon regex now never
> matches the text ", Build: ...", so there's no need for explicit code to
> chop it out.
> ---
>  test/py/u_boot_console_base.py | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V2 1/2] test/py: fix off-by-one error in spawn matching code
  2016-02-06 20:30 ` [U-Boot] [PATCH V2 1/2] test/py: fix off-by-one error in spawn matching code Simon Glass
@ 2016-02-06 20:44   ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2016-02-06 20:44 UTC (permalink / raw)
  To: u-boot

On 6 February 2016 at 13:30, Simon Glass <sjg@chromium.org> wrote:
> On 5 February 2016 at 18:04, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> A regex match object's .end() value is already the index after the match,
>> not the index of the last character in the match, so there's no need to
>> add 1 to point past the match.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>> v2: New patch.
>> ---
>>  test/py/u_boot_spawn.py | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>
> Tested on sandbox:
> Tested-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH V2 2/2] test/py: capture the entire U-Boot version at boot
  2016-02-06 20:30   ` Simon Glass
@ 2016-02-06 20:45     ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2016-02-06 20:45 UTC (permalink / raw)
  To: u-boot

On 6 February 2016 at 13:30, Simon Glass <sjg@chromium.org> wrote:
> On 5 February 2016 at 18:04, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> The existing regex simply ensures that the captured version string doesn't
>> go past the end of a line. We really want to grab as much as possible. Do
>> this by explicitly including a ) character at the end of the regex to
>> match the last character of the version test.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>> v2: Also remove some now-redundant code. The signon regex now never
>> matches the text ", Build: ...", so there's no need for explicit code to
>> chop it out.
>> ---
>>  test/py/u_boot_console_base.py | 11 +++--------
>>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>
> Tested on sandbox:
> Tested-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-06 20:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-06  1:04 [U-Boot] [PATCH V2 1/2] test/py: fix off-by-one error in spawn matching code Stephen Warren
2016-02-06  1:04 ` [U-Boot] [PATCH V2 2/2] test/py: capture the entire U-Boot version at boot Stephen Warren
2016-02-06 20:30   ` Simon Glass
2016-02-06 20:45     ` Simon Glass
2016-02-06 20:30 ` [U-Boot] [PATCH V2 1/2] test/py: fix off-by-one error in spawn matching code Simon Glass
2016-02-06 20:44   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.