diff options
author | Stefan Stanacar <stefanx.stanacar@intel.com> | 2013-08-13 17:47:12 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-13 23:05:59 +0100 |
commit | 0ba78c1162bb125850a0ee504ca6fbe5bf21247f (patch) | |
tree | 7624e31a6b04e6cc154013b787660c6abdaeb0ed /meta/lib/oeqa/utils/oeqemuconsole.py | |
parent | bc4b98bd4ce8fcf2bedc09d172893aa770f68df0 (diff) | |
download | poky-0ba78c1162bb125850a0ee504ca6fbe5bf21247f.tar.gz |
oeqa/utils/qemurunner: get ip old fashioned way and use tcp serial console
The way we read data from the serial console was unreliable and blocking (AutoBuilder
seems to hit that often), so change the serial console type from unix socket to tcp
and reverse the connection - don't let qemu act as server (wait for a connection).
So now the serial console is used to save the boot log and make sure that we reached
the login prompt. Until a better way is found this should solve some of the AutoBuilder
failures (one being YB#4904).
Also we need to use the same method as the old qemuimagetest to get the ip
(from the qemu process arguments), because that it's more reliable.
The first version used here was to log into the target and use the output of
"ip addr show eth0" but then systemd decides that it should rename interfaces,
so that was changed to get the ip of the interface that has the default gw,
but if there is no default gw we'll get the loopback ip and we end up trying to
ssh into the host machine (some recent AutoBuilder runs showed that).
Changed in V2:
- use -ww for ps, as output might get truncated
(From OE-Core rev: 55e78185110937b7e2b143cf1020426d8df58b72)
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils/oeqemuconsole.py')
-rw-r--r-- | meta/lib/oeqa/utils/oeqemuconsole.py | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/meta/lib/oeqa/utils/oeqemuconsole.py b/meta/lib/oeqa/utils/oeqemuconsole.py deleted file mode 100644 index 95a21332de..0000000000 --- a/meta/lib/oeqa/utils/oeqemuconsole.py +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | import socket | ||
2 | import time | ||
3 | import re | ||
4 | from telnetlib import Telnet | ||
5 | |||
6 | class oeQemuConsole(Telnet): | ||
7 | |||
8 | """ | ||
9 | Override Telnet class to use unix domain sockets, | ||
10 | Telnet uses AF_INET for socket, we don't want that. | ||
11 | Also, provide a read_all variant with timeout, that | ||
12 | returns whatever output there is. | ||
13 | """ | ||
14 | |||
15 | def __init__(self, stream, logfile): | ||
16 | |||
17 | Telnet.__init__(self, host=None) | ||
18 | self.stream = stream | ||
19 | self.logfile = logfile | ||
20 | self.eof = 0 | ||
21 | self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | ||
22 | self.sock.connect(stream) | ||
23 | |||
24 | def log(self, msg): | ||
25 | if self.logfile: | ||
26 | with open(self.logfile, "a") as f: | ||
27 | f.write("%s\n" % msg) | ||
28 | |||
29 | |||
30 | def read_all_timeout(self, match, timeout=200): | ||
31 | """Read until EOF or until timeout or until match. | ||
32 | """ | ||
33 | ret = False | ||
34 | self.process_rawq() | ||
35 | endtime = time.time() + timeout | ||
36 | while not self.eof and time.time() < endtime: | ||
37 | self.fill_rawq() | ||
38 | self.process_rawq() | ||
39 | if re.search(match, self.cookedq): | ||
40 | ret = True | ||
41 | break | ||
42 | buf = self.cookedq | ||
43 | self.cookedq = '' | ||
44 | self.log(buf) | ||
45 | return (ret, buf) | ||