summaryrefslogtreecommitdiff
path: root/poky/meta/lib/oeqa/utils
diff options
context:
space:
mode:
Diffstat (limited to 'poky/meta/lib/oeqa/utils')
-rw-r--r--poky/meta/lib/oeqa/utils/dump.py20
-rw-r--r--poky/meta/lib/oeqa/utils/gitarchive.py6
-rw-r--r--poky/meta/lib/oeqa/utils/nfs.py4
-rw-r--r--poky/meta/lib/oeqa/utils/qemurunner.py22
4 files changed, 11 insertions, 41 deletions
diff --git a/poky/meta/lib/oeqa/utils/dump.py b/poky/meta/lib/oeqa/utils/dump.py
index d420b497f9..d4d271369f 100644
--- a/poky/meta/lib/oeqa/utils/dump.py
+++ b/poky/meta/lib/oeqa/utils/dump.py
@@ -51,9 +51,7 @@ class BaseDumper(object):
self.dump_dir = dump_dir
def _construct_filename(self, command):
- if isinstance(self, HostDumper):
- prefix = "host"
- elif isinstance(self, TargetDumper):
+ if isinstance(self, TargetDumper):
prefix = "target"
elif isinstance(self, MonitorDumper):
prefix = "qmp"
@@ -76,22 +74,6 @@ class BaseDumper(object):
with open(fullname, 'w') as dump_file:
dump_file.write(output)
-class HostDumper(BaseDumper):
- """ Class to get dumps from the host running the tests """
-
- def __init__(self, cmds, parent_dir):
- super(HostDumper, self).__init__(cmds, parent_dir)
-
- def dump_host(self, dump_dir=""):
- if dump_dir:
- self.dump_dir = dump_dir
- env = os.environ.copy()
- env['PATH'] = '/usr/sbin:/sbin:/usr/bin:/bin'
- env['COLUMNS'] = '9999'
- for cmd in self.cmds:
- result = runCmd(cmd, ignore_status=True, env=env)
- self._write_dump(cmd.split()[0], result.output)
-
class TargetDumper(BaseDumper):
""" Class to get dumps from target, it only works with QemuRunner.
Will give up permanently after 5 errors from running commands over
diff --git a/poky/meta/lib/oeqa/utils/gitarchive.py b/poky/meta/lib/oeqa/utils/gitarchive.py
index 6e8040eb5c..73beafecb5 100644
--- a/poky/meta/lib/oeqa/utils/gitarchive.py
+++ b/poky/meta/lib/oeqa/utils/gitarchive.py
@@ -116,7 +116,8 @@ def expand_tag_strings(repo, name_pattern, msg_subj_pattern, msg_body_pattern,
tag_re = tag_re.format(tag_number='(?P<tag_number>[0-9]{1,5})')
keyws['tag_number'] = 0
- for existing_tag in repo.run_cmd('tag').splitlines():
+ tags_refs = repo.run_cmd(['ls-remote', '--refs', '--tags', '-q'])
+ for existing_tag in ["".join(d.split()[1].split('/', 2)[2:]) for d in tags_refs.splitlines()]:
match = re.match(tag_re, existing_tag)
if match and int(match.group('tag_number')) >= keyws['tag_number']:
@@ -181,7 +182,8 @@ def get_test_runs(log, repo, tag_name, **kwargs):
# Get a list of all matching tags
tag_pattern = tag_name.format(**str_fields)
- tags = repo.run_cmd(['tag', '-l', tag_pattern]).splitlines()
+ revs = repo.run_cmd(['ls-remote', '--refs', '--tags', 'origin', '-q', tag_pattern]).splitlines()
+ tags = ["".join(d.split()[1].split('/', 2)[2:]) for d in revs]
log.debug("Found %d tags matching pattern '%s'", len(tags), tag_pattern)
# Parse undefined fields from tag names
diff --git a/poky/meta/lib/oeqa/utils/nfs.py b/poky/meta/lib/oeqa/utils/nfs.py
index b66ed42a58..903469bfee 100644
--- a/poky/meta/lib/oeqa/utils/nfs.py
+++ b/poky/meta/lib/oeqa/utils/nfs.py
@@ -12,7 +12,7 @@ from oeqa.utils.commands import bitbake, get_bb_var, Command
from oeqa.utils.network import get_free_port
@contextlib.contextmanager
-def unfs_server(directory, logger = None):
+def unfs_server(directory, logger = None, udp = True):
unfs_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "unfs3-native")
if not os.path.exists(os.path.join(unfs_sysroot, "usr", "bin", "unfsd")):
# build native tool
@@ -26,7 +26,7 @@ def unfs_server(directory, logger = None):
exports.write("{0} (rw,no_root_squash,no_all_squash,insecure)\n".format(directory).encode())
# find some ports for the server
- nfsport, mountport = get_free_port(udp = True), get_free_port(udp = True)
+ nfsport, mountport = get_free_port(udp), get_free_port(udp)
nenv = dict(os.environ)
nenv['PATH'] = "{0}/sbin:{0}/usr/sbin:{0}/usr/bin:".format(unfs_sysroot) + nenv.get('PATH', '')
diff --git a/poky/meta/lib/oeqa/utils/qemurunner.py b/poky/meta/lib/oeqa/utils/qemurunner.py
index 8bb35f5a8b..2ba0596ba1 100644
--- a/poky/meta/lib/oeqa/utils/qemurunner.py
+++ b/poky/meta/lib/oeqa/utils/qemurunner.py
@@ -21,7 +21,6 @@ import threading
import codecs
import logging
import tempfile
-from oeqa.utils.dump import HostDumper
from collections import defaultdict
import importlib
@@ -33,8 +32,8 @@ re_control_char = re.compile('[%s]' % re.escape("".join(control_chars)))
class QemuRunner:
- def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds,
- use_kvm, logger, use_slirp=False, serial_ports=2, boot_patterns = defaultdict(str), use_ovmf=False, workdir=None, tmpfsdir=None):
+ def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, use_kvm, logger, use_slirp=False,
+ serial_ports=2, boot_patterns = defaultdict(str), use_ovmf=False, workdir=None, tmpfsdir=None):
# Popen object for runqemu
self.runqemu = None
@@ -69,7 +68,6 @@ class QemuRunner:
if not workdir:
workdir = os.getcwd()
self.qemu_pidfile = workdir + '/pidfile_' + str(os.getpid())
- self.host_dumper = HostDumper(dump_host_cmds, dump_dir)
self.monitorpipe = None
self.logger = logger
@@ -138,7 +136,6 @@ class QemuRunner:
self.logger.error('runqemu exited with code %d' % self.runqemu.returncode)
self.logger.error('Output from runqemu:\n%s' % self.getOutput(self.runqemu.stdout))
self.stop()
- self._dump_host()
def start(self, qemuparams = None, get_ip = True, extra_bootparams = None, runqemuparams='', launch_cmd=None, discard_writes=True):
env = os.environ.copy()
@@ -188,7 +185,7 @@ class QemuRunner:
def launch(self, launch_cmd, get_ip = True, qemuparams = None, extra_bootparams = None, env = None):
# use logfile to determine the recipe-sysroot-native path and
# then add in the site-packages path components and add that
- # to the python sys.path so qmp.py can be found.
+ # to the python sys.path so the qmp module can be found.
python_path = os.path.dirname(os.path.dirname(self.logfile))
python_path += "/recipe-sysroot-native/usr/lib/qemu-python"
sys.path.append(python_path)
@@ -196,7 +193,7 @@ class QemuRunner:
try:
qmp = importlib.import_module("qmp")
except Exception as e:
- self.logger.error("qemurunner: qmp.py missing, please ensure it's installed (%s)" % str(e))
+ self.logger.error("qemurunner: qmp module missing, please ensure it's installed in %s (%s)" % (python_path, str(e)))
return False
# Path relative to tmpdir used as cwd for qemu below to avoid unix socket path length issues
qmp_file = "." + next(tempfile._get_candidate_names())
@@ -286,7 +283,6 @@ class QemuRunner:
if self.runqemu.returncode:
# No point waiting any longer
self.logger.warning('runqemu exited with code %d' % self.runqemu.returncode)
- self._dump_host()
self.logger.warning("Output from runqemu:\n%s" % self.getOutput(output))
self.stop()
return False
@@ -314,7 +310,6 @@ class QemuRunner:
ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,pri,ni,command '], stdout=subprocess.PIPE).communicate()[0]
processes = ps.decode("utf-8")
self.logger.debug("Running processes:\n%s" % processes)
- self._dump_host()
op = self.getOutput(output)
self.stop()
if op:
@@ -430,7 +425,6 @@ class QemuRunner:
self.logger.error("Couldn't get ip from qemu command line and runqemu output! "
"Here is the qemu command line used:\n%s\n"
"and output from runqemu:\n%s" % (cmdline, out))
- self._dump_host()
self.stop()
return False
@@ -508,7 +502,6 @@ class QemuRunner:
lines = tail(bootlog if bootlog else self.msg)
self.logger.warning("Last 25 lines of text (%d):\n%s" % (len(bootlog), lines))
self.logger.warning("Check full boot log: %s" % self.logfile)
- self._dump_host()
self.stop()
return False
@@ -689,13 +682,6 @@ class QemuRunner:
status = 1
return (status, str(data))
-
- def _dump_host(self):
- self.host_dumper.create_dir("qemu")
- self.logger.warning("Qemu ended unexpectedly, dump data from host"
- " is in %s" % self.host_dumper.dump_dir)
- self.host_dumper.dump_host()
-
# This class is for reading data from a socket and passing it to logfunc
# to be processed. It's completely event driven and has a straightforward
# event loop. The mechanism for stopping the thread is a simple pipe which