aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/oetest.py
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2015-08-12 13:48:09 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-16 09:24:24 +0100
commit73c98d38e94d3b1407620c134f3b00dcd9d6132c (patch)
tree710773ac7b06c6d643fc856113c3f4bffaeb5ae8 /meta/lib/oeqa/oetest.py
parent8bbfef69828d9b053e2a33dfa9d8318d9572cf6b (diff)
downloadopenembedded-core-contrib-73c98d38e94d3b1407620c134f3b00dcd9d6132c.tar.gz
oetest.py: Don't wait to write dump files
This allows to write the dump files immediately after get the data from the target. Before this, it would run all the commands and write the files. The old behavior could cause no log written at all if the serial console gets stuck. Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/lib/oeqa/oetest.py')
-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):
# If a test fails or there is an exception
if (self._resultForDoCleanups.failures or
self._resultForDoCleanups.errors):
- commands = ["top -bn1", "ps", "free", "df", "_ping", "dmesg", "netstat -a", "ifconfig -a", "_logs"]
- dump_dir = "/tmp/oe-saved-tests"
- dump_dir = os.path.join(dump_dir,
- datetime.datetime.now().strftime('%Y%m%d%H%M'))
- os.makedirs(dump_dir)
- bb.warn("Test failed, getting data from target "
- "and saving it in %s" % dump_dir)
- output = self.run_bulk_commands(commands)
- for key,msg in output.iteritems():
- filename = key.split()[0]
- with open(os.path.join(dump_dir, filename), 'w') as f:
- f.write(msg)
-
- def run_bulk_commands(self, commands):
- all_output = {}
+ self.dump_target_logs()
+
+ def dump_target_logs(self):
+ commands = ["top -bn1", "ps", "free", "df", "_ping", "dmesg", "netstat -a", "ifconfig -a", "_logs"]
+ dump_dir = "/tmp/oe-saved-tests"
+ dump_sub_dir = ("%s_%s" % (
+ datetime.datetime.now().strftime('%Y%m%d%H%M'),
+ self._testMethodName))
+ dump_dir = os.path.join(dump_dir, dump_sub_dir)
+ os.makedirs(dump_dir)
+ bb.warn("%s failed: getting data from target and "
+ "saving into %s" % (self._testMethodName, dump_dir))
for command in commands:
# This will ping the host from target
if command == "_ping":
@@ -151,8 +148,9 @@ class oeRuntimeTest(oeTest):
else:
comm = command
(status, output) = self.target.run_serial(comm)
- all_output[command] = output
- return all_output
+ filename = command.split()[0]
+ with open(os.path.join(dump_dir, filename), 'w') as f:
+ f.write(output)
#TODO: use package_manager.py to install packages on any type of image
def install_packages(self, packagelist):