Skip to contentSkip to conversation

qemurunner: Remove the timeout in run_serial

PATCH New [email protected] 1 participant 1 message Nov 5, 2015 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 qemurunner: Remove the timeout in run_serial

From: Mariano Lopez <[email protected]>

Sometmes when there is high load in the server the commands executed in the target take a lot of time to complete and this lead to incorrect dump files or empty files. This is caused because run_serial has a timeout of five seconds when running the commands in the target.

This change removes the timeout and just keep reading the socket until it finds the prompt from the target or when the socket is not ready to be read.

[YOCTO #8510]

---
 meta/lib/oeqa/utils/qemurunner.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
meta/lib/oeqa/utils/qemurunner.py +10 -8
index bdc6e0a..e1e4057 100644
@@ -366,23 +366,25 @@ class QemuRunner:
         # We assume target system have echo to get command status
         if not raw:
             command = "%s; echo $?\n" % command
-        self.server_socket.sendall(command)
+
         data = ''
         status = 0
-        stopread = False
-        endtime = time.time()+5
-        while time.time()<endtime and not stopread:
+        self.server_socket.sendall(command)
+        keepreading = True
+        while keepreading:
             sread, _, _ = select.select([self.server_socket],[],[],5)
-            for sock in sread:
-                answer = sock.recv(1024)
+            if sread:
+                answer = self.server_socket.recv(1024)
                 if answer:
                     data += answer
                     # Search the prompt to stop
                     if re.search("[a-zA-Z0-9]+@[a-zA-Z0-9\-]+:~#", data):
-                        stopread = True
-                        break
+                        keepreading = False
                 else:
                     raise Exception("No data on serial console socket")
+            else:
+                keepreading = False
+
         if data:
             if raw:
                 status = 1
Signature · 1 line
1.8.4.5