Skip to contentSkip to conversation

test/py: only check for SPL signature if SPL uses serial output

PATCH Superseded Heiko Schocher 2 participants 2 messages Feb 16, 2016

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test/py: only check for SPL signature if SPL uses serial output

check for U-Boot SPL signature only if SPL really has a serial output. So check if CONFIG_SPL_SERIAL_SUPPORT is active in board config.

---
found this while trying test/py on the smartweb board, which has SPL but no SPL serial output.

 test/py/u_boot_console_base.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
test/py/u_boot_console_base.py +7 -4
index bc2bd76..f888d5c 100644
@@ -304,10 +304,13 @@ class ConsoleBase(object):
                 self.p.timeout = 30000
             self.p.logfile_read = self.logstream
             if self.config.buildconfig.get('config_spl', False) == 'y':
-                m = self.p.expect([pattern_u_boot_spl_signon] + self.bad_patterns)
-                if m != 0:
-                    raise Exception('Bad pattern found on console: ' +
-                                    self.bad_pattern_ids[m - 1])
+                if self.config.buildconfig.get('config_spl_serial_support',
+                                               False) == 'y':
+                    m = self.p.expect([pattern_u_boot_spl_signon] +
+                                      self.bad_patterns)
+                    if m != 0:
+                        raise Exception('Bad pattern found on console: ' +
+                                        self.bad_pattern_ids[m - 1])
             m = self.p.expect([pattern_u_boot_main_signon] + self.bad_patterns)
             if m != 0:
                 raise Exception('Bad pattern found on console: ' +
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/1 test/py: only check for SPL signature if SPL uses serial output

Quoted 3 lines · Heiko Schocher

check for U-Boot SPL signature only if SPL really has a serial output. So check if CONFIG_SPL_SERIAL_SUPPORT is active in board config.

Nit: That's wrapped really narrow. Any chance of wrapping to more like 72-74 characters?

Quoted 5 lines
test/py/u_boot_console_base.py +0 -1
index bc2bd76..f888d5c 100644
 
              if self.config.buildconfig.get('config_spl', False) == 'y':
-                m = self.p.expect([pattern_u_boot_spl_signon] + self.bad_patterns)

test/py/u_boot_console_base.py class ConsoleBase(object): · line 313

Quoted 10 lines
test/py/u_boot_console_base.py +7 -3
-                if m != 0:
-                    raise Exception('Bad pattern found on console: ' +
-                                    self.bad_pattern_ids[m - 1])
+                if self.config.buildconfig.get('config_spl_serial_support',
+                                               False) == 'y':
+                    m = self.p.expect([pattern_u_boot_spl_signon] +
+                                      self.bad_patterns)
+                    if m != 0:
+                        raise Exception('Bad pattern found on console: ' +
+                                        self.bad_pattern_ids[m - 1])

Conceptually this change looks fine. Rather than using nested ifs, why not write "if a and b:" and so avoid adding an extra indent level? I'd also introduce some variables to shorten the text a bit:

bcfg = u_boot_console.config.buildconfig
if bcfg.get('config_spl', 'n') == 'y' and

         bcfg.get('config_spl_serial_support', 'n') == 'y':
     ...

or:

bcfg = u_boot_console.config.buildconfig
config_spl = bcfg.get('config_spl', 'n') == 'y' config_spl_serial_support = bcfg.get('config_spl_serial_support',

     'n') == 'y'
if config_spl and config_spl_serial_support:
     ...