[OE-core] [PATCH 4/6] qemurunner.py: Performance improvements in run_serial

mariano.lopez at linux.intel.com mariano.lopez at linux.intel.com
Wed Aug 12 14:05:54 UTC 2015


From: Mariano Lopez <mariano.lopez at linux.intel.com>

This allow to search for the prompt after a command is
run so it can avoid waiting for the timeout.

Also corrected identation issues

[YOCTO #8118]

Signed-off-by: Mariano Lopez <mariano.lopez at linux.intel.com>
---
 meta/lib/oeqa/utils/qemurunner.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 3e604d8..0458447 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -284,14 +284,18 @@ class QemuRunner:
         stopread = False
         endtime = time.time()+5
         while time.time()<endtime and not stopread:
-                sread, _, _ = select.select([self.server_socket],[],[],5)
-                for sock in sread:
-                        answer = sock.recv(1024)
-                        if answer:
-                                data += answer
-                        else:
-                                sock.close()
-                                stopread = True
+            sread, _, _ = select.select([self.server_socket],[],[],5)
+            for sock in sread:
+                answer = sock.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
+                else:
+                    sock.close()
+                    stopread = True
         if data:
             if raw:
                 status = 1
-- 
1.8.4.5




More information about the Openembedded-core mailing list