From patchwork Fri Jul 24 14:07:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 37127 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6OE45Bk028427 for ; Fri, 24 Jul 2009 14:04:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753034AbZGXODI (ORCPT ); Fri, 24 Jul 2009 10:03:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753026AbZGXODF (ORCPT ); Fri, 24 Jul 2009 10:03:05 -0400 Received: from mx2.redhat.com ([66.187.237.31]:50942 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753008AbZGXODC (ORCPT ); Fri, 24 Jul 2009 10:03:02 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6OE30wM015670; Fri, 24 Jul 2009 10:03:00 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6OE2xvM023851; Fri, 24 Jul 2009 10:02:59 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6OE2s8l010057; Fri, 24 Jul 2009 10:02:56 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH] KVM test: kvm_subprocess: fix a problem that arises with Python 2.6 Date: Fri, 24 Jul 2009 17:07:16 +0300 Message-Id: <27af0a741350371856c3493994373435cf9f4c4d.1248444364.git.mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org After launching the server the client waits for it to finish initializing. This is done by waiting for a line of output from the server's STDOUT. Currently, the client assumes that the first line of output coming from the server indicates that it's done initializing. With Python 2.4 this used to be true, but Python 2.6 prints deprecation warnings for certain standard modules as soon as they are imported. This makes the client think the server is ready when in fact it isn't. This patch fixes the problem by waiting for a certain unique output line from the server instead of just waiting for the first line. Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_subprocess.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kvm_subprocess.py index 413bdaa..c15e779 100644 --- a/client/tests/kvm/kvm_subprocess.py +++ b/client/tests/kvm/kvm_subprocess.py @@ -212,7 +212,8 @@ class kvm_spawn: sub.stdin.write("%s\n" % ",".join(self.readers)) sub.stdin.write("%s\n" % command) # Wait for the server to complete its initialization - sub.stdout.readline() + while not "Server %s ready" % self.id in sub.stdout.readline(): + pass # Open the reading pipes self.reader_fds = {} @@ -1081,7 +1082,7 @@ def _server_main(): file.close() # Print something to stdout so the client can start working - print "hello" + print "Server %s ready" % id sys.stdout.flush() # Initialize buffers