From 53ab41a5f6d20e911362a9261ae528452bb71bbd Mon Sep 17 00:00:00 2001 From: Mariano Lopez Date: Tue, 1 Sep 2015 07:36:29 +0000 Subject: qemurunner: Added host dumps when there are errors This adds an instance of HostDumper to qemurunner, with this instance now is possible to get dumps from the host when there is an error. This adds dump points in the next cases: - runqemu exits before seeing qemu pid - Fail to get qemu process arguments - Not reach login banner before timeout - qemu pid never appears This also modifies the constructors of BaseDumper, HostDumper and TargetDumper, they don't require the datastore anymore, but the feature to replace datastore variables has been lost (never used) [YOCTO #8118] (From OE-Core rev: b0af40fb76cd5035696e9d8a44f815f64214d23a) Signed-off-by: Mariano Lopez Signed-off-by: Richard Purdie --- meta/lib/oeqa/utils/dump.py | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'meta/lib/oeqa/utils/dump.py') diff --git a/meta/lib/oeqa/utils/dump.py b/meta/lib/oeqa/utils/dump.py index e71e1cd341..6067438e35 100644 --- a/meta/lib/oeqa/utils/dump.py +++ b/meta/lib/oeqa/utils/dump.py @@ -6,30 +6,22 @@ import itertools from commands import runCmd def get_host_dumper(d): - return HostDumper(d) + cmds = d.getVar("testimage_dump_host", True) + parent_dir = d.getVar("TESTIMAGE_DUMP_DIR", True) + return HostDumper(cmds, parent_dir) class BaseDumper(object): - def __init__(self, d, cmds): + def __init__(self, cmds, parent_dir): self.cmds = [] - self.parent_dir = d.getVar("TESTIMAGE_DUMP_DIR", True) + self.parent_dir = parent_dir if not cmds: return for cmd in cmds.split('\n'): cmd = cmd.lstrip() if not cmd or cmd[0] == '#': continue - # Replae variables from the datastore - while True: - index_start = cmd.find("${") - if index_start == -1: - break - index_start += 2 - index_end = cmd.find("}", index_start) - var = cmd[index_start:index_end] - value = d.getVar(var, True) - cmd = cmd.replace("${%s}" % var, value) self.cmds.append(cmd) def create_dir(self, dir_suffix): @@ -62,9 +54,8 @@ class BaseDumper(object): class HostDumper(BaseDumper): - def __init__(self, d): - host_cmds = d.getVar("testimage_dump_host", True) - super(HostDumper, self).__init__(d, host_cmds) + def __init__(self, cmds, parent_dir): + super(HostDumper, self).__init__(cmds, parent_dir) def dump_host(self, dump_dir=""): if dump_dir: @@ -76,9 +67,8 @@ class HostDumper(BaseDumper): class TargetDumper(BaseDumper): - def __init__(self, d, qemurunner): - target_cmds = d.getVar("testimage_dump_target", True) - super(TargetDumper, self).__init__(d, target_cmds) + def __init__(self, cmds, parent_dir, qemurunner): + super(TargetDumper, self).__init__(cmds, parent_dir) self.runner = qemurunner def dump_target(self, dump_dir=""): -- cgit v1.2.3-54-g00ecf