From patchwork Tue Oct 13 11:48:34 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 53390 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 n9DBv4MB011419 for ; Tue, 13 Oct 2009 11:57:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759557AbZJMLwO (ORCPT ); Tue, 13 Oct 2009 07:52:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759542AbZJMLwO (ORCPT ); Tue, 13 Oct 2009 07:52:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1275 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751872AbZJMLwN (ORCPT ); Tue, 13 Oct 2009 07:52:13 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9DBpkU3001189; Tue, 13 Oct 2009 07:51:47 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9DBpkIO012740; Tue, 13 Oct 2009 07:51:46 -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 n9DBpi2x024063; Tue, 13 Oct 2009 07:51:44 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 1/3] KVM test: kvm_subprocess.py: do not start tail thread by default Date: Tue, 13 Oct 2009 13:48:34 +0200 Message-Id: <1255434516-22142-1-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/client/tests/kvm/kvm_subprocess.py b/client/tests/kvm/kvm_subprocess.py index 2ac062a..ede8081 100755 --- a/client/tests/kvm/kvm_subprocess.py +++ b/client/tests/kvm/kvm_subprocess.py @@ -596,9 +596,10 @@ class kvm_tail(kvm_spawn): self.output_prefix = output_prefix # Start the thread in the background + self.tail_thread = None self.__thread_kill_requested = False - self.tail_thread = threading.Thread(None, self._tail) - self.tail_thread.start() + if termination_func or output_func: + self._start_thread() def __getinitargs__(self): @@ -617,6 +618,8 @@ class kvm_tail(kvm_spawn): Must take a single parameter -- the exit status. """ self.termination_func = termination_func + if termination_func and not self.tail_thread: + self._start_thread() def set_termination_params(self, termination_params): @@ -637,6 +640,8 @@ class kvm_tail(kvm_spawn): output from the process. Must take a single string parameter. """ self.output_func = output_func + if output_func and not self.tail_thread: + self._start_thread() def set_output_params(self, output_params): @@ -726,6 +731,11 @@ class kvm_tail(kvm_spawn): pass + def _start_thread(self): + self.tail_thread = threading.Thread(None, self._tail) + self.tail_thread.start() + + def _join_thread(self): # Wait for the tail thread to exit if self.tail_thread: