From patchwork Wed Aug 5 14:57:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 39399 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 n75Eqwca016612 for ; Wed, 5 Aug 2009 14:52:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934538AbZHEOwz (ORCPT ); Wed, 5 Aug 2009 10:52:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934535AbZHEOwz (ORCPT ); Wed, 5 Aug 2009 10:52:55 -0400 Received: from mx2.redhat.com ([66.187.237.31]:50629 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934509AbZHEOwz (ORCPT ); Wed, 5 Aug 2009 10:52:55 -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 n75EqtD0020515; Wed, 5 Aug 2009 10:52:55 -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 n75EqsSC032046; Wed, 5 Aug 2009 10:52:54 -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 n75EqpPU009956; Wed, 5 Aug 2009 10:52:52 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 1/1] KVM test: kvm_subprocess: don't immediately check /proc/$PID/cmdline Date: Wed, 5 Aug 2009 17:57:36 +0300 Message-Id: <7742e2533a12513e4ae94d9e6e8cc9c876a5a0a4.1249484236.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 kvm_spawn.is_alive() incorrectly assumes that /proc/$PID/cmdline immediately reflects the new command line of the forked process. This makes it report false negatives occasionally. To prevent that, perform the command line check only if the process is more than 10 seconds old, or if the process has been pickled and unpickled. In both cases, there is more than enough time for /proc/$PID/cmdline to get updated. Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_subprocess.py | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kvm_subprocess.py index df1d562..457c12e 100644 --- a/client/tests/kvm/kvm_subprocess.py +++ b/client/tests/kvm/kvm_subprocess.py @@ -214,6 +214,8 @@ class kvm_spawn: # Wait for the server to complete its initialization while not "Server %s ready" % self.id in sub.stdout.readline(): pass + # Remember the start time for is_alive() + self.start_time = time.time() # Open the reading pipes self.reader_fds = {} @@ -379,6 +381,10 @@ class kvm_spawn: except: # If we couldn't find the file for some reason, skip the check return True + # If this process is new (less than 10 secs old) skip the check + if hasattr(self, "start_time") and time.time() < self.start_time + 10: + return True + # Perform the check if self.id in cmdline: return True return False