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

commits at source.squeak.org commits at source.squeak.org
Fri Dec 17 12:22:11 UTC 2021


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

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

Name: KernelTests-jar.417
Author: jar
Time: 17 December 2021, 1:22:07.449151 pm
UUID: d8dc5591-fbf5-3645-bc11-b3125b4bfcd6
Ancestors: KernelTests-ct.414

Complement Kernel-jar.1436

Test (1) multiple termination and (2) resuming a process being terminated

=============== Diff against KernelTests-ct.414 ===============

Item was added:
+ ----- Method: ProcessTest>>testResumeTerminatingProcess (in category 'tests') -----
+ testResumeTerminatingProcess
+ 
+ 	| terminatee terminator resumed semaphore |
+ 	semaphore := Semaphore new.
+ 	terminatee := [semaphore critical:[]. resumed := true] fork.
+ 	Processor yield.
+ 	terminator := [terminatee terminate] newProcess.
+ 	self assert: terminatee suspendingList == semaphore.
+ 	self assert: terminator isSuspended. 
+ 	"run terminator and stop inside #releaseCriticalSection:"
+ 	terminator runUntil: [:ctx | ctx selectorToSendOrSelf = #selectorJustSentOrSelf].
+ 	self assert: terminator isSuspended.
+ 	"resume the terminatee process and and check if the VM raises an error;
+ 	an error is expected because terminatee's suspendedContext equals nil"
+ 	self should: [terminatee resume] raise: Error.
+ 	"now let the terminator finish terminating the terminatee process"
+ 	terminator resume.
+ 	Processor yield.
+ 	self assert: resumed isNil.
+ 	self assert: terminatee isTerminated.
+ 	self assert: terminator isTerminated!

Item was added:
+ ----- Method: ProcessTest>>testTerminateTerminatingProcess (in category 'tests') -----
+ testTerminateTerminatingProcess
+ 
+ 	| terminatee terminator resumed semaphore |
+ 	semaphore := Semaphore new.
+ 	terminatee := [semaphore critical:[]. resumed := true] fork.
+ 	Processor yield.
+ 	terminator := [terminatee terminate] newProcess.
+ 	self assert: terminatee suspendingList == semaphore.
+ 	self assert: terminator isSuspended. 
+ 	"run terminator and stop inside #releaseCriticalSection:"
+ 	terminator runUntil: [:ctx | ctx selectorToSendOrSelf = #selectorJustSentOrSelf].
+ 	self assert: terminator isSuspended.
+ 	"terminate the terminatee process again and let the termination finish;
+ 	an error is expected because #terminate detected multiple termination"
+ 	self should: [terminatee terminate] raise: Error.
+ 	"now let the terminator finish terminating the terminatee process"
+ 	terminator resume.
+ 	Processor yield.
+ 	self assert: resumed isNil.
+ 	self assert: terminatee isTerminated.
+ 	self assert: terminator isTerminated!



More information about the Squeak-dev mailing list