oetest: Change logic of a failed test

Currently the logic to check if a test failed was
to check for an exception in the thread, but some
decorators used in the syslog runtime test would
generate and handle exceptions; this will mess
with the current check logic and will dump the
host and the target as if the test failed.

This patch changes the check logic to verify if
the test that just happend is in the failure test
list and dump the host and target accordingly.

[YOCTO #8406]

(From OE-Core rev: 8b97d9320b989023c62db8246f5d8d2126c3723e)

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mariano Lopez 2015-09-28 11:53:18 +00:00 committed by Richard Purdie
parent 7a6cb2ed3a
commit df09a6f4e3

View File

@ -16,8 +16,7 @@ try:
except ImportError: except ImportError:
pass pass
import logging import logging
from oeqa.utils.decorators import LogResults, gettag from oeqa.utils.decorators import LogResults, gettag, getResults
from sys import exc_info, exc_clear
logger = logging.getLogger("BitBake") logger = logging.getLogger("BitBake")
@ -184,17 +183,18 @@ class oeRuntimeTest(oeTest):
pass pass
def tearDown(self): def tearDown(self):
# If a test fails or there is an exception res = getResults()
if not exc_info() == (None, None, None): # If a test fails or there is an exception dump
exc_clear() # for QemuTarget only
#Only dump for QemuTarget if (type(self.target).__name__ == "QemuTarget" and
if (type(self.target).__name__ == "QemuTarget"): (self.id() in res.getErrorList() or
self.tc.host_dumper.create_dir(self._testMethodName) self.id() in res.getFailList())):
self.tc.host_dumper.dump_host() self.tc.host_dumper.create_dir(self._testMethodName)
self.target.target_dumper.dump_target( self.tc.host_dumper.dump_host()
self.tc.host_dumper.dump_dir) self.target.target_dumper.dump_target(
print ("%s dump data stored in %s" % (self._testMethodName, self.tc.host_dumper.dump_dir)
self.tc.host_dumper.dump_dir)) print ("%s dump data stored in %s" % (self._testMethodName,
self.tc.host_dumper.dump_dir))
#TODO: use package_manager.py to install packages on any type of image #TODO: use package_manager.py to install packages on any type of image
def install_packages(self, packagelist): def install_packages(self, packagelist):