summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oeqa/targetcontrol.py3
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py32
2 files changed, 23 insertions, 12 deletions
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index 1445e3ecfb..0b2915d5cc 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -143,7 +143,8 @@ class QemuTarget(BaseTarget):
143 use_kvm = use_kvm, 143 use_kvm = use_kvm,
144 dump_dir = dump_dir, 144 dump_dir = dump_dir,
145 dump_host_cmds = d.getVar("testimage_dump_host"), 145 dump_host_cmds = d.getVar("testimage_dump_host"),
146 logger = logger) 146 logger = logger,
147 serial_ports = len(d.getVar("SERIAL_CONSOLES").split()))
147 148
148 self.target_dumper = TargetDumper(dump_target_cmds, dump_dir, self.runner) 149 self.target_dumper = TargetDumper(dump_target_cmds, dump_dir, self.runner)
149 150
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index fe8b77d97a..c025eb09c5 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -31,7 +31,7 @@ re_control_char = re.compile('[%s]' % re.escape("".join(control_chars)))
31class QemuRunner: 31class QemuRunner:
32 32
33 def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds, 33 def __init__(self, machine, rootfs, display, tmpdir, deploy_dir_image, logfile, boottime, dump_dir, dump_host_cmds,
34 use_kvm, logger, use_slirp=False): 34 use_kvm, logger, use_slirp=False, serial_ports=2):
35 35
36 # Popen object for runqemu 36 # Popen object for runqemu
37 self.runqemu = None 37 self.runqemu = None
@@ -55,6 +55,7 @@ class QemuRunner:
55 self.thread = None 55 self.thread = None
56 self.use_kvm = use_kvm 56 self.use_kvm = use_kvm
57 self.use_slirp = use_slirp 57 self.use_slirp = use_slirp
58 self.serial_ports = serial_ports
58 self.msg = '' 59 self.msg = ''
59 60
60 self.runqemutime = 120 61 self.runqemutime = 120
@@ -142,7 +143,8 @@ class QemuRunner:
142 143
143 def launch(self, launch_cmd, get_ip = True, qemuparams = None, extra_bootparams = None, env = None): 144 def launch(self, launch_cmd, get_ip = True, qemuparams = None, extra_bootparams = None, env = None):
144 try: 145 try:
145 self.threadsock, threadport = self.create_socket() 146 if self.serial_ports >= 2:
147 self.threadsock, threadport = self.create_socket()
146 self.server_socket, self.serverport = self.create_socket() 148 self.server_socket, self.serverport = self.create_socket()
147 except socket.error as msg: 149 except socket.error as msg:
148 self.logger.error("Failed to create listening socket: %s" % msg[1]) 150 self.logger.error("Failed to create listening socket: %s" % msg[1])
@@ -160,7 +162,10 @@ class QemuRunner:
160 if qemuparams: 162 if qemuparams:
161 self.qemuparams = self.qemuparams[:-1] + " " + qemuparams + " " + '\"' 163 self.qemuparams = self.qemuparams[:-1] + " " + qemuparams + " " + '\"'
162 164
163 launch_cmd += ' tcpserial=%s:%s %s' % (threadport, self.serverport, self.qemuparams) 165 if self.serial_ports >= 2:
166 launch_cmd += ' tcpserial=%s:%s %s' % (threadport, self.serverport, self.qemuparams)
167 else:
168 launch_cmd += ' tcpserial=%s %s' % (self.serverport, self.qemuparams)
164 169
165 self.origchldhandler = signal.getsignal(signal.SIGCHLD) 170 self.origchldhandler = signal.getsignal(signal.SIGCHLD)
166 signal.signal(signal.SIGCHLD, self.handleSIGCHLD) 171 signal.signal(signal.SIGCHLD, self.handleSIGCHLD)
@@ -275,14 +280,15 @@ class QemuRunner:
275 self.logger.debug("Target IP: %s" % self.ip) 280 self.logger.debug("Target IP: %s" % self.ip)
276 self.logger.debug("Server IP: %s" % self.server_ip) 281 self.logger.debug("Server IP: %s" % self.server_ip)
277 282
278 self.thread = LoggingThread(self.log, self.threadsock, self.logger) 283 if self.serial_ports >= 2:
279 self.thread.start() 284 self.thread = LoggingThread(self.log, self.threadsock, self.logger)
280 if not self.thread.connection_established.wait(self.boottime): 285 self.thread.start()
281 self.logger.error("Didn't receive a console connection from qemu. " 286 if not self.thread.connection_established.wait(self.boottime):
282 "Here is the qemu command line used:\n%s\nand " 287 self.logger.error("Didn't receive a console connection from qemu. "
283 "output from runqemu:\n%s" % (cmdline, out)) 288 "Here is the qemu command line used:\n%s\nand "
284 self.stop_thread() 289 "output from runqemu:\n%s" % (cmdline, out))
285 return False 290 self.stop_thread()
291 return False
286 292
287 self.logger.debug("Output from runqemu:\n%s", out) 293 self.logger.debug("Output from runqemu:\n%s", out)
288 self.logger.debug("Waiting at most %d seconds for login banner (%s)" % 294 self.logger.debug("Waiting at most %d seconds for login banner (%s)" %
@@ -310,6 +316,10 @@ class QemuRunner:
310 data = data + sock.recv(1024) 316 data = data + sock.recv(1024)
311 if data: 317 if data:
312 bootlog += data 318 bootlog += data
319 if self.serial_ports < 2:
320 # this socket has mixed console/kernel data, log it to logfile
321 self.log(data)
322
313 data = b'' 323 data = b''
314 if b' login:' in bootlog: 324 if b' login:' in bootlog:
315 self.server_socket = qemusock 325 self.server_socket = qemusock