diff options
Diffstat (limited to 'meta/lib/oeqa/utils/dump.py')
-rw-r--r-- | meta/lib/oeqa/utils/dump.py | 28 |
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 | |||
6 | from commands import runCmd | 6 | from commands import runCmd |
7 | 7 | ||
8 | def get_host_dumper(d): | 8 | def 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 | ||
12 | class BaseDumper(object): | 14 | class 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 | ||
63 | class HostDumper(BaseDumper): | 55 | class 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 | ||
77 | class TargetDumper(BaseDumper): | 68 | class 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=""): |