summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/target
diff options
context:
space:
mode:
authorSaul Wold <Saul.Wold@windriver.com>2021-04-26 07:45:10 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-04-27 15:11:47 +0100
commit3acbec85b00d693d2d731bc2b09cc40be1cc68e9 (patch)
tree3b86b76cc4932ff2d9fbde194f70057a5e99079f /meta/lib/oeqa/core/target
parent2c86aba6f0eeb1fc747de2f518d1ec982398c54a (diff)
downloadpoky-3acbec85b00d693d2d731bc2b09cc40be1cc68e9.tar.gz
qemurunner: Add support for qmp commands
This adds support for the Qemu Machine Protocol [0] extending the current dump process for Host and Target. The commands are added in the testimage.bbclass. Currently, we setup qemu to stall until qmp gets connected and sends the initialization and continue commands, this works correctly. If the UNIX Socket does not exist, we wait an timeout to ensure to socket file is created. With this version, the monitor_dumper is created in OEQemuTarget but then set in OESSHTarget as that's where we get the SSH failure happens. Python's @property is used to create a setter/getter type of setup in OESSHTarget to get overridden by OEQemuTarget. By default the data is currently dumped to files for each command in TMPDIR/log/runtime-hostdump/<date>_qmp/unknown_<seq>_qemu_monitor as this is the naming convenstion in the dump.py code. We use the qmp.py from qemu, which needs to get installed in the recipe-sysroot-native of the target image. [0] https://github.com/qemu/qemu/blob/master/docs/interop/qmp-spec.txt (From OE-Core rev: 42af4cd2df72fc8ed9deb3fde4312909842fcf91) Signed-off-by: Saul Wold <saul.wold@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/core/target')
-rw-r--r--meta/lib/oeqa/core/target/qemu.py6
-rw-r--r--meta/lib/oeqa/core/target/ssh.py17
2 files changed, 22 insertions, 1 deletions
diff --git a/meta/lib/oeqa/core/target/qemu.py b/meta/lib/oeqa/core/target/qemu.py
index 792efca1f8..4a5df4a9a8 100644
--- a/meta/lib/oeqa/core/target/qemu.py
+++ b/meta/lib/oeqa/core/target/qemu.py
@@ -12,6 +12,7 @@ from collections import defaultdict
12 12
13from .ssh import OESSHTarget 13from .ssh import OESSHTarget
14from oeqa.utils.qemurunner import QemuRunner 14from oeqa.utils.qemurunner import QemuRunner
15from oeqa.utils.dump import MonitorDumper
15from oeqa.utils.dump import TargetDumper 16from oeqa.utils.dump import TargetDumper
16 17
17supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic'] 18supported_fstypes = ['ext3', 'ext4', 'cpio.gz', 'wic']
@@ -43,6 +44,11 @@ class OEQemuTarget(OESSHTarget):
43 dump_host_cmds=dump_host_cmds, logger=logger, 44 dump_host_cmds=dump_host_cmds, logger=logger,
44 serial_ports=serial_ports, boot_patterns = boot_patterns, 45 serial_ports=serial_ports, boot_patterns = boot_patterns,
45 use_ovmf=ovmf, tmpfsdir=tmpfsdir) 46 use_ovmf=ovmf, tmpfsdir=tmpfsdir)
47 dump_monitor_cmds = kwargs.get("testimage_dump_monitor")
48 self.monitor_dumper = MonitorDumper(dump_monitor_cmds, dump_dir, self.runner)
49 if self.monitor_dumper:
50 self.monitor_dumper.create_dir("qmp")
51
46 dump_target_cmds = kwargs.get("testimage_dump_target") 52 dump_target_cmds = kwargs.get("testimage_dump_target")
47 self.target_dumper = TargetDumper(dump_target_cmds, dump_dir, self.runner) 53 self.target_dumper = TargetDumper(dump_target_cmds, dump_dir, self.runner)
48 self.target_dumper.create_dir("qemu") 54 self.target_dumper.create_dir("qemu")
diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
index 461448dbc5..923a223b25 100644
--- a/meta/lib/oeqa/core/target/ssh.py
+++ b/meta/lib/oeqa/core/target/ssh.py
@@ -43,6 +43,7 @@ class OESSHTarget(OETarget):
43 if port: 43 if port:
44 self.ssh = self.ssh + [ '-p', port ] 44 self.ssh = self.ssh + [ '-p', port ]
45 self.scp = self.scp + [ '-P', port ] 45 self.scp = self.scp + [ '-P', port ]
46 self._monitor_dumper = None
46 47
47 def start(self, **kwargs): 48 def start(self, **kwargs):
48 pass 49 pass
@@ -50,6 +51,15 @@ class OESSHTarget(OETarget):
50 def stop(self, **kwargs): 51 def stop(self, **kwargs):
51 pass 52 pass
52 53
54 @property
55 def monitor_dumper(self):
56 return self._monitor_dumper
57
58 @monitor_dumper.setter
59 def monitor_dumper(self, dumper):
60 self._monitor_dumper = dumper
61 self.monitor_dumper.dump_monitor()
62
53 def _run(self, command, timeout=None, ignore_status=True): 63 def _run(self, command, timeout=None, ignore_status=True):
54 """ 64 """
55 Runs command in target using SSHProcess. 65 Runs command in target using SSHProcess.
@@ -87,9 +97,14 @@ class OESSHTarget(OETarget):
87 processTimeout = self.timeout 97 processTimeout = self.timeout
88 98
89 status, output = self._run(sshCmd, processTimeout, True) 99 status, output = self._run(sshCmd, processTimeout, True)
90 self.logger.debug('Command: %s\nOutput: %s\n' % (command, output)) 100 self.logger.debug('Command: %s\nStatus: %d Output: %s\n' % (command, status, output))
91 if (status == 255) and (('No route to host') in output): 101 if (status == 255) and (('No route to host') in output):
102 if self.monitor_dumper:
103 self.monitor_dumper.dump_monitor()
104 if status == 255:
92 self.target_dumper.dump_target() 105 self.target_dumper.dump_target()
106 if self.monitor_dumper:
107 self.monitor_dumper.dump_monitor()
93 return (status, output) 108 return (status, output)
94 109
95 def copyTo(self, localSrc, remoteDst): 110 def copyTo(self, localSrc, remoteDst):