提交 e787a58f 编写于 作者: S Stephen Warren 提交者: Simon Glass

test/py: make crash detection more robust

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: NStephen Warren <swarren@nvidia.com>
Acked-by: NSimon Glass <sjg@chromium.org>
上级 c6db965f
......@@ -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])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册