The Inbox: KernelTests-jar.397.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: KernelTests-jar.397.mcz

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

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

Name: KernelTests-jar.397
Author: jar
Time: 12 April 2021, 9:43:54.742464 am
UUID: 6cf87c25-8484-a144-aa35-761de4aa60c1
Ancestors: KernelTests-codefrau.395

Clean up: release all processes still waiting at the semaphore or in the active priority queue.

ProcessTest>>#testProcessStateTests doesn't terminate processes it opened.

=============== Diff against KernelTests-codefrau.395 ===============

Item was changed:
  ----- Method: ProcessTest>>testProcessStateTests (in category 'tests') -----
  testProcessStateTests
  | semaphore |
  self assert: Processor activeProcess isActiveProcess.
  self deny: Processor activeProcess isBlocked.
  self assert: Processor activeProcess isRunnable.
  self deny: Processor activeProcess isSuspended.
  self deny: Processor activeProcess isTerminated.
 
  semaphore := Semaphore new.
 
  "These processes are runnable but haven't got to the wait yet because the active process is running."
  self deny: ([semaphore wait] forkAt: Processor activePriority) isActiveProcess.
  self deny: ([semaphore wait] forkAt: Processor activePriority) isBlocked.
  self assert: ([semaphore wait] forkAt: Processor activePriority) isRunnable.
  self deny: ([semaphore wait] forkAt: Processor activePriority) isSuspended.
  self deny: ([semaphore wait] forkAt: Processor activePriority) isTerminated.
  self deny: ([semaphore wait] forkAt: Processor activePriority) suspendingList == semaphore.
 
+ "These processes do get to run because, being higher priority they preempt the active process until they wait on the semaphore."
- "These processes do get to run because, being higher priority they preempt the active process until yhey wait on the semaphore."
  self deny: ([semaphore wait] forkAt: Processor activePriority + 1) isActiveProcess.
  self assert: ([semaphore wait] forkAt: Processor activePriority + 1) isBlocked.
  self deny: ([semaphore wait] forkAt: Processor activePriority + 1) isRunnable.
  self deny: ([semaphore wait] forkAt: Processor activePriority + 1) isSuspended.
  self deny: ([semaphore wait] forkAt: Processor activePriority + 1) isTerminated.
  self assert: ([semaphore wait] forkAt: Processor activePriority + 1) suspendingList == semaphore.
 
  "These processes should be suspended, not terminated."
  self deny: ([Processor activeProcess suspend] forkAt: Processor activePriority + 1) isActiveProcess.
  self deny: ([Processor activeProcess suspend] forkAt: Processor activePriority + 1) isBlocked.
  self deny: ([Processor activeProcess suspend] forkAt: Processor activePriority + 1) isRunnable.
  self assert: ([Processor activeProcess suspend] forkAt: Processor activePriority + 1) isSuspended.
  self deny: ([Processor activeProcess suspend] forkAt: Processor activePriority + 1) isTerminated.
  self assert: ([Processor activeProcess suspend] forkAt: Processor activePriority + 1) suspendingList isNil.
 
  "These processes should be terminated, not suspended."
  self deny: ([Processor activeProcess terminate] forkAt: Processor activePriority + 1) isActiveProcess.
  self deny: ([Processor activeProcess terminate] forkAt: Processor activePriority + 1) isBlocked.
  self deny: ([Processor activeProcess terminate] forkAt: Processor activePriority + 1) isRunnable.
  self deny: ([Processor activeProcess terminate] forkAt: Processor activePriority + 1) isSuspended.
  self assert: ([Processor activeProcess terminate] forkAt: Processor activePriority + 1) isTerminated.
  self assert: ([Processor activeProcess terminate] forkAt: Processor activePriority + 1) suspendingList isNil.
 
  "These processes should be suspended."
  self deny: (([semaphore wait] forkAt: Processor activePriority) suspend; yourself) isActiveProcess.
  self deny: (([semaphore wait] forkAt: Processor activePriority) suspend; yourself) isBlocked.
  self deny: (([semaphore wait] forkAt: Processor activePriority) suspend; yourself) isRunnable.
  self assert: (([semaphore wait] forkAt: Processor activePriority) suspend; yourself) isSuspended.
  self deny: (([semaphore wait] forkAt: Processor activePriority) suspend; yourself) isTerminated.
 
  "These processes should be terminated."
  self deny: ([semaphore wait] forkAt: Processor activePriority) terminate isActiveProcess.
  self deny: ([semaphore wait] forkAt: Processor activePriority) terminate isBlocked.
  self deny: ([semaphore wait] forkAt: Processor activePriority) terminate isRunnable.
  self deny: ([semaphore wait] forkAt: Processor activePriority) terminate isSuspended.
+ self assert: ([semaphore wait] forkAt: Processor activePriority) terminate isTerminated.
+
+ "Clean up: release all processes still waiting at the semaphore or in the active priority queue."
+ Processor yield.
+ [semaphore isEmpty] whileFalse: [semaphore signal]
+ !
- self assert: ([semaphore wait] forkAt: Processor activePriority) terminate isTerminated!