[BUG] size StepMessages Heap changed in WorldState>> stopStepping:selector:

Thomas Koenig tomkoenig at mindspring.com
Fri Mar 5 03:52:04 UTC 2004


As mentioned a while ago, I am working on creating SUnit tests for
morphs.  Part of that testing includes creating events under program
control and also includes creating a lot Morphs including a HandMorph
and a PasteUpMorph.

I have found a bug which I do not understand.  It has the following
characteristics: -On seemingly random Test Runner runs, one or more
tests will error out.  (The next couple of runs they run just fine.)
-When I attempt to debug the error in Test Runner by selecting the
error, the debugger won't come up. -So, in order to debug this I put a
self halt in the  [... self errors add: aTestCase....]  block of
TestResult runCase: aTestCase. 
The error in every case appears to be that the size of the Heap of
StepMessages appears to change in the middle of WorldState>>
stopStepping:selector: method.  See below.

Has anyone seen this before?  Is it possible that I'm causing the
problem by creating events and/or hand? Any idea why the errored method
can not be opened out of the Test Runner?

Tom
PS: The following text shows my analysis of one such dump.  Others are
attached and the test code (polygonTest.1.cs.gz)

In this (typical) instance the error happened on:
PolygonMorphTriangleTest>>#testFlipHAroundXRightMostVertex
And was Error: subscript is out of bounds: 15
(the test that errors is arbitrary and the exact error varies but the
bottom line issue is failing an index value well in side of the
collection size.)  I traced this from the bottom of the stack as
follows: (1)a PolygonMorph(2533) >> addMorphFront:  PolygonMorph(2926)
(2)a PolygonMorph(2533) >> privateAddMorph: a PolygonMorph(2926)
atIndex: 1 "adding a new morph"(itsWorld == myWorld) 
    ifFalse: [aMorph intoWorld: a PasteUpMorph(2167) [world]] 
(3) a PolygonMorph(2926) wantsSteps ifTrue:[aWorld startStepping: self =
a PasteUpMorph(2167) 
(4)[world] >> startStepping: a PolygonMorph(2926) at: scheduledTime
selector: #stepAt: arguments: nil stepTime: nil 
(5) worldState >>startStepping: a PolygonMorph(2926) at: 21706129 
selector: #stepAt: arguments: nil stepTime: nil.
"Add the given morph to the step list. Do nothing if it is already being
stepped."
(6) aWorldState >> stopStepping: a PolygonMorph(2926) selector:
#stepAt:. "Remove the given morph from the step list." ... stepList
removeAll: 
  (stepList select:[:stepMsg| stepMsg receiver == a PolygonMorph(2926)
and:[stepMsg selector == #stepAt:]]).
(7) Heap >>select:[] in WorldState>>stopStepping:selector: {[:stepMsg |
stepMsg receiver == aMorph   and: [stepMsg selector == aSelector]]}
1 to: Heap size (which is 27) do: 
		[:15|
		(aBlock value: (aHeap at: 15))
			ifTrue: [a WriteStream #() nextPut: (aHeap at:
15)]].
(8) Heap >>at: 15
"Return the element at the given position within the receiver" (index <
1 or:[index > tally=13]) ifTrue:[^self errorSubscriptBounds: index].
**** This should not be possible ****
(9)Heap >> errorSubscriptBounds: 15
 etc...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: polygonTest.1.cs.gz
Type: application/x-gzip
Size: 8161 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040304/25526b23/polygonTest.1.cs.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HaltInError.ps.gz
Type: application/x-gzip
Size: 10576 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040304/25526b23/HaltInError.ps.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: another.ps.gz
Type: application/x-gzip
Size: 10286 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040304/25526b23/another.ps.bin


More information about the Squeak-dev mailing list