All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] test/py: make crash detection more robust
@ 2016-01-25 22:07 Stephen Warren
  2016-01-26  1:07 ` Simon Glass
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2016-01-25 22:07 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

test/py contains logic to detect the target crashing and rebooting by
searching the console output for a U-Boot signon message, which will
presumably be emitted when the system boots after the crash/reset.

Currently, this logic only searches for the exact signon message that
was printed by the U-Boot version under test, upon the assumption that
binary is written into flash, and hence will be the version booted after
any reset. However, this is not a valid assumption; some test setups
download the U-Boot-under-test into RAM and boot it from there, and in
such a scenario an arbitrary U-Boot version may be located in flash and
hence run after any reset.

Fix the reset detection logic to match any U-Boot signon message. This
prevents false negatives.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 test/py/u_boot_console_base.py | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index 51163bc0db68..bb834b0d34ab 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -150,12 +150,11 @@ class ConsoleBase(object):
 
         bad_patterns = []
         bad_pattern_ids = []
-        if (self.disable_check_count['spl_signon'] == 0 and
-                self.u_boot_spl_signon):
-            bad_patterns.append(self.u_boot_spl_signon_escaped)
+        if (self.disable_check_count['spl_signon'] == 0):
+            bad_patterns.append(pattern_u_boot_spl_signon)
             bad_pattern_ids.append('SPL signon')
         if self.disable_check_count['main_signon'] == 0:
-            bad_patterns.append(self.u_boot_main_signon_escaped)
+            bad_patterns.append(pattern_u_boot_main_signon)
             bad_pattern_ids.append('U-Boot main signon')
         if self.disable_check_count['unknown_command'] == 0:
             bad_patterns.append(pattern_unknown_command)
@@ -299,18 +298,13 @@ class ConsoleBase(object):
             self.p.logfile_read = self.logstream
             if self.config.buildconfig.get('CONFIG_SPL', False) == 'y':
                 self.p.expect([pattern_u_boot_spl_signon])
-                self.u_boot_spl_signon = self.p.after
-                self.u_boot_spl_signon_escaped = re.escape(self.p.after)
-            else:
-                self.u_boot_spl_signon = None
             self.p.expect([pattern_u_boot_main_signon])
-            self.u_boot_main_signon = self.p.after
-            self.u_boot_main_signon_escaped = re.escape(self.p.after)
-            build_idx = self.u_boot_main_signon.find(', Build:')
+            signon = self.p.after
+            build_idx = signon.find(', Build:')
             if build_idx == -1:
-                self.u_boot_version_string = self.u_boot_main_signon
+                self.u_boot_version_string = signon
             else:
-                self.u_boot_version_string = self.u_boot_main_signon[:build_idx]
+                self.u_boot_version_string = signon[:build_idx]
             while True:
                 match = self.p.expect([self.prompt_escaped,
                                        pattern_stop_autoboot_prompt])
-- 
2.7.0

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

* [U-Boot] [PATCH] test/py: make crash detection more robust
  2016-01-25 22:07 [U-Boot] [PATCH] test/py: make crash detection more robust Stephen Warren
@ 2016-01-26  1:07 ` Simon Glass
  2016-01-26  1:11   ` Stephen Warren
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2016-01-26  1:07 UTC (permalink / raw)
  To: u-boot

Hi Stephen,

On 25 January 2016 at 15:07, Stephen Warren <swarren@wwwdotorg.org> wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> test/py contains logic to detect the target crashing and rebooting by
> searching the console output for a U-Boot signon message, which will
> presumably be emitted when the system boots after the crash/reset.
>
> Currently, this logic only searches for the exact signon message that
> was printed by the U-Boot version under test, upon the assumption that
> binary is written into flash, and hence will be the version booted after
> any reset. However, this is not a valid assumption; some test setups
> download the U-Boot-under-test into RAM and boot it from there, and in
> such a scenario an arbitrary U-Boot version may be located in flash and
> hence run after any reset.
>
> Fix the reset detection logic to match any U-Boot signon message. This
> prevents false negatives.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  test/py/u_boot_console_base.py | 20 +++++++-------------
>  1 file changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
> index 51163bc0db68..bb834b0d34ab 100644
> --- a/test/py/u_boot_console_base.py
> +++ b/test/py/u_boot_console_base.py
> @@ -150,12 +150,11 @@ class ConsoleBase(object):
>
>          bad_patterns = []
>          bad_pattern_ids = []
> -        if (self.disable_check_count['spl_signon'] == 0 and
> -                self.u_boot_spl_signon):
> -            bad_patterns.append(self.u_boot_spl_signon_escaped)
> +        if (self.disable_check_count['spl_signon'] == 0):
> +            bad_patterns.append(pattern_u_boot_spl_signon)
>              bad_pattern_ids.append('SPL signon')
>          if self.disable_check_count['main_signon'] == 0:
> -            bad_patterns.append(self.u_boot_main_signon_escaped)
> +            bad_patterns.append(pattern_u_boot_main_signon)
>              bad_pattern_ids.append('U-Boot main signon')
>          if self.disable_check_count['unknown_command'] == 0:
>              bad_patterns.append(pattern_unknown_command)
> @@ -299,18 +298,13 @@ class ConsoleBase(object):
>              self.p.logfile_read = self.logstream
>              if self.config.buildconfig.get('CONFIG_SPL', False) == 'y':
>                  self.p.expect([pattern_u_boot_spl_signon])
> -                self.u_boot_spl_signon = self.p.after
> -                self.u_boot_spl_signon_escaped = re.escape(self.p.after)
> -            else:
> -                self.u_boot_spl_signon = None
>              self.p.expect([pattern_u_boot_main_signon])
> -            self.u_boot_main_signon = self.p.after
> -            self.u_boot_main_signon_escaped = re.escape(self.p.after)
> -            build_idx = self.u_boot_main_signon.find(', Build:')
> +            signon = self.p.after
> +            build_idx = signon.find(', Build:')
>              if build_idx == -1:
> -                self.u_boot_version_string = self.u_boot_main_signon
> +                self.u_boot_version_string = signon
>              else:
> -                self.u_boot_version_string = self.u_boot_main_signon[:build_idx]
> +                self.u_boot_version_string = signon[:build_idx]
>              while True:
>                  match = self.p.expect([self.prompt_escaped,
>                                         pattern_stop_autoboot_prompt])
> --
> 2.7.0
>

Can you add comments as to what exactly you are looking for? Just 'Build: '?

Regards,
Simon

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

* [U-Boot] [PATCH] test/py: make crash detection more robust
  2016-01-26  1:07 ` Simon Glass
@ 2016-01-26  1:11   ` Stephen Warren
  2016-01-26  1:17     ` Simon Glass
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2016-01-26  1:11 UTC (permalink / raw)
  To: u-boot

On 01/25/2016 06:07 PM, Simon Glass wrote:
> Hi Stephen,
>
> On 25 January 2016 at 15:07, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> test/py contains logic to detect the target crashing and rebooting by
>> searching the console output for a U-Boot signon message, which will
>> presumably be emitted when the system boots after the crash/reset.
>>
>> Currently, this logic only searches for the exact signon message that
>> was printed by the U-Boot version under test, upon the assumption that
>> binary is written into flash, and hence will be the version booted after
>> any reset. However, this is not a valid assumption; some test setups
>> download the U-Boot-under-test into RAM and boot it from there, and in
>> such a scenario an arbitrary U-Boot version may be located in flash and
>> hence run after any reset.
>>
>> Fix the reset detection logic to match any U-Boot signon message. This
>> prevents false negatives.
>>
>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>> ---
>>   test/py/u_boot_console_base.py | 20 +++++++-------------
>>   1 file changed, 7 insertions(+), 13 deletions(-)
>>
>> diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
>> index 51163bc0db68..bb834b0d34ab 100644
>> --- a/test/py/u_boot_console_base.py
>> +++ b/test/py/u_boot_console_base.py
>> @@ -150,12 +150,11 @@ class ConsoleBase(object):
>>
>>           bad_patterns = []
>>           bad_pattern_ids = []
>> -        if (self.disable_check_count['spl_signon'] == 0 and
>> -                self.u_boot_spl_signon):
>> -            bad_patterns.append(self.u_boot_spl_signon_escaped)
>> +        if (self.disable_check_count['spl_signon'] == 0):
>> +            bad_patterns.append(pattern_u_boot_spl_signon)
>>               bad_pattern_ids.append('SPL signon')
>>           if self.disable_check_count['main_signon'] == 0:
>> -            bad_patterns.append(self.u_boot_main_signon_escaped)
>> +            bad_patterns.append(pattern_u_boot_main_signon)
>>               bad_pattern_ids.append('U-Boot main signon')
>>           if self.disable_check_count['unknown_command'] == 0:
>>               bad_patterns.append(pattern_unknown_command)
>> @@ -299,18 +298,13 @@ class ConsoleBase(object):
>>               self.p.logfile_read = self.logstream
>>               if self.config.buildconfig.get('CONFIG_SPL', False) == 'y':
>>                   self.p.expect([pattern_u_boot_spl_signon])
>> -                self.u_boot_spl_signon = self.p.after
>> -                self.u_boot_spl_signon_escaped = re.escape(self.p.after)
>> -            else:
>> -                self.u_boot_spl_signon = None
>>               self.p.expect([pattern_u_boot_main_signon])
>> -            self.u_boot_main_signon = self.p.after
>> -            self.u_boot_main_signon_escaped = re.escape(self.p.after)
>> -            build_idx = self.u_boot_main_signon.find(', Build:')
>> +            signon = self.p.after
>> +            build_idx = signon.find(', Build:')
>>               if build_idx == -1:
>> -                self.u_boot_version_string = self.u_boot_main_signon
>> +                self.u_boot_version_string = signon
>>               else:
>> -                self.u_boot_version_string = self.u_boot_main_signon[:build_idx]
>> +                self.u_boot_version_string = signon[:build_idx]
>>               while True:
>>                   match = self.p.expect([self.prompt_escaped,
>>                                          pattern_stop_autoboot_prompt])
>> --
>> 2.7.0
>>
>
> Can you add comments as to what exactly you are looking for? Just 'Build: '?

The pattern is at the top of the file, so very easy to find simply by 
reading the assignment to pattern_u_boot_main_signon. I don't think 
adding a comment would be terribly useful in case it got stale.

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

* [U-Boot] [PATCH] test/py: make crash detection more robust
  2016-01-26  1:11   ` Stephen Warren
@ 2016-01-26  1:17     ` Simon Glass
  2016-01-29  4:01       ` Simon Glass
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2016-01-26  1:17 UTC (permalink / raw)
  To: u-boot

Hi Stephen,

On 25 January 2016 at 18:11, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 01/25/2016 06:07 PM, Simon Glass wrote:
>>
>> Hi Stephen,
>>
>> On 25 January 2016 at 15:07, Stephen Warren <swarren@wwwdotorg.org> wrote:
>>>
>>> From: Stephen Warren <swarren@nvidia.com>
>>>
>>> test/py contains logic to detect the target crashing and rebooting by
>>> searching the console output for a U-Boot signon message, which will
>>> presumably be emitted when the system boots after the crash/reset.
>>>
>>> Currently, this logic only searches for the exact signon message that
>>> was printed by the U-Boot version under test, upon the assumption that
>>> binary is written into flash, and hence will be the version booted after
>>> any reset. However, this is not a valid assumption; some test setups
>>> download the U-Boot-under-test into RAM and boot it from there, and in
>>> such a scenario an arbitrary U-Boot version may be located in flash and
>>> hence run after any reset.
>>>
>>> Fix the reset detection logic to match any U-Boot signon message. This
>>> prevents false negatives.
>>>
>>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>>> ---
>>>   test/py/u_boot_console_base.py | 20 +++++++-------------
>>>   1 file changed, 7 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/test/py/u_boot_console_base.py
>>> b/test/py/u_boot_console_base.py
>>> index 51163bc0db68..bb834b0d34ab 100644
>>> --- a/test/py/u_boot_console_base.py
>>> +++ b/test/py/u_boot_console_base.py
>>> @@ -150,12 +150,11 @@ class ConsoleBase(object):
>>>
>>>           bad_patterns = []
>>>           bad_pattern_ids = []
>>> -        if (self.disable_check_count['spl_signon'] == 0 and
>>> -                self.u_boot_spl_signon):
>>> -            bad_patterns.append(self.u_boot_spl_signon_escaped)
>>> +        if (self.disable_check_count['spl_signon'] == 0):
>>> +            bad_patterns.append(pattern_u_boot_spl_signon)
>>>               bad_pattern_ids.append('SPL signon')
>>>           if self.disable_check_count['main_signon'] == 0:
>>> -            bad_patterns.append(self.u_boot_main_signon_escaped)
>>> +            bad_patterns.append(pattern_u_boot_main_signon)
>>>               bad_pattern_ids.append('U-Boot main signon')
>>>           if self.disable_check_count['unknown_command'] == 0:
>>>               bad_patterns.append(pattern_unknown_command)
>>> @@ -299,18 +298,13 @@ class ConsoleBase(object):
>>>               self.p.logfile_read = self.logstream
>>>               if self.config.buildconfig.get('CONFIG_SPL', False) == 'y':
>>>                   self.p.expect([pattern_u_boot_spl_signon])
>>> -                self.u_boot_spl_signon = self.p.after
>>> -                self.u_boot_spl_signon_escaped = re.escape(self.p.after)
>>> -            else:
>>> -                self.u_boot_spl_signon = None
>>>               self.p.expect([pattern_u_boot_main_signon])
>>> -            self.u_boot_main_signon = self.p.after
>>> -            self.u_boot_main_signon_escaped = re.escape(self.p.after)
>>> -            build_idx = self.u_boot_main_signon.find(', Build:')
>>> +            signon = self.p.after
>>> +            build_idx = signon.find(', Build:')
>>>               if build_idx == -1:
>>> -                self.u_boot_version_string = self.u_boot_main_signon
>>> +                self.u_boot_version_string = signon
>>>               else:
>>> -                self.u_boot_version_string =
>>> self.u_boot_main_signon[:build_idx]
>>> +                self.u_boot_version_string = signon[:build_idx]
>>>               while True:
>>>                   match = self.p.expect([self.prompt_escaped,
>>>                                          pattern_stop_autoboot_prompt])
>>> --
>>> 2.7.0
>>>
>>
>> Can you add comments as to what exactly you are looking for? Just 'Build:
>> '?
>
>
> The pattern is at the top of the file, so very easy to find simply by
> reading the assignment to pattern_u_boot_main_signon. I don't think adding a
> comment would be terribly useful in case it got stale.

OK it's a regex. That makes sense.

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

Regards,
Simon

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

* [U-Boot] [PATCH] test/py: make crash detection more robust
  2016-01-26  1:17     ` Simon Glass
