From: Michael Goldish Subject: [KVM-AUTOTEST PATCH v3 05/11] KVM test: Thread.join(): insert the current context into the thread's exception Date: Fri, 7 Jan 2011 20:48:05 +0200 Message-ID: <1294426091-16704-5-git-send-email-mgoldish@redhat.com> References: <1294426091-16704-1-git-send-email-mgoldish@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autotest@test.kernel.org, kvm@vger.kernel.org Return-path: In-Reply-To: <1294426091-16704-1-git-send-email-mgoldish@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: autotest-bounces@test.kernel.org Errors-To: autotest-bounces@test.kernel.org List-Id: kvm.vger.kernel.org Because contexts are thread specific, exceptions raised in another thread will not contain the context in which the thread was started/joined. This context should be explicitly inserted into any exception raised in the thread and re-raised in join(). Signed-off-by: Michael Goldish --- client/tests/kvm/kvm_utils.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py index 646d4fa..6cfed3f 100644 --- a/client/tests/kvm/kvm_utils.py +++ b/client/tests/kvm/kvm_utils.py @@ -1179,6 +1179,11 @@ class Thread(threading.Thread): 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] else: return self._retval -- 1.7.3.4