[KVM-AUTOTEST PATCH v3 05/11] KVM test: Thread.join(): insert the current context into the thread's exception

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <mgoldish@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux