Skip to content

Commit 04f16d4

Browse files
committed
better stable tests
1 parent 12830cf commit 04f16d4

3 files changed

Lines changed: 16 additions & 9 deletions

File tree

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
helpers
22
waitForkedProcesses
33

4-
[CurrentExecutionEnvironment value forkedProcesses
5-
allSatisfy: [ :each | each isTerminated ]] whileFalse: [
6-
Processor yield ]
4+
[forkedProcesses allSatisfy: [ :each | each isTerminated ]]
5+
whileFalse: [ Processor yield ]
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
tests
22
testAcquireLockWhenItsAlreadyBusy
33

4-
| lastLockAcquired |
4+
| lastLockAcquired syncSemaphore lockSemaphore |
55
lastLockAcquired := false.
6-
self fork: [ lock acquire. 10 seconds wait. ].
6+
syncSemaphore := Semaphore new.
7+
lockSemaphore := Semaphore new.
8+
self fork: [ lock acquire. syncSemaphore signal. lockSemaphore wait. ].
9+
syncSemaphore wait.
710
self fork: [ lock acquire. lastLockAcquired := true ].
8-
10 milliSeconds wait.
11+
self passForkedProcesses.
12+
lockSemaphore signal.
913

1014
self deny: lastLockAcquired
1115

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
tests
22
testReleasingLock
33

4-
| lastExecuted |
4+
| lastExecuted syncSemaphore lockSemaphore |
55
lastExecuted := false.
6-
self fork: [ lock acquire. 10 seconds wait].
6+
syncSemaphore := Semaphore new.
7+
lockSemaphore := Semaphore new.
8+
9+
self fork: [ lock acquire. syncSemaphore signal. lockSemaphore wait].
710
self fork: [ lock acquire. lastExecuted := true].
8-
10 milliSeconds wait.
11+
syncSemaphore wait.
12+
self passForkedProcesses.
913
lock release.
1014
self waitLastProcessFinished.
1115
self assert: lastExecuted

0 commit comments

Comments
 (0)