diff options
| -rw-r--r-- | meta/lib/oeqa/utils/qemurunner.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py index c5bb13c878..c8d689900d 100644 --- a/meta/lib/oeqa/utils/qemurunner.py +++ b/meta/lib/oeqa/utils/qemurunner.py | |||
| @@ -42,20 +42,18 @@ class QemuRunner: | |||
| 42 | self.runqemutime = 60 | 42 | self.runqemutime = 60 |
| 43 | 43 | ||
| 44 | def create_socket(self): | 44 | def create_socket(self): |
| 45 | |||
| 46 | try: | 45 | try: |
| 47 | self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | 46 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 48 | self.server_socket.setblocking(0) | 47 | sock.setblocking(0) |
| 49 | self.server_socket.bind(("127.0.0.1",0)) | 48 | sock.bind(("127.0.0.1",0)) |
| 50 | self.server_socket.listen(2) | 49 | sock.listen(2) |
| 51 | self.serverport = self.server_socket.getsockname()[1] | 50 | port = sock.getsockname()[1] |
| 52 | logger.info("Created listening socket for qemu serial console on: 127.0.0.1:%s" % self.serverport) | 51 | logger.info("Created listening socket for qemu serial console on: 127.0.0.1:%s" % port) |
| 53 | return True | 52 | return (sock, port) |
| 54 | except socket.error, msg: | 53 | |
| 55 | self.server_socket.close() | 54 | except socket.error: |
| 56 | logger.error("Failed to create listening socket: %s" % msg[1]) | 55 | sock.close() |
| 57 | return False | 56 | raise |
| 58 | |||
| 59 | 57 | ||
| 60 | def log(self, msg): | 58 | def log(self, msg): |
| 61 | if self.logfile: | 59 | if self.logfile: |
| @@ -82,7 +80,10 @@ class QemuRunner: | |||
| 82 | else: | 80 | else: |
| 83 | os.environ["DEPLOY_DIR_IMAGE"] = self.deploy_dir_image | 81 | os.environ["DEPLOY_DIR_IMAGE"] = self.deploy_dir_image |
| 84 | 82 | ||
| 85 | if not self.create_socket(): | 83 | try: |
| 84 | self.server_socket, self.serverport = self.create_socket() | ||
| 85 | except socket.error, msg: | ||
| 86 | logger.error("Failed to create listening socket: %s" % msg[1]) | ||
| 86 | return False | 87 | return False |
| 87 | 88 | ||
| 88 | # Set this flag so that Qemu doesn't do any grabs as SDL grabs interact | 89 | # Set this flag so that Qemu doesn't do any grabs as SDL grabs interact |
