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

commits at source.squeak.org commits at source.squeak.org
Sun Jun 5 17:16:46 UTC 2022


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

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

Name: KernelTests-jar.429
Author: jar
Time: 5 June 2022, 7:16:44.422705 pm
UUID: 39150694-f022-7643-83f7-b548fb60b03a
Ancestors: KernelTests-jar.428

One more process test to check correct handling of unwind error (errors signaled inside unwind blocks during termination).

=============== Diff against KernelTests-jar.428 ===============

Item was added:
+ ----- Method: ProcessTest>>testTerminateHandlingUnwindError (in category 'tests') -----
+ testTerminateHandlingUnwindError
+ 	"Test an error inside an unwind block is handled correctly."
+ 	
+ 	"Workspace example:
+ 		[ [[Processor activeProcess terminate] ensure: [1/0]] on: ZeroDivide do: [] ] fork
+ 	
+ 	ZeroDivide error should get caught by the handler without opening the Debugger.
+ 	
+ 	To model this example as a test case we have to keep in mind that an error signal 
+ 	in one thread cannot be caught in a different thread: if process 'p' signals an error
+ 	it won't be searching for a handler in the thread that sent 'p terminate' message.
+ 	So we can't do something like:
+ 		p := [ [ [Semaphore new wait] ensure: unwindBlock ] on: ZeroDivide do: [] ] fork.
+ 		Processor yield.
+ 		self shouldnt: [p terminate] raise: Error
+ 	Instead, in order to catch the situation the ZeroDivide error is not caught within 'p',
+ 	we try to catch the UnhandledError raised in 'p' indicating the ZeroDivide has been
+ 	missed.	"
+ 	
+ 	| p error unwindBlock |
+ 	unwindBlock := [[1/0] on: UnhandledError do: [error := true]].
+ 	p := [ [ [Semaphore new wait] ensure: unwindBlock ] on: ZeroDivide do: [] ] fork.
+ 	Processor yield.
+ 	self assert: p isBlocked. 
+ 	error := false.
+ 	p terminate.
+ 	self deny: error.
+ 	self assert: p isTerminated!



More information about the Squeak-dev mailing list