[squeak-dev] The Inbox: KernelTests-jar.432.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jun 6 21:57:53 UTC 2022


A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-jar.432.mcz

==================== Summary ====================

Name: KernelTests-jar.432
Author: jar
Time: 6 June 2022, 11:57:50.959098 pm
UUID: 7ac20a02-7d4d-fb48-9586-14ab9844b799
Ancestors: KernelTests-jar.431

Three more Process tests: non-local returns and another test case for terminating a process that has already started unwinding. Hope this is all.

=============== Diff against KernelTests-jar.431 ===============

Item was added:
+ ----- Method: ProcessTest>>testTerminateTerminatingProcessInUnwindTo (in category 'tests') -----
+ testTerminateTerminatingProcessInUnwindTo
+ 	"Terminating a terminatee process after the terminator process restarted the terminatee
+ 	 process should unwind the terminatee process and let the terminator process terminate."
+ 	
+ 	| terminator terminatee unwound |
+ 	unwound := false.
+ 	terminatee := [[Semaphore new wait] ensure: [unwound := true]] fork.
+ 	Processor yield.
+ 	terminator := [terminatee terminate] newProcess.
+ 	self assert: terminatee isBlocked.
+ 	self assert: terminator isSuspended.
+ 	terminator runUntil: [:ctx | ctx selectorToSendOrSelf = #resume].
+ 	"terminator steps until terminatee's unwind context is set"
+ 	terminator suspendedContext nextInstruction. "skip terminatee resume instruction"
+ 	terminator resume. "and run until parked at wait"
+ 	terminatee runUntil: [:ctx | ctx selectorToSendOrSelf = #unwindTo:].
+ 	"terminatee steps until at #unwindTo:"
+ 	self assert: terminatee isSuspended.
+ 	terminatee terminate.
+ 	self assert: terminatee isTerminated. 
+ 	self assert: unwound.
+ 	self assert: terminator isTerminated!

Item was added:
+ ----- Method: ProcessUnwindTest>>testTerminateNestedEnsureWithReturn1 (in category 'tests') -----
+ testTerminateNestedEnsureWithReturn1
+ 	"Terminate suspended process.
+ 	Test all nested unwind blocks are correctly executed; 
+ 	all unwind blocks halfway through their execution should be completed."
+ 	
+ 	"While testTerminateInNestedEnsureWithReturn1 to 8 start unwinding
+ 	 from inside a halfways through unwind block, this test (and the next) start
+ 	 the unwind from outside any ensure argument (aka unwind) block, testing
+ 	 the second half of the #unwindTo:safely: method."
+ 
+ 	| p x1 x2 x3 x4 x5 |
+ 	x1 := x2 := x3 := x4 := x5 := false.
+ 	p := 
+ 	[
+ 		[:return | 
+ 			[	Processor activeProcess suspend.
+ 				[ ] ensure: [
+ 					[ ] ensure: [
+ 						x1 := true]. 
+ 					x2 := true]
+ 			] ensure: [
+ 				return value.
+ 				x3 := true].
+ 			x4 := true.
+ 		] valueWithExit.
+ 	x5 := true.
+ 	] newProcess.
+ 	p resume.
+ 	Processor yield.
+ 	"make sure p is suspended and none of the unwind blocks has finished yet"
+ 	self assert: p isSuspended.
+ 	self deny: x1 | x2 | x3 | x4 | x5.
+ 	"now terminate the process and make sure all unwind blocks have finished"
+ 	p terminate.
+ 	self assert: p isTerminated.
+ 	self deny: x1 & x2 & x3 & x4 & x5!

Item was added:
+ ----- Method: ProcessUnwindTest>>testTerminateNestedEnsureWithReturn2 (in category 'tests') -----
+ testTerminateNestedEnsureWithReturn2
+ 	"Terminate suspended process.
+ 	Test all nested unwind blocks are correctly executed; 
+ 	all unwind blocks halfway through their execution should be completed."
+ 
+ 	| p x1 x2 x3 x4 x5 |
+ 	x1 := x2 := x3 := x4 := x5 := false.
+ 	p := 
+ 	[
+ 		[:return | 
+ 			[
+ 				[Processor activeProcess suspend] ensure: [
+ 					[ ] ensure: [
+ 						x1 := true]. 
+ 					return value.
+ 					x2 := true]
+ 			] ensure: [
+ 				x3 := true].
+ 			x4 := true.
+ 		] valueWithExit.
+ 	x5 := true.
+ 	] newProcess.
+ 	p resume.
+ 	Processor yield.
+ 	"make sure p is suspended and none of the unwind blocks has finished yet"
+ 	self assert: p isSuspended.
+ 	self deny: x1 | x2 | x3 | x4 | x5.
+ 	"now terminate the process and make sure all unwind blocks have finished"
+ 	p terminate.
+ 	self assert: p isTerminated.
+ 	self deny: x1 & x2 & x3 & x4 & x5!



More information about the Squeak-dev mailing list