diff options
| author | Randy Witt <randy.e.witt@linux.intel.com> | 2015-08-18 16:44:25 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-24 23:47:06 +0100 |
| commit | 62585cff0df20b33a4c4d02d6302f06098d363cb (patch) | |
| tree | 165560403c44ada7152ab6cb7158ecaa4ce24393 | |
| parent | 8754a006caaa5234313927506782bb2d0df32f04 (diff) | |
| download | poky-62585cff0df20b33a4c4d02d6302f06098d363cb.tar.gz | |
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>
| -rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 19 |
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: | |||
| 43 | 43 | ||
| 44 | def create_socket(self): | 44 | def create_socket(self): |
| 45 | 45 | ||
| 46 | self.bootlog = '' | ||
| 47 | self.qemusock = None | ||
| 48 | |||
| 49 | try: | 46 | try: |
| 50 | self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | 47 | self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 51 | self.server_socket.setblocking(0) | 48 | self.server_socket.setblocking(0) |
| @@ -145,22 +142,24 @@ class QemuRunner: | |||
| 145 | socklist = [self.server_socket] | 142 | socklist = [self.server_socket] |
| 146 | reachedlogin = False | 143 | reachedlogin = False |
| 147 | stopread = False | 144 | stopread = False |
| 145 | qemusock = None | ||
| 146 | bootlog = '' | ||
| 148 | while time.time() < endtime and not stopread: | 147 | while time.time() < endtime and not stopread: |
| 149 | sread, swrite, serror = select.select(socklist, [], [], 5) | 148 | sread, swrite, serror = select.select(socklist, [], [], 5) |
| 150 | for sock in sread: | 149 | for sock in sread: |
| 151 | if sock is self.server_socket: | 150 | if sock is self.server_socket: |
| 152 | self.qemusock, addr = self.server_socket.accept() | 151 | qemusock, addr = self.server_socket.accept() |
| 153 | self.qemusock.setblocking(0) | 152 | qemusock.setblocking(0) |
| 154 | socklist.append(self.qemusock) | 153 | socklist.append(qemusock) |
| 155 | socklist.remove(self.server_socket) | 154 | socklist.remove(self.server_socket) |
| 156 | logger.info("Connection from %s:%s" % addr) | 155 | logger.info("Connection from %s:%s" % addr) |
| 157 | else: | 156 | else: |
| 158 | data = sock.recv(1024) | 157 | data = sock.recv(1024) |
| 159 | if data: | 158 | if data: |
| 160 | self.log(data) | 159 | self.log(data) |
| 161 | self.bootlog += data | 160 | bootlog += data |
| 162 | if re.search(".* login:", self.bootlog): | 161 | if re.search(".* login:", bootlog): |
| 163 | self.server_socket = self.qemusock | 162 | self.server_socket = qemusock |
| 164 | stopread = True | 163 | stopread = True |
| 165 | reachedlogin = True | 164 | reachedlogin = True |
| 166 | logger.info("Reached login banner") | 165 | logger.info("Reached login banner") |
| @@ -171,7 +170,7 @@ class QemuRunner: | |||
| 171 | 170 | ||
| 172 | if not reachedlogin: | 171 | if not reachedlogin: |
| 173 | logger.info("Target didn't reached login boot in %d seconds" % self.boottime) | 172 | logger.info("Target didn't reached login boot in %d seconds" % self.boottime) |
| 174 | lines = "\n".join(self.bootlog.splitlines()[-25:]) | 173 | lines = "\n".join(bootlog.splitlines()[-25:]) |
| 175 | logger.info("Last 25 lines of text:\n%s" % lines) | 174 | logger.info("Last 25 lines of text:\n%s" % lines) |
| 176 | logger.info("Check full boot log: %s" % self.logfile) | 175 | logger.info("Check full boot log: %s" % self.logfile) |
| 177 | self.stop() | 176 | self.stop() |
