summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2017-03-27 15:03:22 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-28 08:43:13 +0100
commit7f6b1cd2c1f5090d1f46995e769bae5d1b947327 (patch)
treebf339004ddbe197081defb8aaa3a527859d19ca5
parent8c1c392ca34da1c64336d0aa2d0a26b9c23d8d39 (diff)
downloadpoky-7f6b1cd2c1f5090d1f46995e769bae5d1b947327.tar.gz
oeqa: tolerate interrupted select() while waiting for qemu
Sometimes, the OEQA utility code aborts with: ... File ".../meta/lib/oeqa/utils/qemurunner.py", line 131, in start return self.launch(launch_cmd, qemuparams=qemuparams, get_ip=get_ip, extra_bootparams=extra_bootparams) File ".../meta/lib/oeqa/utils/qemurunner.py", line 259, in launch sread, swrite, serror = select.select(socklist, [], [], 5) InterruptedError: [Errno 4] Interrupted system call strace shows that this is because of a SIGWINCH: Connection from 127.0.0.1:52668 select(21, [20], [], [], {5, 0}) = ? ERESTARTNOHAND (To be restarted if no handler) --- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} --- This is related to some special conditions: * whether qemu opens a graphical console window (enabled in Poky by default) * where that window gets opened * whether the window manager changes the size of the shell window (mine is a tiling window manager and reorders and resizes windows automatically) Ignoring the interrupted system calls avoids the problem. Code elsewhere (for example, run() in ssh.py) already does the same thing. (From OE-Core rev: 44fe106baf5fd5aebe26c5f28004e2b18d839b7c) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py10
-rw-r--r--meta/lib/oeqa/utils/qemutinyrunner.py5
2 files changed, 12 insertions, 3 deletions
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 95f59257ca..b7816167e8 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -256,7 +256,10 @@ class QemuRunner:
256 bootlog = '' 256 bootlog = ''
257 data = b'' 257 data = b''
258 while time.time() < endtime and not stopread: 258 while time.time() < endtime and not stopread:
259 sread, swrite, serror = select.select(socklist, [], [], 5) 259 try:
260 sread, swrite, serror = select.select(socklist, [], [], 5)
261 except InterruptedError:
262 continue
260 for sock in sread: 263 for sock in sread:
261 if sock is self.server_socket: 264 if sock is self.server_socket:
262 qemusock, addr = self.server_socket.accept() 265 qemusock, addr = self.server_socket.accept()
@@ -437,7 +440,10 @@ class QemuRunner:
437 if now >= end: 440 if now >= end:
438 data += "<<< run_serial(): command timed out after %d seconds without output >>>\r\n\r\n" % timeout 441 data += "<<< run_serial(): command timed out after %d seconds without output >>>\r\n\r\n" % timeout
439 break 442 break
440 sread, _, _ = select.select([self.server_socket],[],[], end - now) 443 try:
444 sread, _, _ = select.select([self.server_socket],[],[], end - now)
445 except InterruptedError:
446 continue
441 if sread: 447 if sread:
442 answer = self.server_socket.recv(1024) 448 answer = self.server_socket.recv(1024)
443 if answer: 449 if answer:
diff --git a/meta/lib/oeqa/utils/qemutinyrunner.py b/meta/lib/oeqa/utils/qemutinyrunner.py
index b1009a0a37..df5f9ddb82 100644
--- a/meta/lib/oeqa/utils/qemutinyrunner.py
+++ b/meta/lib/oeqa/utils/qemutinyrunner.py
@@ -114,7 +114,10 @@ class QemuTinyRunner(QemuRunner):
114 stopread = False 114 stopread = False
115 endtime = time.time()+timeout 115 endtime = time.time()+timeout
116 while time.time()<endtime and not stopread: 116 while time.time()<endtime and not stopread:
117 sread, _, _ = select.select([self.server_socket],[],[],1) 117 try:
118 sread, _, _ = select.select([self.server_socket],[],[],1)
119 except InterruptedError:
120 continue
118 for sock in sread: 121 for sock in sread:
119 answer = sock.recv(1024) 122 answer = sock.recv(1024)
120 if answer: 123 if answer: