[squeak-dev] The Inbox: KernelTests-jar.415.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Dec 15 17:11:23 UTC 2021
A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-jar.415.mcz
==================== Summary ====================
Name: KernelTests-jar.415
Author: jar
Time: 15 December 2021, 6:11:21.293426 pm
UUID: d93f98ba-dfad-9846-adaf-9e0898b8a663
Ancestors: KernelTests-ct.414
supersede Tests-jar.466; replaced generic names with more descriptive ones, moved from Tests-Exceptions category to KernelTests and placed under ProcessTest where I guess this belongs (in a new subclass UnwindTest not to clutter the superclass).
Complements new #terminate in Kernel-jar.1435.
Please remove Tests-jar.466 from the Inbox
=============== Diff against KernelTests-ct.414 ===============
Item was added:
+ ProcessTest subclass: #UnwindTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'KernelTests-Processes'!
Item was added:
+ ----- Method: UnwindTest>>testTerminateActiveInNestedEnsure1 (in category 'tests') -----
+ testTerminateActiveInNestedEnsure1
+ "Terminate active process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [
+ [ ] ensure: [
+ [Processor activeProcess terminate] ensure: [
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := true.
+ ] newProcess.
+ p resume.
+ Processor yield.
+ "make sure p suspended itself and none of the unwind blocks has finished yet"
+ self assert: p isSuspended.
+ self deny: x1 | x2 | x3 | x4.
+ "now let the termination continue and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateActiveInNestedEnsure2 (in category 'tests') -----
+ testTerminateActiveInNestedEnsure2
+ "Terminate active process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [
+ [ ] ensure: [
+ [ ] ensure: [
+ Processor activeProcess terminate.
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := true.
+ ] newProcess.
+ p resume.
+ Processor yield.
+ "make sure p suspended itself and none of the unwind blocks has finished yet"
+ self assert: p isSuspended.
+ self deny: x1 | x2 | x3 | x4.
+ "now let the termination continue and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateBlockedInNestedEnsure1 (in category 'tests') -----
+ testTerminateBlockedInNestedEnsure1
+ "Terminate blocked process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [
+ [ ] ensure: [
+ [semaphore wait] ensure: [
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := true.
+ ] newProcess.
+ p resume.
+ Processor yield.
+ "make sure p is runnable and none of the unwind blocks has finished yet"
+ self assert: p isBlocked.
+ self deny: x1 | x2 | x3 | x4.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateBlockedInNestedEnsure2 (in category 'tests') -----
+ testTerminateBlockedInNestedEnsure2
+ "Terminate blocked process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [
+ [ ] ensure: [
+ [ ] ensure: [
+ semaphore wait.
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := true.
+ ] newProcess.
+ p resume.
+ Processor yield.
+ "make sure p is runnable and none of the unwind blocks has finished yet"
+ self assert: p isBlocked.
+ self deny: x1 | x2 | x3 | x4.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateInNestedEnsureWithReturn1 (in category 'tests') -----
+ testTerminateInNestedEnsureWithReturn1
+ "Terminate suspended process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [:return |
+ [
+ [ ] ensure: [
+ [Processor activeProcess suspend] ensure: [
+ x1 := true. return value].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := true.
+ ] valueWithExit
+ ] 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.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x3.
+ self deny: x2 & x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateInNestedEnsureWithReturn2 (in category 'tests') -----
+ testTerminateInNestedEnsureWithReturn2
+ "Terminate suspended process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [:return |
+ [
+ [ ] ensure: [
+ [] ensure: [
+ Processor activeProcess suspend.
+ x1 := true. return value].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := true.
+ ] valueWithExit
+ ] 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.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x3.
+ self deny: x2 & x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateInNestedEnsureWithReturn3 (in category 'tests') -----
+ testTerminateInNestedEnsureWithReturn3
+ "Terminate suspended process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [:return |
+ [
+ [ ] ensure: [
+ [Processor activeProcess suspend] ensure: [
+ x1 := true].
+ x2 := true. return value]
+ ] ensure: [
+ x3 := true].
+ x4 := true.
+ ] valueWithExit
+ ] 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.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateInNestedEnsureWithReturn4 (in category 'tests') -----
+ testTerminateInNestedEnsureWithReturn4
+ "Terminate suspended process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [:return |
+ [
+ [ ] ensure: [
+ [] ensure: [
+ Processor activeProcess suspend.
+ x1 := true].
+ x2 := true. return value]
+ ] ensure: [
+ x3 := true].
+ x4 := true.
+ ] valueWithExit
+ ] 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.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateInNestedEnsureWithReturn5 (in category 'tests') -----
+ testTerminateInNestedEnsureWithReturn5
+ "Terminate suspended process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [:return |
+ [
+ [ ] ensure: [
+ [Processor activeProcess suspend] ensure: [
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true. return value].
+ x4 := true.
+ ] valueWithExit
+ ] 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.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateInNestedEnsureWithReturn6 (in category 'tests') -----
+ testTerminateInNestedEnsureWithReturn6
+ "Terminate suspended process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [:return |
+ [
+ [ ] ensure: [
+ [] ensure: [
+ Processor activeProcess suspend.
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true. return value].
+ x4 := true.
+ ] valueWithExit
+ ] 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.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateInNestedEnsureWithReturn7 (in category 'tests') -----
+ testTerminateInNestedEnsureWithReturn7
+ "Terminate suspended process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [:return |
+ [
+ [ ] ensure: [
+ [Processor activeProcess suspend] ensure: [
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := true. return value.
+ ] valueWithExit
+ ] 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.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateInNestedEnsureWithReturn8 (in category 'tests') -----
+ testTerminateInNestedEnsureWithReturn8
+ "Terminate suspended process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [:return |
+ [
+ [ ] ensure: [
+ [] ensure: [
+ Processor activeProcess suspend.
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := true. return value.
+ ] valueWithExit
+ ] 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.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateRunnableInNestedEnsure1 (in category 'tests') -----
+ testTerminateRunnableInNestedEnsure1
+ "Terminate runnable process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [
+ [ ] ensure: [
+ [Processor yield] ensure: [
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := true.
+ ] newProcess.
+ p resume.
+ Processor yield.
+ "make sure p is runnable and none of the unwind blocks has finished yet"
+ self assert: p isRunnable.
+ self deny: x1 | x2 | x3 | x4.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateRunnableInNestedEnsure2 (in category 'tests') -----
+ testTerminateRunnableInNestedEnsure2
+ "Terminate runnable process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [
+ [ ] ensure: [
+ [ ] ensure: [
+ Processor yield.
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := true.
+ ] newProcess.
+ p resume.
+ Processor yield.
+ "make sure p is suspended and none of the unwind blocks has finished yet"
+ self assert: p isRunnable.
+ self deny: x1 | x2 | x3 | x4.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateSuspendedInNestedEnsure1 (in category 'tests') -----
+ testTerminateSuspendedInNestedEnsure1
+ "Terminate suspended process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [
+ [ ] ensure: [
+ [Processor activeProcess suspend] ensure: [
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := 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.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
Item was added:
+ ----- Method: UnwindTest>>testTerminateSuspendedInNestedEnsure2 (in category 'tests') -----
+ testTerminateSuspendedInNestedEnsure2
+ "Terminate suspended process.
+ Test all nested unwind blocks are correctly unwound;
+ all unwind blocks halfway through their execution should be completed."
+
+ | p x1 x2 x3 x4 |
+ x1 := x2 := x3 := x4 := false.
+ p :=
+ [
+ [
+ [ ] ensure: [
+ [ ] ensure: [
+ Processor activeProcess suspend.
+ x1 := true].
+ x2 := true]
+ ] ensure: [
+ x3 := true].
+ x4 := 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.
+ "now terminate the process and make sure all unwind blocks have finished"
+ [p terminate] forkAt: Processor activePriority + 1.
+ self assert: p isTerminated.
+ self assert: x1 & x2 & x3.
+ self deny: x4.!
More information about the Squeak-dev
mailing list
|