[squeak-dev] The Inbox: KernelTests-jar.442.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Jan 26 21:38:02 UTC 2023
A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-jar.442.mcz
==================== Summary ====================
Name: KernelTests-jar.442
Author: jar
Time: 26 January 2023, 10:37:59.494205 pm
UUID: d69aa3b9-4497-6840-935d-1be1ea5f6b80
Ancestors: KernelTests-tpr.441
add setUp and tearDown methods to MonitorTest class to prevent tests from leaving unterminated (blocked on a semaphore) processes behind
=============== Diff against KernelTests-tpr.441 ===============
Item was changed:
TestCase subclass: #MonitorTest
+ instanceVariableNames: 'semaphore'
- instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'KernelTests-Processes'!
Item was added:
+ ----- Method: MonitorTest>>setUp (in category 'as yet unclassified') -----
+ setUp
+
+ super setUp.
+ semaphore := Semaphore new.!
Item was added:
+ ----- Method: MonitorTest>>tearDown (in category 'as yet unclassified') -----
+ tearDown
+ "Release all processes still waiting at the semaphore or in the active priority queue."
+
+ Processor yield.
+ [semaphore isEmpty] whileFalse: [semaphore signal].
+
+ super tearDown.!
Item was changed:
----- Method: MonitorTest>>testCheckOwnerProcess (in category 'tests') -----
testCheckOwnerProcess
self should: [Monitor new checkOwnerProcess]
raise: Error.
self shouldnt: [| m | m := Monitor new. m critical: [m checkOwnerProcess]]
raise: Error.
self should: [| s m |
m := Monitor new.
+ [m critical: [s := #in. semaphore wait]] fork.
- [m critical: [s := #in. Semaphore new wait]] fork.
Processor yield.
self assert: #in equals: s.
m checkOwnerProcess]
raise: Error!
Item was changed:
----- Method: MonitorTest>>testCriticalIfLocked (in category 'tests') -----
testCriticalIfLocked
| m s |
m := Monitor new.
self assert: #unlocked == (m critical: [#unlocked] ifLocked: [#locked]).
+ [m critical: [s := #in. semaphore wait]] fork.
- [m critical: [s := #in. Semaphore new wait]] fork.
Processor yield.
self assert: #in equals: s.
self assert: #locked equals: (m critical: [#unlocked] ifLocked: [#locked])!
More information about the Squeak-dev
mailing list
|