Well with the patch your example would simply look like this:
<example>
MyModule(TestsCommon): def run(): # save state before sync point state1 = state.dump()
# now wait for 'intr' in lnst recipe # this blocks self.wait_on_interrupt()
# save state after sync point state2 = state.dump()
# process the monitor output if state.compare(state1, state2): self.set_fail() else: self.set_pass()
</example>
Basically you just skip the set_handle_intr() call so the wait_on_interrupt call is both a declaration that you're interested in synchronization within task and the action of waiting as well.
As to why I want to do this, I have 2 reasons: 1. it allows you to define your own signal handling for normal situations and when you want to 'wait_on_interrupt' it will return your setup after the call is finished. 2. you type less -> when you want to wait on interrupt, you just call wait_on_interrupt instead of setting the handler then waiting and then possibly resetting the handlers again.
Let me know what you think.
On Mon, Feb 23, 2015 at 02:04:32PM +0100, Jan Tluka wrote:
Mon, Feb 23, 2015 at 01:39:29PM CET, olichtne@redhat.com wrote:
From: Ondrej Lichtner olichtne@redhat.com This commit also changes the method wait_on_interrupt provided for test modules. Previously it was bound to usage coupled with the
I don't think that it __WAS__ bound previously, the method should be still the counterpart to set_handle_intr(). I still don't see the reason why you want to remove it. It's a valid mean to do synchronization from within the task.
The valid use case for this is when you want to compare data before and after another <run> takes place, that's what PktCounter is doing.
<example>
MyModule(TestsCommon): def run(): # I'm interested in synchronization within task self.set_handle_intr()
# save state before sync point state1 = state.dump() # now wait for 'intr' in lnst recipe # this blocks self.wait_on_interrupt() # save state after sync point state2 = state.dump() # process the monitor output if state.compare(state1, state2): self.set_fail() else: self.set_pass()
</example>
set_handle_intr signal handler. Now the method is standalone changes your SIGINT signal handler only for the duration of the method. This makes the method set_handle_intr obsolete so it was removed.
LNST-developers mailing list LNST-developers@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/lnst-developers