From patchwork Tue Jan 11 18:33:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 472261 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 p0BIWs37011637 for ; Tue, 11 Jan 2011 18:32:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756237Ab1AKScx (ORCPT ); Tue, 11 Jan 2011 13:32:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1585 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756196Ab1AKScw (ORCPT ); Tue, 11 Jan 2011 13:32:52 -0500 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 p0BIWp3H027079 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Jan 2011 13:32:51 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p0BIWpV1017472; Tue, 11 Jan 2011 13:32:51 -0500 Received: from qu0061.eng.lab.tlv.redhat.com ([10.35.16.61]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p0BIWmpS024581; Tue, 11 Jan 2011 13:32:50 -0500 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH 2/4] KVM test: kvm_utils.Thread.join(): allow suppressing the exception Date: Tue, 11 Jan 2011 20:33:20 +0200 Message-Id: <1294770802-1501-2-git-send-email-mgoldish@redhat.com> In-Reply-To: <1294770802-1501-1-git-send-email-mgoldish@redhat.com> References: <1294770802-1501-1-git-send-email-mgoldish@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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 11 Jan 2011 18:32:55 +0000 (UTC) diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py index 8e6cef1..d55594c 100644 --- a/client/tests/kvm/kvm_utils.py +++ b/client/tests/kvm/kvm_utils.py @@ -1188,22 +1188,24 @@ class Thread(threading.Thread): del self._target, self._args, self._kwargs - def join(self, timeout=None): + def join(self, timeout=None, suppress_exception=False): """ Join the thread. If target raised an exception, re-raise it. Otherwise, return the value returned by target. @param timeout: Timeout value to pass to threading.Thread.join(). + @param suppress_exception: If True, don't re-raise the exception. """ threading.Thread.join(self, timeout) try: if self._e: - # Because the exception was raised in another thread, we need - # to explicitly insert the current context into it - s = error.exception_context(self._e[1]) - s = error.join_contexts(error.get_context(), s) - error.set_exception_context(self._e[1], s) - raise self._e[0], self._e[1], self._e[2] + if not suppress_exception: + # Because the exception was raised in another thread, we + # need to explicitly insert the current context into it + s = error.exception_context(self._e[1]) + s = error.join_contexts(error.get_context(), s) + error.set_exception_context(self._e[1], s) + raise self._e[0], self._e[1], self._e[2] else: return self._retval finally: