summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/dump.py
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-09-01 07:36:29 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-03 12:43:16 +0100
commit53ab41a5f6d20e911362a9261ae528452bb71bbd (patch)
tree0962c78c4f378c3de0fc25810778a49f0a35d168 /meta/lib/oeqa/utils/dump.py
parent170b89d9863a1b8560f397d3bb7a1eafd7c61e1e (diff)
downloadpoky-53ab41a5f6d20e911362a9261ae528452bb71bbd.tar.gz
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 <mariano.lopez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils/dump.py')
-rw-r--r--meta/lib/oeqa/utils/dump.py28
1 files changed, 9 insertions, 19 deletions
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
6from commands import runCmd 6from commands import runCmd
7 7
8def get_host_dumper(d): 8def get_host_dumper(d):
9 return HostDumper(d) 9 cmds = d.getVar("testimage_dump_host", True)
10 parent_dir = d.getVar("TESTIMAGE_DUMP_DIR", True)
11 return HostDumper(cmds, parent_dir)
10 12
11 13
12class BaseDumper(object): 14class BaseDumper(object):
13 15
14 def __init__(self, d, cmds): 16 def __init__(self, cmds, parent_dir):
15 self.cmds = [] 17 self.cmds = []
16 self.parent_dir = d.getVar("TESTIMAGE_DUMP_DIR", True) 18 self.parent_dir = parent_dir
17 if not cmds: 19 if not cmds:
18 return 20 return
19 for cmd in cmds.split('\n'): 21 for cmd in cmds.split('\n'):
20 cmd = cmd.lstrip() 22 cmd = cmd.lstrip()
21 if not cmd or cmd[0] == '#': 23 if not cmd or cmd[0] == '#':
22 continue 24 continue
23 # Replae variables from the datastore
24 while True:
25 index_start = cmd.find("${")
26 if index_start == -1:
27 break
28 index_start += 2
29 index_end = cmd.find("}", index_start)
30 var = cmd[index_start:index_end]
31 value = d.getVar(var, True)
32 cmd = cmd.replace("${%s}" % var, value)
33 self.cmds.append(cmd) 25 self.cmds.append(cmd)
34 26
35 def create_dir(self, dir_suffix): 27 def create_dir(self, dir_suffix):
@@ -62,9 +54,8 @@ class BaseDumper(object):
62 54
63class HostDumper(BaseDumper): 55class HostDumper(BaseDumper):
64 56
65 def __init__(self, d): 57 def __init__(self, cmds, parent_dir):
66 host_cmds = d.getVar("testimage_dump_host", True) 58 super(HostDumper, self).__init__(cmds, parent_dir)
67 super(HostDumper, self).__init__(d, host_cmds)
68 59
69 def dump_host(self, dump_dir=""): 60 def dump_host(self, dump_dir=""):
70 if dump_dir: 61 if dump_dir:
@@ -76,9 +67,8 @@ class HostDumper(BaseDumper):
76 67
77class TargetDumper(BaseDumper): 68class TargetDumper(BaseDumper):
78 69
79 def __init__(self, d, qemurunner): 70 def __init__(self, cmds, parent_dir, qemurunner):
80 target_cmds = d.getVar("testimage_dump_target", True) 71 super(TargetDumper, self).__init__(cmds, parent_dir)
81 super(TargetDumper, self).__init__(d, target_cmds)
82 self.runner = qemurunner 72 self.runner = qemurunner
83 73
84 def dump_target(self, dump_dir=""): 74 def dump_target(self, dump_dir=""):