summaryrefslogtreecommitdiffstats
path: root/poky/meta/lib/oeqa/utils/qemurunner.py
diff options
context:
space:
mode:
Diffstat (limited to 'poky/meta/lib/oeqa/utils/qemurunner.py')
-rw-r--r--poky/meta/lib/oeqa/utils/qemurunner.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/poky/meta/lib/oeqa/utils/qemurunner.py b/poky/meta/lib/oeqa/utils/qemurunner.py
index c962602a6..b87d7765e 100644
--- a/poky/meta/lib/oeqa/utils/qemurunner.py
+++ b/poky/meta/lib/oeqa/utils/qemurunner.py
@@ -135,7 +135,7 @@ class QemuRunner:
def launch(self, launch_cmd, get_ip = True, qemuparams = None, extra_bootparams = None, env = None):
try:
- threadsock, threadport = self.create_socket()
+ self.threadsock, threadport = self.create_socket()
self.server_socket, self.serverport = self.create_socket()
except socket.error as msg:
self.logger.error("Failed to create listening socket: %s" % msg[1])
@@ -203,8 +203,8 @@ class QemuRunner:
# No point waiting any longer
self.logger.debug('runqemu exited with code %d' % self.runqemu.returncode)
self._dump_host()
- self.stop()
self.logger.debug("Output from runqemu:\n%s" % self.getOutput(output))
+ self.stop()
return False
time.sleep(0.5)
@@ -216,8 +216,8 @@ class QemuRunner:
processes = ps.decode("utf-8")
self.logger.debug("Running processes:\n%s" % processes)
self._dump_host()
- self.stop()
op = self.getOutput(output)
+ self.stop()
if op:
self.logger.error("Output from runqemu:\n%s" % op)
else:
@@ -238,13 +238,13 @@ class QemuRunner:
# because is possible to have control characters
cmdline = re_control_char.sub(' ', cmdline)
try:
- ips = re.findall("((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1])
+ ips = re.findall(r"((?:[0-9]{1,3}\.){3}[0-9]{1,3})", cmdline.split("ip=")[1])
self.ip = ips[0]
self.server_ip = ips[1]
self.logger.debug("qemu cmdline used:\n{}".format(cmdline))
except (IndexError, ValueError):
# Try to get network configuration from runqemu output
- match = re.match('.*Network configuration: ([0-9.]+)::([0-9.]+):([0-9.]+)$.*',
+ match = re.match(r'.*Network configuration: ([0-9.]+)::([0-9.]+):([0-9.]+)$.*',
out, re.MULTILINE|re.DOTALL)
if match:
self.ip, self.server_ip, self.netmask = match.groups()
@@ -263,7 +263,7 @@ class QemuRunner:
self.logger.debug("Target IP: %s" % self.ip)
self.logger.debug("Server IP: %s" % self.server_ip)
- self.thread = LoggingThread(self.log, threadsock, self.logger)
+ self.thread = LoggingThread(self.log, self.threadsock, self.logger)
self.thread.start()
if not self.thread.connection_established.wait(self.boottime):
self.logger.error("Didn't receive a console connection from qemu. "
@@ -331,14 +331,14 @@ class QemuRunner:
# If we are not able to login the tests can continue
try:
(status, output) = self.run_serial("root\n", raw=True)
- if re.search("root@[a-zA-Z0-9\-]+:~#", output):
+ if re.search(r"root@[a-zA-Z0-9\-]+:~#", output):
self.logged = True
self.logger.debug("Logged as root in serial console")
if netconf:
# configure guest networking
cmd = "ifconfig eth0 %s netmask %s up\n" % (self.ip, self.netmask)
output = self.run_serial(cmd, raw=True)[1]
- if re.search("root@[a-zA-Z0-9\-]+:~#", output):
+ if re.search(r"root@[a-zA-Z0-9\-]+:~#", output):
self.logger.debug("configured ip address %s", self.ip)
else:
self.logger.debug("Couldn't configure guest networking")
@@ -369,14 +369,22 @@ class QemuRunner:
if self.runqemu.poll() is None:
self.logger.debug("Sending SIGKILL to runqemu")
os.killpg(os.getpgid(self.runqemu.pid), signal.SIGKILL)
+ self.runqemu.stdin.close()
+ self.runqemu.stdout.close()
self.runqemu = None
+
if hasattr(self, 'server_socket') and self.server_socket:
self.server_socket.close()
self.server_socket = None
+ if hasattr(self, 'threadsock') and self.threadsock:
+ self.threadsock.close()
+ self.threadsock = None
self.qemupid = None
self.ip = None
if os.path.exists(self.qemu_pidfile):
os.remove(self.qemu_pidfile)
+ if self.monitorpipe:
+ self.monitorpipe.close()
def stop_qemu_system(self):
if self.qemupid:
@@ -436,7 +444,7 @@ class QemuRunner:
if answer:
data += answer.decode('utf-8')
# Search the prompt to stop
- if re.search("[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data):
+ if re.search(r"[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data):
break
else:
raise Exception("No data on serial console socket")
OpenPOWER on IntegriCloud