diff mbox

[1/1] virtio_console: perf-test fix [FIX] read-out all data after perf-test [FIX] code clean-up

Message ID 1285243912-28385-2-git-send-email-ldoktor@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lukáš Doktor Sept. 23, 2010, 12:11 p.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/tests/virtio_console.py b/client/tests/kvm/tests/virtio_console.py
index 058bb94..d5af383 100644
--- a/client/tests/kvm/tests/virtio_console.py
+++ b/client/tests/kvm/tests/virtio_console.py
@@ -1,3 +1,8 @@ 
+"""
+virtio_console test
+
+@copyright: Red Hat 2010
+"""
 import array, logging, os, random, re, select, shutil, socket, sys, tempfile
 import threading, time
 from collections import deque
@@ -180,8 +185,6 @@  def run_virtio_console(test, params, env):
             logging.debug("th_recv_check %s: exit(%d)", self.getName(),
                           self.idx)
 
-    seqTest = threading.Lock();
-
 
     class cpu_load():
         """
@@ -226,7 +229,7 @@  def run_virtio_console(test, params, env):
             Start CPU usage measurement
             """
             self.old_load = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
-            self.startTime = time.time();
+            self.startTime = time.time()
             self._get_cpu_load()
 
 
@@ -287,7 +290,7 @@  def run_virtio_console(test, params, env):
             Start CPU usage measurement
             """
             self.old_load = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
-            self.startTime = time.time();
+            self.startTime = time.time()
             self._get_cpu_load(self.pid)
 
 
@@ -388,7 +391,7 @@  def run_virtio_console(test, params, env):
                       "timeout: %s", command, vm[0].name, timeout)
         vm[1].sendline(command)
         (match, data) = vm[1].read_until_last_line_matches(["PASS:", "FAIL:" \
-                                                         "[Failed to execute]"], \
+                                                     "[Failed to execute]"], \
                                                           timeout)
         return (match, data)
 
@@ -829,6 +832,11 @@  def run_virtio_console(test, params, env):
             exit_event.set()
             thread.join()
 
+            # Let the guest read-out all the remaining data
+            while not _on_guest("virt.poll('%s', %s)"
+                                    % (port[1], select.POLLIN), vm, 2)[0]:
+                time.sleep(1)
+
             _guest_exit_threads(vm, [port], [])
 
             if (_time > slice):