test/py: Add test support for three stage boot

Current pytest only support upto 2 stage boot;
Some boards like TI K3 am6/J7 boards use 3 stage
boot. This patch adds u_boot_spl2 to be able to
handle the 3-stage boot case. User needs to set
"env__spl2_skipped" in u_boot_boardenv config
file to use this support. By default it is set
to TRUE.

Signed-off-by: Yan Liu <yan-liu@ti.com>
Signed-off-by: Yan Liu <yan-liu@ti.com>
This commit is contained in:
Yan Liu 2020-07-21 11:12:05 -04:00 committed by Tom Rini
parent 44758771ee
commit c9db1a103c

View File

@ -17,6 +17,7 @@ import u_boot_spawn
# Regexes for text we expect U-Boot to send to the console. # 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_spl_signon = re.compile('(U-Boot SPL \\d{4}\\.\\d{2}[^\r\n]*\\))')
pattern_u_boot_spl2_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_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_stop_autoboot_prompt = re.compile('Hit any key to stop autoboot: ')
pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'') pattern_unknown_command = re.compile('Unknown command \'.*\' - try \'help\'')
@ -28,6 +29,7 @@ PAT_RE = 1
bad_pattern_defs = ( bad_pattern_defs = (
('spl_signon', pattern_u_boot_spl_signon), ('spl_signon', pattern_u_boot_spl_signon),
('spl2_signon', pattern_u_boot_spl2_signon),
('main_signon', pattern_u_boot_main_signon), ('main_signon', pattern_u_boot_main_signon),
('stop_autoboot_prompt', pattern_stop_autoboot_prompt), ('stop_autoboot_prompt', pattern_stop_autoboot_prompt),
('unknown_command', pattern_unknown_command), ('unknown_command', pattern_unknown_command),
@ -353,12 +355,20 @@ class ConsoleBase(object):
'n') == 'y' 'n') == 'y'
env_spl_skipped = self.config.env.get('env__spl_skipped', env_spl_skipped = self.config.env.get('env__spl_skipped',
False) False)
env_spl2_skipped = self.config.env.get('env__spl2_skipped',
True)
if config_spl and config_spl_serial_support and not env_spl_skipped: if config_spl and config_spl_serial_support and not env_spl_skipped:
m = self.p.expect([pattern_u_boot_spl_signon] + m = self.p.expect([pattern_u_boot_spl_signon] +
self.bad_patterns) self.bad_patterns)
if m != 0: if m != 0:
raise Exception('Bad pattern found on SPL console: ' + raise Exception('Bad pattern found on SPL console: ' +
self.bad_pattern_ids[m - 1]) self.bad_pattern_ids[m - 1])
if not env_spl2_skipped:
m = self.p.expect([pattern_u_boot_spl2_signon] +
self.bad_patterns)
if m != 0:
raise Exception('Bad pattern found on SPL2 console: ' +
self.bad_pattern_ids[m - 1])
m = self.p.expect([pattern_u_boot_main_signon] + self.bad_patterns) m = self.p.expect([pattern_u_boot_main_signon] + self.bad_patterns)
if m != 0: if m != 0:
raise Exception('Bad pattern found on console: ' + raise Exception('Bad pattern found on console: ' +