Skip to contentSkip to conversation

virtio_console: perf-test fix

PATCH New Lukas Doktor 2 participants 3 messages Sep 23, 2010 – Sep 28, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio_console: perf-test fix

After the first part of perf_test there were still data in a buffer which caused console failures in this test. With this fix all data are read out and it's possible to use test_perf with console (virtio_console_perf = "console")

Additionaly this patch contains some minor code cleanups.

#1 lore raw

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

---
 client/tests/kvm/tests/virtio_console.py |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
client/tests/kvm/tests/virtio_console.py +13 -5
index 058bb94..d5af383 100644
@@ -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):
Signature · 1 line
1.7.2.3
#2 lore raw

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

client/tests/kvm/tests/virtio_console.py def run_virtio_console(test, params, env): · line 838

Quoted 8 lines · Lukas Doktor
client/tests/kvm/tests/virtio_console.py +4 -0
@@ -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)

This is just polling the guest, not reading out any data?

(BTW POLLIN will be set if host is disconnected and there's no data to read, so ensure you don't enter an infinite loop here.)

Amit