Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-06 Thread Michael Goldish
On 01/05/2011 06:21 PM, Avi Kivity wrote: On 01/05/2011 06:12 PM, Avi Kivity wrote: On 01/05/2011 05:45 PM, Michael Goldish wrote: In complex tests (KVM) an exception string is often not informative enough and the traceback and source code have to be examined in order to figure out what

[KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-05 Thread Michael Goldish
In complex tests (KVM) an exception string is often not informative enough and the traceback and source code have to be examined in order to figure out what caused the exception. Context strings are a way for tests to provide information about what they're doing, so that when an exception is

Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-05 Thread Eduardo Habkost
On Wed, Jan 05, 2011 at 05:45:26PM +0200, Michael Goldish wrote: In complex tests (KVM) an exception string is often not informative enough and the traceback and source code have to be examined in order to figure out what caused the exception. Context strings are a way for tests to provide

Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-05 Thread Avi Kivity
On 01/05/2011 05:45 PM, Michael Goldish wrote: In complex tests (KVM) an exception string is often not informative enough and the traceback and source code have to be examined in order to figure out what caused the exception. Context strings are a way for tests to provide information about what

Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-05 Thread Eduardo Habkost
On Wed, Jan 05, 2011 at 06:12:05PM +0200, Avi Kivity wrote: It would be nice to make the error context a stack, and to use the with statement to manage the stack: with error.context(main test): foo() with error.context(before reboot): bar() If foo() throws

Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-05 Thread Avi Kivity
On 01/05/2011 06:12 PM, Avi Kivity wrote: On 01/05/2011 05:45 PM, Michael Goldish wrote: In complex tests (KVM) an exception string is often not informative enough and the traceback and source code have to be examined in order to figure out what caused the exception. Context strings are a

Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-05 Thread Avi Kivity
On 01/05/2011 06:21 PM, Eduardo Habkost wrote: On Wed, Jan 05, 2011 at 06:12:05PM +0200, Avi Kivity wrote: It would be nice to make the error context a stack, and to use the with statement to manage the stack: with error.context(main test): foo() with

Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-05 Thread Eduardo Habkost
On Wed, Jan 05, 2011 at 06:21:35PM +0200, Avi Kivity wrote: btw, you can have a decorator for enclosing an entire function in an error context: @function_error_context('migration test') def migration_test(...): ... @context_aware does that, but it doesn't let you set the

Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-05 Thread Avi Kivity
On 01/05/2011 06:36 PM, Eduardo Habkost wrote: On Wed, Jan 05, 2011 at 06:21:35PM +0200, Avi Kivity wrote: btw, you can have a decorator for enclosing an entire function in an error context: @function_error_context('migration test') def migration_test(...): ...

Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-05 Thread Michael Goldish
On 01/05/2011 06:21 PM, Eduardo Habkost wrote: On Wed, Jan 05, 2011 at 06:12:05PM +0200, Avi Kivity wrote: It would be nice to make the error context a stack, and to use the with statement to manage the stack: with error.context(main test): foo() with error.context(before

Re: [KVM-AUTOTEST PATCH v2 3/6] [RFC] Introduce exception context strings

2011-01-05 Thread Eduardo Habkost
On Wed, Jan 05, 2011 at 08:55:44PM +0200, Michael Goldish wrote: On 01/05/2011 06:21 PM, Eduardo Habkost wrote: By the way, I think we could make _new_context() and _pop_context() part of the public interface (i.e. remove the _ from their names). I see @context_aware as just a helper for a