[squeak-dev] The Trunk: ToolsTests-ct.107.mcz

christoph.thiede at student.hpi.uni-potsdam.de christoph.thiede at student.hpi.uni-potsdam.de
Mon Jan 10 18:53:09 UTC 2022


Hi Jaromir,

you're totally right, sorry for the confusion. How would you think about this test block instead?

	[[x := 1] ensure:
		[[y := 1.
		self error: #first.
		y := 2] ensure:
			[z := 1.
			self error: #second.
			z := 2]].
	x := 2] value.

If you abandon #first and proceed #second, {x. y. z} will be correctly #(1 1 2).
If you terminate #first and proceed #second, {x. y. z} should be #(1 2 2).

Would you agree with that? :)
If yes, I will upload this to the Trunk, try to make the tests more self-explaining, and comment out the #isTerminated assertions for now.

Best,
Christoph

---
Sent from Squeak Inbox Talk

On 2022-01-03T16:23:01+01:00, mail at jaromir.net wrote:

> Hi Christoph,
> 
> I'm pretty sure this test (test20TerminateProcess) isn't working correctly; the expectations are set as if testing debugger's Proceed, not Terminate. Debugger terminate in this scenario will be answering identically as Abandon because you proceed through the second error inside the ensure argument block :)
> 
> Thanks,
> 
> best,
> ~~~
> ^[^    Jaromir
> 
> Sent from Squeak Inbox Talk
> 
> On 2021-12-19T18:56:48+01:00, mail at jaromir.net wrote:
> 
> > Hi Christoph,
> > 
> > I have tested your test20TerminateProcess and I think the expectations are not set correctly:
> > 
> > If you run your nice test-block in a workspace
> > 
> >     [x := 1.
> >     [y := 1.
> >     self error: #first.
> >     y := 2] ensure:
> >         [z := 1.
> >         self error: #second.
> >         z := 2].
> >     x := 2] value
> > 
> > it answers correctly {x. y. z} = #(1 1 2) for both Abandon and terminate options (if you Abandon or terminate the first error outside the ensure block and Proceed the second error inside the ensure block; there are no unfinished unwind blocks present when termination happens and the two mode of termination end identically).
> > 
> > Please check I understand the test intention correctly (I haven't decoded all the fine details yet but thanks for inspiration!).
> > 
> > FYI, I've uploaded 4 tests complementing your ones (ToolsTests-jar.109)
> > 
> > Also, with regard to the latest conversation about multiple terminations / resumptions in http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-December/217695.html I'd like to ask you to wait with assertions about isTerminated until the issue is resolved. At the moment isTerminated is either not 100% truthful and answers yes during termination or is unprotected against multiple termination issue.
> > 
> > Best,
> > 
> > 
> > ~~~
> > ^[^    Jaromir
> > 
> > Sent from Squeak Inbox Talk
> > 
> > On 2021-12-16T01:38:57+00:00, commits at source.squeak.org wrote:
> > 
> > > Christoph Thiede uploaded a new version of ToolsTests to project The Trunk:
> > > http://source.squeak.org/trunk/ToolsTests-ct.107.mcz
> > > 
> > > ==================== Summary ====================
> > > 
> > > Name: ToolsTests-ct.107
> > > Author: ct
> > > Time: 16 December 2021, 2:29:44.341664 am
> > > UUID: 6b771eec-03fe-0a4d-91c9-50480d259573
> > > Ancestors: ToolsTests-mt.106
> > > 
> > > Complements Kernel-ct.1434 (revised termination modi on Process). Adds end-to-end tests for abandoning vs. terminating a debugger inside an active unwind context. Makes proper use of new termination modi in clean-ups for other tests.
> > > 
> > > =============== Diff against ToolsTests-mt.106 ===============
> > > 
> > > Item was changed:
> > >   ----- Method: DebuggerTests>>tearDown (in category 'running') -----
> > >   tearDown
> > >   
> > >       debugger ifNotNil: [debugger close].
> > > +     process ifNotNil: [process terminateAggressively].
> > > -     process ifNotNil: [process terminate].
> > >       
> > >       process := nil.
> > >       debugger := nil.
> > >       window := nil.
> > >   
> > >       reset do: #value.    
> > >       
> > >       super tearDown.!
> > > 
> > > Item was changed:
> > >   ----- Method: DebuggerTests>>test16HandleSimulationError (in category 'tests') -----
> > >   test16HandleSimulationError
> > >       "Regression test. In the past, the scenario below led to an infinite debugger chain freezing your image. Be careful when running this test in an unpatched image!! For more information, see http://forum.world.st/I-broke-the-debugger-td5110752.html."
> > >   
> > >       | userProcess |
> > >       process := Process forBlock: [
> > >           "the faulty user code"
> > >           thisContext pc: nil].
> > >       debugger := process debug.
> > >       
> > >       [userProcess := [debugger stepThrough] fork.
> > >       Processor yield.
> > >       
> > >       self deny: [process isTerminated].
> > >       self assert: [userProcess isSuspended]]
> > >           
> > >           ensure: [
> > > +             process destroy.
> > > -             process suspendedContext: nil; terminate.
> > >               debugger close.
> > >               process := userProcess.
> > >               self findDebugger "for correct tearDown"].!
> > > 
> > > Item was changed:
> > >   ----- Method: DebuggerTests>>test17HandleBlockCannotReturn (in category 'tests') -----
> > >   test17HandleBlockCannotReturn
> > >       "Regression test. In the past, the scenario below led to an infinite debugger chain freezing your image. Be careful when running this test in an unpatched image!! For more information, see http://forum.world.st/I-broke-the-debugger-td5110752.html."
> > >   
> > >       | userProcess |
> > >       process := Process forBlock: [
> > >           "the faulty user code"
> > >           [] ensure: [thisContext privSender: nil]].
> > >       debugger := process debug.
> > >       
> > >       [userProcess := [debugger stepOver] fork.
> > >       Processor yield.
> > >       
> > >       self assert: [process isTerminated].
> > >       self deny: [userProcess isRunnable]]
> > >           
> > >           ensure: [
> > > +             process terminateAggressively.
> > > -             process terminate.
> > >               debugger close.
> > >               process := userProcess.
> > >               self findDebugger "for correct tearDown"].!
> > > 
> > > Item was changed:
> > >   ----- Method: DebuggerTests>>test18HandleNestedBlockCannotReturn (in category 'tests') -----
> > >   test18HandleNestedBlockCannotReturn
> > >       "Regression test. In the past, the scenario below led to an infinite debugger chain freezing your image. Be careful when running this test in an unpatched image!! For more information, see http://forum.world.st/I-broke-the-debugger-td5110752.html."
> > >   
> > >       | metaProcess metaDebugger userProcess |
> > >       process := Process forBlock: [
> > >           "the faulty user code"
> > >           [] ensure: [thisContext privSender: nil]].
> > >       debugger := process debug.
> > >       metaProcess := Process forBlock: [
> > >           debugger stepOver].
> > >       metaDebugger := metaProcess debug.
> > >       
> > >       [userProcess := [metaDebugger stepOver] fork.
> > >       Processor yield.
> > >       
> > >       self assert: [process isTerminated].
> > >       self deny: [userProcess isRunnable]]
> > >           
> > >           ensure: [
> > > +             process terminateAggressively.
> > > -             process terminate.
> > >               debugger close.
> > > +             metaProcess terminateAggressively.
> > > -             metaProcess terminate.
> > >               metaDebugger close.
> > >               process := userProcess.
> > >               self findDebugger "for correct tearDown"].!
> > > 
> > > Item was added:
> > > + ----- Method: DebuggerTests>>test19Abandon (in category 'tests') -----
> > > + test19Abandon
> > > +     "When the debugger is abandoned, the interrupted process is terminated aggressively, i.e., all not yet started unwind contexts are executed. Further errors that occur during unwinding lead to another debugger showing up. This is the acceptance test equivalent for ProcessTest >> #testTerminateNestedUnwindAggressively."
> > > + 
> > > +     | x y z userProcess |
> > > +     process := Process
> > > +         forBlock:
> > > +             [x := 1.
> > > +             [y := 1.
> > > +             self error: #first.
> > > +             y := 2] ensure:
> > > +                 [z := 1.
> > > +                 self error: #second.
> > > +                 z := 2].
> > > +             x := 2]
> > > +         runUntil: [:ctx | y = 1].
> > > +     self should: {x. y. z} = {1. 1. nil}.
> > > +     debugger := process debug.
> > > +     
> > > +     userProcess := [debugger proceed] forkAt: Processor activePriority + 1.
> > > +     Processor yield.
> > > +     self findDebugger.
> > > +     
> > > +     self deny: process isTerminated.
> > > +     self assert: userProcess isTerminated.
> > > +     self deny: debugger isNil.
> > > +     self assert: {1. 1. nil} equals: {x. y. z}.
> > > +     self assert: (debugger containingWindow label includesSubstring: #first).
> > > +     
> > > +     userProcess := [debugger abandon] forkAt: Processor activePriority + 1.
> > > +     Processor yield.
> > > +     self findDebugger.
> > > +     
> > > +     self deny: process isTerminated.
> > > +     self assert: userProcess isTerminated.
> > > +     self deny: debugger isNil.
> > > +     self assert: {1. 1. 1} equals: {x. y. z}.
> > > +     self assert: (debugger containingWindow label includesSubstring: #second).
> > > +     
> > > +     userProcess := [debugger proceed] forkAt: Processor activePriority + 1.
> > > +     Processor yield.
> > > +     self findDebugger.
> > > +     
> > > +     self assert: process isTerminated.
> > > +     self assert: userProcess isTerminated.
> > > +     self assert: debugger isNil.
> > > +     self assert: {1. 1. 2} equals: {x. y. z}.!
> > > 
> > > Item was added:
> > > + ----- Method: DebuggerTests>>test20TerminateProcess (in category 'tests') -----
> > > + test20TerminateProcess
> > > +     "When the debugger's process is terminated, all unwind contexts, including already entered ones, are executed. Further errors that occur during unwinding lead to another debugger showing up. This is the acceptance test equivalent for ProcessTest >> #testTerminateNestedUnwind."
> > > + 
> > > +     | x y z userProcess |
> > > +     process := Process
> > > +         forBlock:
> > > +             [x := 1.
> > > +             [y := 1.
> > > +             self error: #first.
> > > +             y := 2] ensure:
> > > +                 [z := 1.
> > > +                 self error: #second.
> > > +                 z := 2].
> > > +             x := 2]
> > > +         runUntil: [:ctx | y = 1].
> > > +     self should: {x. y. z} = {1. 1. nil}.
> > > +     debugger := process debug.
> > > +     
> > > +     userProcess := [debugger proceed] forkAt: Processor activePriority + 1.
> > > +     Processor yield.
> > > +     self findDebugger.
> > > +     
> > > +     self deny: process isTerminated.
> > > +     self assert: userProcess isTerminated.
> > > +     self deny: debugger isNil.
> > > +     self assert: {1. 1. nil} equals: {x. y. z}.
> > > +     self assert: (debugger containingWindow label includesSubstring: #first).
> > > +     
> > > +     userProcess := [debugger terminateProcess] forkAt: Processor activePriority + 1.
> > > +     Processor yield.
> > > +     self findDebugger.
> > > +     
> > > +     self deny: process isTerminated.
> > > +     self assert: userProcess isTerminated.
> > > +     self deny: debugger isNil.
> > > +     self assert: {1. 2. 1} equals: {x. y. z}.
> > > +     self assert: (debugger containingWindow label includesSubstring: #second).
> > > +     
> > > +     userProcess := [debugger proceed] forkAt: Processor activePriority + 1.
> > > +     Processor yield.
> > > +     self findDebugger.
> > > +     
> > > +     self assert: process isTerminated.
> > > +     self assert: userProcess isTerminated.
> > > +     self assert: debugger isNil.
> > > +     self assert: {2. 2. 2} equals: {x. y. z}.!
> > > 
> > >
> > 
> >
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220110/4124c75c/attachment-0001.html>


More information about the Squeak-dev mailing list