summaryrefslogtreecommitdiff
path: root/meta/lib
diff options
context:
space:
mode:
authorRandy Witt <randy.e.witt@linux.intel.com>2015-08-18 16:44:25 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-24 23:45:23 +0100
commit829a6e521f15bae93d5f1a02dc67bc56a8c606c8 (patch)
tree55337944716a0e747fc11a0e86dd07f09760daaa /meta/lib
parentad509d7644803ff9386affefe2ec1a3664027074 (diff)
downloadopenembedded-core-829a6e521f15bae93d5f1a02dc67bc56a8c606c8.tar.gz
openembedded-core-829a6e521f15bae93d5f1a02dc67bc56a8c606c8.tar.bz2
openembedded-core-829a6e521f15bae93d5f1a02dc67bc56a8c606c8.zip
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. Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 04584474e7..c5bb13c878 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -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()