1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 05:29:32 +00:00

qemurunner.py: Move some class variables that should only be local

The bootlog and qemusock variables were set in the class as part of the
create_socket() routine. However those variables are never used outside
of the same function and thus serve no purpose as class variables.

This initializes those variables near where they are used.

(From OE-Core rev: 829a6e521f15bae93d5f1a02dc67bc56a8c606c8)

Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Randy Witt
2015-08-18 16:44:25 -07:00
committed by Richard Purdie
parent 8754a006ca
commit 62585cff0d
+9 -10
View File
@@ -43,9 +43,6 @@ class QemuRunner:
def create_socket(self):
self.bootlog = ''
self.qemusock = None
try:
self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.server_socket.setblocking(0)
@@ -145,22 +142,24 @@ class QemuRunner:
socklist = [self.server_socket]
reachedlogin = False
stopread = False
qemusock = None
bootlog = ''
while time.time() < endtime and not stopread:
sread, swrite, serror = select.select(socklist, [], [], 5)
for sock in sread:
if sock is self.server_socket:
self.qemusock, addr = self.server_socket.accept()
self.qemusock.setblocking(0)
socklist.append(self.qemusock)
qemusock, addr = self.server_socket.accept()
qemusock.setblocking(0)
socklist.append(qemusock)
socklist.remove(self.server_socket)
logger.info("Connection from %s:%s" % addr)
else:
data = sock.recv(1024)
if data:
self.log(data)
self.bootlog += data
if re.search(".* login:", self.bootlog):
self.server_socket = self.qemusock
bootlog += data
if re.search(".* login:", bootlog):
self.server_socket = qemusock
stopread = True
reachedlogin = True
logger.info("Reached login banner")
@@ -171,7 +170,7 @@ class QemuRunner:
if not reachedlogin:
logger.info("Target didn't reached login boot in %d seconds" % self.boottime)
lines = "\n".join(self.bootlog.splitlines()[-25:])
lines = "\n".join(bootlog.splitlines()[-25:])
logger.info("Last 25 lines of text:\n%s" % lines)
logger.info("Check full boot log: %s" % self.logfile)
self.stop()