Nicolas Cellier uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-nice.398.mcz ==================== Summary ==================== Name: KernelTests-nice.398 Author: nice Time: 12 April 2021, 10:18:38.252683 pm UUID: ac7054ff-ef3d-4941-b690-66706b8a028c Ancestors: KernelTests-eem.396, KernelTests-ct.377, KernelTests-jar.397, KernelTests-jar.395 A merge commit: KernelTests-eem.396: Rename MethodContextTest to ContextTest KernelTests-ct.377: Tests #readFrom: and #readCarefullyFrom: on Object. KernelTests-jar.397: Clean up: release all processes still waiting at the semaphore or in the active priority queue. ProcessTest>>#testProcessStateTests doesn't terminate processes it opened. KernelTests-jar.395: Tests unwinding of nested ensure =============== Diff against KernelTests-eem.396 =============== Item was added: + ----- Method: ObjectTest>>testReadCarefullyFrom (in category 'tests') ----- + testReadCarefullyFrom + + self should: [Object readCarefullyFrom: nil] raise: Error. + self should: [Object readCarefullyFrom: Object new] raise: Error. + self assert: [(Object readCarefullyFrom: 'Object new') isKindOf: Object]. + self + should: [self + should: [Object newSubclass readCarefullyFrom: 'self assert: Object isNil'] + raise: AssertionFailure. "environment must be installed"] + raise: Error. "because we return nil" + self should: [(UndefinedObject readCarefullyFrom: 'Object new')] raise: Error. + self should: [Object readCarefullyFrom: 'Object new:'] raise: Error.! Item was added: + ----- Method: ObjectTest>>testReadFrom (in category 'tests') ----- + testReadFrom + + self should: [Object readFrom: nil] raise: Error. + self should: [Object readFrom: Object new] raise: Error. + self assert: [(Object readFrom: 'Object new') isKindOf: Object]. + self + should: [self + should: [Object newSubclass readFrom: 'self assert: Object isNil'] + raise: AssertionFailure. "environment must be installed"] + raise: Error. "because we return nil" + self should: [(UndefinedObject readFrom: 'Object new')] raise: Error. + self should: [Object readFrom: 'Object new:'] raise: SyntaxErrorNotification.! Item was added: + ----- Method: ProcessTest>>testNestedUnwind (in category 'tests') ----- + testNestedUnwind + "Test all nested unwind blocks are correctly unwound; all unwind blocks halfway through their execution should be completed or at least attempted to complete, not only the innermost one" + + | p x1 x2 x3 | + x1 := x2 := x3 := false. + p := + [ + [ + [ ] ensure: [ "halfway through completion when suspended" + [ ] ensure: [ "halfway through completion when suspended" + Processor activeProcess suspend. + x1 := true]. + x2 := true] + ] ensure: [ "not started yet when suspended" + x3 := true] + ] fork. + Processor yield. + p terminate. + + self assert: x1 & x2 & x3! 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! |
Free forum by Nabble | Edit this page |