[squeak-dev] The Trunk: KernelTests-ul.332.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Feb 5 19:48:06 UTC 2018


Levente Uzonyi uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ul.332.mcz

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

Name: KernelTests-ul.332
Author: ul
Time: 5 February 2018, 8:42:17.266896 pm
UUID: 93605545-3a6c-4059-9763-f8d733f1c218
Ancestors: KernelTests-tonyg.331

- added a test for object pinning
- use the #excessSignals accessor in SemaphoreTest

=============== Diff against KernelTests-tonyg.331 ===============

Item was added:
+ ----- Method: ObjectTest>>testPinning (in category 'tests') -----
+ testPinning
+ 	"Test pinning state changes for two objects. Iterate over all possible state transitions."
+ 
+ 	| objects |
+ 	objects := { Object new. Object new }.
+ 	#((false false) (false true) (true false) (true true))
+ 		combinations: 2
+ 		atATimeDo: [ :transition |
+ 			 | fromState toState |
+ 			fromState := transition first.
+ 			toState := transition second.
+ 			fromState with: objects do: [ :pinned :object |
+ 				pinned 
+ 					ifTrue: [ object pin ]
+ 					ifFalse: [ object unpin ].
+ 				self assert: pinned equals: object isPinned ].
+ 			objects withIndexDo: [ :object :index |
+ 				| from to |
+ 				from := fromState at: index.
+ 				to := toState at: index.
+ 				self assert: from equals: (to
+ 					ifTrue: [ object pin ]
+ 					ifFalse: [ object unpin ]).
+ 				self assert: to equals: object isPinned ] ]!

Item was changed:
  ----- Method: SemaphoreTest>>testSemaAfterCriticalWait (in category 'testing') -----
  testSemaAfterCriticalWait	"self run: #testSemaAfterCriticalWait"
  	"This tests whether a semaphore that has just left the wait in Semaphore>>critical:
  	leaves it with signaling the associated semaphore."
  	| s p |
  	s := Semaphore new.
  	p := [s critical:[]] forkAt: Processor activePriority-1.
  	"wait until p entered the critical section"
  	[p suspendingList == s] whileFalse:[(Delay forMilliseconds: 10) wait].
  	"Now that p entered it, signal the semaphore. p now 'owns' the semaphore
  	but since we are running at higher priority than p it will not get to do
  	anything."
  	s signal.
  	p terminate.
+ 	self assert: 1 equals: s excessSignals!
- 	self assert: ((s instVarNamed: #excessSignals) = 1)!

Item was changed:
  ----- Method: SemaphoreTest>>testSemaInCriticalWait (in category 'testing') -----
  testSemaInCriticalWait	"self run: #testSemaInCriticalWait"
  	"This tests whether a semaphore that has entered the wait in Semaphore>>critical:
  	leaves it without signaling the associated semaphore."
  	| s p |
  	s := Semaphore new.
  	p := [s critical:[]] fork.
  	Processor yield.
  	self assert:(p suspendingList == s).
  	p terminate.
+ 	self assert: 0 equals: s excessSignals!
- 	self assert:((s instVarNamed: #excessSignals) = 0)!



More information about the Squeak-dev mailing list