]> code.ossystems Code Review - openembedded-core.git/commitdiff
qemurunner.py: Performance improvements in run_serial
authorMariano Lopez <mariano.lopez@linux.intel.com>
Wed, 12 Aug 2015 08:37:28 +0000 (08:37 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 16 Aug 2015 08:24:21 +0000 (09:24 +0100)
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@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/lib/oeqa/utils/qemurunner.py

index 3e604d81558b1f151bd109cb7ea123ffa361cf83..04584474e716add968c92dde7fddadc2ec07855d 100644 (file)
@@ -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