diff options
Diffstat (limited to 'poky/meta/lib/oeqa/core')
-rw-r--r-- | poky/meta/lib/oeqa/core/context.py | 2 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/core/loader.py | 2 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/core/runner.py | 14 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/core/target/qemu.py | 4 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/core/target/ssh.py | 9 | ||||
-rw-r--r-- | poky/meta/lib/oeqa/core/utils/concurrencytest.py | 23 |
6 files changed, 32 insertions, 22 deletions
diff --git a/poky/meta/lib/oeqa/core/context.py b/poky/meta/lib/oeqa/core/context.py index 4705d608a..7d3fa3b84 100644 --- a/poky/meta/lib/oeqa/core/context.py +++ b/poky/meta/lib/oeqa/core/context.py @@ -156,6 +156,8 @@ class OETestContextExecutor(object): fh = logging.FileHandler(args.output_log) fh.setFormatter(formatter) logger.addHandler(fh) + if getattr(args, 'verbose', False): + logger.setLevel('DEBUG') return logger diff --git a/poky/meta/lib/oeqa/core/loader.py b/poky/meta/lib/oeqa/core/loader.py index 0d7970d49..11978213b 100644 --- a/poky/meta/lib/oeqa/core/loader.py +++ b/poky/meta/lib/oeqa/core/loader.py @@ -46,7 +46,7 @@ def _built_modules_dict(modules): for module in modules: # Assumption: package and module names do not contain upper case # characters, whereas class names do - m = re.match(r'^(\w+)(?:\.(\w[^.]*)(?:\.([^.]+))?)?$', module, flags=re.ASCII) + m = re.match(r'^([0-9a-z_.]+)(?:\.(\w[^.]*)(?:\.([^.]+))?)?$', module, flags=re.ASCII) if not m: continue diff --git a/poky/meta/lib/oeqa/core/runner.py b/poky/meta/lib/oeqa/core/runner.py index 00b7d0bb1..d50690ab3 100644 --- a/poky/meta/lib/oeqa/core/runner.py +++ b/poky/meta/lib/oeqa/core/runner.py @@ -195,6 +195,20 @@ class OETestResult(_TestResult): report['log'] = log if duration: report['duration'] = duration + + alltags = [] + # pull tags from the case class + if hasattr(case, "__oeqa_testtags"): + alltags.extend(getattr(case, "__oeqa_testtags")) + # pull tags from the method itself + test_name = case._testMethodName + if hasattr(case, test_name): + method = getattr(case, test_name) + if hasattr(method, "__oeqa_testtags"): + alltags.extend(getattr(method, "__oeqa_testtags")) + if alltags: + report['oetags'] = alltags + if dump_streams and case.id() in self.logged_output: (stdout, stderr) = self.logged_output[case.id()] report['stdout'] = stdout diff --git a/poky/meta/lib/oeqa/core/target/qemu.py b/poky/meta/lib/oeqa/core/target/qemu.py index 295e8765e..0f29414df 100644 --- a/poky/meta/lib/oeqa/core/target/qemu.py +++ b/poky/meta/lib/oeqa/core/target/qemu.py @@ -12,6 +12,7 @@ from collections import defaultdict from .ssh import OESSHTarget from oeqa.utils.qemurunner import QemuRunner +from oeqa.utils.dump import TargetDumper supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic'] @@ -42,6 +43,9 @@ class OEQemuTarget(OESSHTarget): dump_host_cmds=dump_host_cmds, logger=logger, serial_ports=serial_ports, boot_patterns = boot_patterns, use_ovmf=ovmf) + dump_target_cmds = kwargs.get("testimage_dump_target") + self.target_dumper = TargetDumper(dump_target_cmds, dump_dir, self.runner) + self.target_dumper.create_dir("qemu") def start(self, params=None, extra_bootparams=None, runqemuparams=''): if self.use_slirp and not self.server_ip: diff --git a/poky/meta/lib/oeqa/core/target/ssh.py b/poky/meta/lib/oeqa/core/target/ssh.py index 090b40a81..461448dbc 100644 --- a/poky/meta/lib/oeqa/core/target/ssh.py +++ b/poky/meta/lib/oeqa/core/target/ssh.py @@ -88,6 +88,8 @@ class OESSHTarget(OETarget): status, output = self._run(sshCmd, processTimeout, True) self.logger.debug('Command: %s\nOutput: %s\n' % (command, output)) + if (status == 255) and (('No route to host') in output): + self.target_dumper.dump_target() return (status, output) def copyTo(self, localSrc, remoteDst): @@ -107,13 +109,16 @@ class OESSHTarget(OETarget): scpCmd = self.scp + [localSrc, remotePath] return self._run(scpCmd, ignore_status=False) - def copyFrom(self, remoteSrc, localDst): + def copyFrom(self, remoteSrc, localDst, warn_on_failure=False): """ Copy file from target. """ remotePath = '%s@%s:%s' % (self.user, self.ip, remoteSrc) scpCmd = self.scp + [remotePath, localDst] - return self._run(scpCmd, ignore_status=False) + (status, output) = self._run(scpCmd, ignore_status=warn_on_failure) + if warn_on_failure and status: + self.logger.warning("Copy returned non-zero exit status %d:\n%s" % (status, output)) + return (status, output) def copyDirTo(self, localSrc, remoteDst): """ diff --git a/poky/meta/lib/oeqa/core/utils/concurrencytest.py b/poky/meta/lib/oeqa/core/utils/concurrencytest.py index 01c39830f..b2eb68fb0 100644 --- a/poky/meta/lib/oeqa/core/utils/concurrencytest.py +++ b/poky/meta/lib/oeqa/core/utils/concurrencytest.py @@ -183,10 +183,11 @@ class dummybuf(object): # class ConcurrentTestSuite(unittest.TestSuite): - def __init__(self, suite, processes, setupfunc): + def __init__(self, suite, processes, setupfunc, removefunc): super(ConcurrentTestSuite, self).__init__([suite]) self.processes = processes self.setupfunc = setupfunc + self.removefunc = removefunc def run(self, result): tests, totaltests = fork_for_tests(self.processes, self) @@ -237,22 +238,6 @@ class ConcurrentTestSuite(unittest.TestSuite): finally: queue.put(test) -def removebuilddir(d): - delay = 5 - while delay and os.path.exists(d + "/bitbake.lock"): - time.sleep(1) - delay = delay - 1 - # Deleting these directories takes a lot of time, use autobuilder - # clobberdir if its available - clobberdir = os.path.expanduser("~/yocto-autobuilder-helper/janitor/clobberdir") - if os.path.exists(clobberdir): - try: - subprocess.check_call([clobberdir, d]) - return - except subprocess.CalledProcessError: - pass - bb.utils.prunedir(d, ionice=True) - def fork_for_tests(concurrency_num, suite): result = [] if 'BUILDDIR' in os.environ: @@ -297,7 +282,7 @@ def fork_for_tests(concurrency_num, suite): if ourpid != os.getpid(): os._exit(0) if newbuilddir and unittest_result.wasSuccessful(): - removebuilddir(newbuilddir) + suite.removefunc(newbuilddir) except: # Don't do anything with process children if ourpid != os.getpid(): @@ -313,7 +298,7 @@ def fork_for_tests(concurrency_num, suite): sys.stderr.write(traceback.format_exc()) finally: if newbuilddir: - removebuilddir(newbuilddir) + suite.removefunc(newbuilddir) stream.flush() os._exit(1) stream.flush() |