Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] [RFC] Introduce exception context strings

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

 



On Mon, Jan 03, 2011 at 11:07:53PM +0200, Michael Goldish wrote:
> 
> If I understand your suggestion correctly, then:
> 
> - The purpose of contexts is to add information to exceptions.  If an
> exception is raised and you call clear_context() in a finally clause,
> you remove the context of the current function.  If the function itself
> calls get_context() it'll see the current context, but as soon as an
> exception is raised the context disappears all the way up to the point
> where the exception is caught.

I need to add the code to save the context stack when an exception is
raised (I focused on the code to save the context information and forgot
about the initial purpose  :).

> 
> - A possible solution would be not to use finally and only call
> clear_context() if the function terminates successfully.  Then if a
> function raises an exception, the context remains for some handler to
> catch and print.  However, if we catch the exception sometime later and
> decide not to fail the test (for example: login failed and we don't
> care) then we have to pop some context items, or the context stack will
> be corrupted.

When an exception is raised, you don't need to keep the context stack
untouched, you can pop it anyway. You just need to save a copy of the
current stack in case the exception is never handled.

> 
> - Additionally, if some function raises an exception and we perform some
> cleanup in a finally clause, and during that cleanup we call another
> function that calls context(), then our context stack will be modified
> by the other function, and the context handler (which calls
> get_context()) will not see the original context but rather a modified one.

We can just save the context when an exception is raised. If upper in
the stack some other @context_aware function gets the same exception, we
don't need to save it again. If the exception is ignored, we can just
leave the saved context there (it would be overwritten if a new
exception is raised later, anyway).

I will try to make it work and send a new version. I believe we won't
need stack trace tricks to make that work.

-- 
Eduardo
--
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