From patchwork Thu Sep 23 12:11:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?THVrw6HFoSBEb2t0b3I=?= X-Patchwork-Id: 201792 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8NCCIiS000573 for ; Thu, 23 Sep 2010 12:12:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755128Ab0IWMMC (ORCPT ); Thu, 23 Sep 2010 08:12:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8840 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755091Ab0IWMMA (ORCPT ); Thu, 23 Sep 2010 08:12:00 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8NCBxhu013062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 Sep 2010 08:11:59 -0400 Received: from dhcp-27-189.brq.redhat.com (dhcp-27-189.brq.redhat.com [10.34.27.189]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8NCBtn5026368; Thu, 23 Sep 2010 08:11:57 -0400 From: Lukas Doktor To: ldoktor@redhat.com, jzupka@redhat.com, autotest@test.kernel.org, kvm@vger.kernel.org, lmr@redhat.com, amit.shah@redhat.com Subject: [PATCH 1/1] virtio_console: perf-test fix [FIX] read-out all data after perf-test [FIX] code clean-up Date: Thu, 23 Sep 2010 14:11:52 +0200 Message-Id: <1285243912-28385-2-git-send-email-ldoktor@redhat.com> In-Reply-To: <1285243912-28385-1-git-send-email-ldoktor@redhat.com> References: <1285243912-28385-1-git-send-email-ldoktor@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 23 Sep 2010 12:12:19 +0000 (UTC) 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):