[squeak-dev] The Inbox: KernelTests-jar.431.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Jun 6 14:26:08 UTC 2022
A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-jar.431.mcz
==================== Summary ====================
Name: KernelTests-jar.431
Author: jar
Time: 6 June 2022, 4:26:06.000182 pm
UUID: 1c79cb69-dd24-6440-917f-0d3142fd4a17
Ancestors: KernelTests-jar.430
One more Process test; this verifies that if a terminating process gets stopped and terminated again, all unwinds execute correctly and the original terminator process terminates as well.
Such a situation may occur e.g. when a terminating process encounters an error and opens a debugger (or calls another recovery machinery). In such case it's legitimate to terminate the terminating process again (by closing the debugger or as a termination by another recovery tool).
Note: it's a different situation than in 'testTerminateTerminatingProcess' where the second termination is invoked "too early" and may cause unpredictable outcome - that test is still WIP.
Add testTerminateWithDelayInUnwind to the expectedFailures for the moment. Adopting #teminate for that scenario is WIP.
=============== Diff against KernelTests-jar.430 ===============
Item was changed:
----- Method: ProcessTest>>expectedFailures (in category 'failures') -----
expectedFailures
+ ^ #(testTerminateTerminatingProcess testResumeTerminatingProcess testTerminateWithDelayInUnwind)!
- ^ #(testTerminateTerminatingProcess testResumeTerminatingProcess)!
Item was added:
+ ----- Method: ProcessTest>>testTerminateTerminatingProcessAfterUnwindStarted (in category 'tests') -----
+ testTerminateTerminatingProcessAfterUnwindStarted
+ "Terminating a terminatee process after the terminator process restarted the terminatee
+ process should unwind the terminatee process and let the terminator process terminate."
+
+ "Such a situation may occur e.g. when a terminating process encounters an error and
+ opens a debugger (or calls another recovery machinery). In such case it's legitimate
+ to terminate the terminating process again (by closing the debugger or as a termination
+ by another recovery tool).
+
+ Note: this is a different situation than in 'testTerminateTerminatingProcess' where
+ the second termination is invoked 'too early' and may cause unpredictable outcome."
+
+ | terminator terminatee unwound unwindBlock |
+ unwound := false.
+ unwindBlock := [Processor activeProcess suspend. unwound := true].
+ terminatee := [[Semaphore new wait] ensure: unwindBlock] fork.
+ Processor yield.
+ terminator := [terminatee terminate] newProcess.
+ self assert: terminatee isBlocked.
+ self assert: terminator isSuspended.
+ terminator resume.
+ Processor yield.
+ "terminator starts terminatee's unwind"
+ Processor yield.
+ "terminatee resumes and stops at unwindBlock's #suspend"
+ self assert: terminatee isSuspended.
+ terminatee terminate.
+ self assert: terminatee isTerminated.
+ self assert: unwound.
+ self assert: terminator isTerminated!
More information about the Squeak-dev
mailing list
|