@ 2016-01-29  4:01       ` Simon Glass
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2016-01-29  4:01 UTC (permalink / raw)
  To: u-boot

On 25 January 2016 at 18:17, Simon Glass <sjg@chromium.org> wrote:
> Hi Stephen,
>
> On 25 January 2016 at 18:11, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 01/25/2016 06:07 PM, Simon Glass wrote:
>>>
>>> Hi Stephen,
>>>
>>> On 25 January 2016 at 15:07, Stephen Warren <swarren@wwwdotorg.org> wrote:
>>>>
>>>> From: Stephen Warren <swarren@nvidia.com>
>>>>
>>>> test/py contains logic to detect the target crashing and rebooting by
>>>> searching the console output for a U-Boot signon message, which will
>>>> presumably be emitted when the system boots after the crash/reset.
>>>>
>>>> Currently, this logic only searches for the exact signon message that
>>>> was printed by the U-Boot version under test, upon the assumption that
>>>> binary is written into flash, and hence will be the version booted after
>>>> any reset. However, this is not a valid assumption; some test setups
>>>> download the U-Boot-under-test into RAM and boot it from there, and in
>>>> such a scenario an arbitrary U-Boot version may be located in flash and
>>>> hence run after any reset.
>>>>
>>>> Fix the reset detection logic to match any U-Boot signon message. This
>>>> prevents false negatives.
>>>>
>>>> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>>>> ---
>>>>   test/py/u_boot_console_base.py | 20 +++++++-------------
>>>>   1 file changed, 7 insertions(+), 13 deletions(-)

Applied to u-boot-dm, thanks!

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

end of thread, other threads:[~2016-01-29  4:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-25 22:07 [U-Boot] [PATCH] test/py: make crash detection more robust Stephen Warren
2016-01-26  1:07 ` Simon Glass
2016-01-26  1:11   ` Stephen Warren
2016-01-26  1:17     ` Simon Glass
2016-01-29  4:01       ` 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.