summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/oetest.py32
1 files changed, 15 insertions, 17 deletions
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index a3f297acf6..dfed3dea87 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -122,21 +122,18 @@ class oeRuntimeTest(oeTest):
122 # If a test fails or there is an exception 122 # If a test fails or there is an exception
123 if (self._resultForDoCleanups.failures or 123 if (self._resultForDoCleanups.failures or
124 self._resultForDoCleanups.errors): 124 self._resultForDoCleanups.errors):
125 commands = ["top -bn1", "ps", "free", "df", "_ping", "dmesg", "netstat -a", "ifconfig -a", "_logs"] 125 self.dump_target_logs()
126 dump_dir = "/tmp/oe-saved-tests" 126
127 dump_dir = os.path.join(dump_dir, 127 def dump_target_logs(self):
128 datetime.datetime.now().strftime('%Y%m%d%H%M')) 128 commands = ["top -bn1", "ps", "free", "df", "_ping", "dmesg", "netstat -a", "ifconfig -a", "_logs"]
129 os.makedirs(dump_dir) 129 dump_dir = "/tmp/oe-saved-tests"
130 bb.warn("Test failed, getting data from target " 130 dump_sub_dir = ("%s_%s" % (
131 "and saving it in %s" % dump_dir) 131 datetime.datetime.now().strftime('%Y%m%d%H%M'),
132 output = self.run_bulk_commands(commands) 132 self._testMethodName))
133 for key,msg in output.iteritems(): 133 dump_dir = os.path.join(dump_dir, dump_sub_dir)
134 filename = key.split()[0] 134 os.makedirs(dump_dir)
135 with open(os.path.join(dump_dir, filename), 'w') as f: 135 bb.warn("%s failed: getting data from target and "
136 f.write(msg) 136 "saving into %s" % (self._testMethodName, dump_dir))
137
138 def run_bulk_commands(self, commands):
139 all_output = {}
140 for command in commands: 137 for command in commands:
141 # This will ping the host from target 138 # This will ping the host from target
142 if command == "_ping": 139 if command == "_ping":
@@ -151,8 +148,9 @@ class oeRuntimeTest(oeTest):
151 else: 148 else:
152 comm = command 149 comm = command
153 (status, output) = self.target.run_serial(comm) 150 (status, output) = self.target.run_serial(comm)
154 all_output[command] = output 151 filename = command.split()[0]
155 return all_output 152 with open(os.path.join(dump_dir, filename), 'w') as f:
153 f.write(output)
156 154
157 #TODO: use package_manager.py to install packages on any type of image 155 #TODO: use package_manager.py to install packages on any type of image
158 def install_packages(self, packagelist): 156 def install_packages(self, packagelist):