@@ -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):