diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-20 11:57:44 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-02 08:24:01 +0100 |
| commit | 3b3997174831931ea472167ba6cc854a4972ccce (patch) | |
| tree | 861b0bcb54e70fbe59bf7920862954dcec40a1e8 /meta/lib/oeqa/utils/qemurunner.py | |
| parent | 52c4b7f247618f185a11dfb1cf15d0490d074379 (diff) | |
| download | poky-3b3997174831931ea472167ba6cc854a4972ccce.tar.gz | |
classes/lib: Complete transition to python3
This patch contains all the other misc pieces of the transition to
python3 which didn't make sense to be broken into individual patches.
(From OE-Core rev: fcd6b38bab8517d83e1ed48eef1bca9a9a190f57)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils/qemurunner.py')
| -rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index 3d60433cae..e408fbbf3a 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
| @@ -23,8 +23,8 @@ logger = logging.getLogger("BitBake.QemuRunner") | |||
| 23 | 23 | ||
| 24 | # Get Unicode non printable control chars | 24 | # Get Unicode non printable control chars |
| 25 | control_range = list(range(0,32))+list(range(127,160)) | 25 | control_range = list(range(0,32))+list(range(127,160)) |
| 26 | control_chars = [unichr(x) for x in control_range | 26 | control_chars = [chr(x) for x in control_range |
| 27 | if unichr(x) not in string.printable] | 27 | if chr(x) not in string.printable] |
| 28 | re_control_char = re.compile('[%s]' % re.escape("".join(control_chars))) | 28 | re_control_char = re.compile('[%s]' % re.escape("".join(control_chars))) |
| 29 | 29 | ||
| 30 | class QemuRunner: | 30 | class QemuRunner: |
| @@ -220,6 +220,7 @@ class QemuRunner: | |||
| 220 | stopread = False | 220 | stopread = False |
| 221 | qemusock = None | 221 | qemusock = None |
| 222 | bootlog = '' | 222 | bootlog = '' |
| 223 | data = b'' | ||
| 223 | while time.time() < endtime and not stopread: | 224 | while time.time() < endtime and not stopread: |
| 224 | sread, swrite, serror = select.select(socklist, [], [], 5) | 225 | sread, swrite, serror = select.select(socklist, [], [], 5) |
| 225 | for sock in sread: | 226 | for sock in sread: |
| @@ -283,13 +284,14 @@ class QemuRunner: | |||
| 283 | if hasattr(self, "origchldhandler"): | 284 | if hasattr(self, "origchldhandler"): |
| 284 | signal.signal(signal.SIGCHLD, self.origchldhandler) | 285 | signal.signal(signal.SIGCHLD, self.origchldhandler) |
| 285 | if self.runqemu: | 286 | if self.runqemu: |
| 286 | os.kill(self.monitorpid, signal.SIGKILL) | 287 | if hasattr(self, "monitorpid"): |
| 287 | logger.info("Sending SIGTERM to runqemu") | 288 | os.kill(self.monitorpid, signal.SIGKILL) |
| 288 | try: | 289 | logger.info("Sending SIGTERM to runqemu") |
| 289 | os.killpg(os.getpgid(self.runqemu.pid), signal.SIGTERM) | 290 | try: |
| 290 | except OSError as e: | 291 | os.killpg(os.getpgid(self.runqemu.pid), signal.SIGTERM) |
| 291 | if e.errno != errno.ESRCH: | 292 | except OSError as e: |
| 292 | raise | 293 | if e.errno != errno.ESRCH: |
| 294 | raise | ||
| 293 | endtime = time.time() + self.runqemutime | 295 | endtime = time.time() + self.runqemutime |
| 294 | while self.runqemu.poll() is None and time.time() < endtime: | 296 | while self.runqemu.poll() is None and time.time() < endtime: |
| 295 | time.sleep(1) | 297 | time.sleep(1) |
| @@ -448,7 +450,7 @@ class LoggingThread(threading.Thread): | |||
| 448 | def stop(self): | 450 | def stop(self): |
| 449 | self.logger.info("Stopping logging thread") | 451 | self.logger.info("Stopping logging thread") |
| 450 | if self.running: | 452 | if self.running: |
| 451 | os.write(self.writepipe, "stop") | 453 | os.write(self.writepipe, bytes("stop", "utf-8")) |
| 452 | 454 | ||
| 453 | def teardown(self): | 455 | def teardown(self): |
| 454 | self.logger.info("Tearing down logging thread") | 456 | self.logger.info("Tearing down logging thread") |
