Skip to content

Commit

Permalink
checkpoint ... new approach to tests in TDStackFrameTests ... nothing…
Browse files Browse the repository at this point in the history
… facy for TDStackFrame ... pretty much honor the fields available from _frameContentsAt: and when you've got an execBlock receiver, use the additional information ...
  • Loading branch information
dalehenrich committed Nov 23, 2016
1 parent 4580665 commit 95ffe29
Show file tree
Hide file tree
Showing 51 changed files with 324 additions and 65 deletions.
Empty file.
@@ -0,0 +1,7 @@
private
findReturnBlockNoSelfFrameFrom: stack
| frames returnBlockNoSelfMethod |
frames := stack frames.
returnBlockNoSelfMethod := self class compiledMethodAt: #'returnBlockNoSelf'.
^ frames first
findFrameSuchThat: [ :frame | frame method == returnBlockNoSelfMethod ]
@@ -0,0 +1,3 @@
private
returnBlockNoSelf
^ [ 1 foo ] value
@@ -1,13 +1,13 @@
private
runTestBlockReturnStack: aBlock
| sem sem2 process exception |
false
true
ifTrue: [ "bring up real debugger on the block"
[ ^ aBlock value ] value ].
sem := TransientSemaphore new.
sem2 := TransientSemaphore new.
process := [ aBlock
on: Halt
on: Halt , Error
do: [ :ex | exception := ex.
sem signal.
sem2 wait ] ] fork.
Expand Down
Expand Up @@ -8,19 +8,15 @@ testNestedNoSelfReferences
noSelfFrame := haltMethodCallFrame next.
baseNodeMap := noSelfFrame baseNodeMap.
argAndTempNames := noSelfFrame argAndTempNames.
self assert: baseNodeMap size == 4.
self assert: baseNodeMap size == 3.
self assert: (baseNodeMap includesKey: '(context)').
self
assert:
(x := noSelfFrame objectFor: '(home)' ifAbsent: [ self assert: false ])
(x := noSelfFrame objectFor: '(homeContext)' ifAbsent: [ self assert: false ])
== (self class compiledMethodAt: #'nestedBlockNoSelf').
self
assert:
(x := noSelfFrame objectFor: '(self)' ifAbsent: [ self assert: false ]) == self.
self
assert:
(x := noSelfFrame objectFor: '(receiver)' ifAbsent: [ self assert: false ])
class == ExecBlock0.
self assert: argAndTempNames size == 4.
self assert: (argAndTempNames at: 1) = 'temp1'.
self assert: (argAndTempNames at: 2) = 'temp1'.
Expand Down
Expand Up @@ -7,12 +7,12 @@ testNestedTempReferences
haltMethodCallFrame := haltMethodFrame next.
baseNodeMap := haltMethodCallFrame baseNodeMap.
argAndTempNames := haltMethodCallFrame argAndTempNames.
self assert: baseNodeMap size == 3.
self assert: baseNodeMap size == 2.
self assert: (baseNodeMap includesKey: '(context)').
self assert: (baseNodeMap includesKey: '(receiver)').
self
assert:
(x := haltMethodCallFrame objectFor: '(home)' ifAbsent: [ self assert: false ])
self assert: (baseNodeMap includesKey: '(homeContext)').
self assert: (x := haltMethodCallFrame
objectFor: '(homeContext)'
ifAbsent: [ self assert: false ])
== (self class compiledMethodAt: #'nestedBlockMethodWithArgs:b:').
self assert: argAndTempNames size == 5.
self assert: (argAndTempNames at: 1) = 'temp3'.
Expand Down
@@ -0,0 +1,23 @@
tests
testReturnBlockNoSelf
| stack block errorMethodFrame errorBlockFrame baseNodeMap argAndTempNames x |
block := [ self returnBlockNoSelf ].
stack := self runTestBlockReturnStack: block.
errorMethodFrame := self findReturnBlockNoSelfFrameFrom: stack value.
errorBlockFrame := errorMethodFrame previous.
baseNodeMap := errorBlockFrame baseNodeMap.
argAndTempNames := errorBlockFrame argAndTempNames.
self assert: baseNodeMap size == 4.
self assert: (baseNodeMap includesKey: '(context)').
self assert: (x := errorBlockFrame
objectFor: '(homeContext)'
ifAbsent: [ self assert: false ])
== (self class compiledMethodAt: #'returnBlockNoSelf').
self
assert:
(x := errorBlockFrame objectFor: '(self)' ifAbsent: [ self assert: false ])
== nil.
self
assert:
(x := errorBlockFrame objectFor: '(receiver)' ifAbsent: [ self assert: false ])
== self
Expand Up @@ -14,15 +14,11 @@ testSimpleTemp
haltBlockFrame := haltMethodFrame next.
baseNodeMap := haltBlockFrame baseNodeMap.
argAndTempNames := haltBlockFrame argAndTempNames.
self assert: baseNodeMap size == 3.
self assert: baseNodeMap size == 2.
self
assert:
(x := haltBlockFrame objectFor: '(home)' ifAbsent: [ self assert: false ])
(x := haltBlockFrame objectFor: '(homeContext)' ifAbsent: [ self assert: false ])
== (self class compiledMethodAt: #'testSimpleTemp').
self
assert:
(x := haltBlockFrame objectFor: '(receiver)' ifAbsent: [ self assert: false ])
== innermostBlock.
self
assert:
(x := haltBlockFrame objectFor: '(context)' ifAbsent: [ self assert: false ])
Expand All @@ -35,16 +31,12 @@ testSimpleTemp
tempFrame := haltBlockFrame next.
baseNodeMap := tempFrame baseNodeMap.
argAndTempNames := tempFrame argAndTempNames.
self assert: baseNodeMap size == 4.
self assert: baseNodeMap size == 3.
self assert: (baseNodeMap includesKey: '(context)').
self
assert:
(x := tempFrame objectFor: '(home)' ifAbsent: [ self assert: false ])
(x := tempFrame objectFor: '(homeContext)' ifAbsent: [ self assert: false ])
== (self class compiledMethodAt: #'testSimpleTemp').
self
assert:
(x := tempFrame objectFor: '(receiver)' ifAbsent: [ self assert: false ])
== outermostBlock.
self
assert:
(x := tempFrame objectFor: '(self)' ifAbsent: [ self assert: false ]) == self.
Expand Down
@@ -0,0 +1,17 @@
{
"class" : {
},
"instance" : {
"findHaltMethodFrameFrom:" : "dkh 11/22/2016 16:52",
"findReturnBlockNoSelfFrameFrom:" : "dkh 11/22/2016 16:52",
"haltMethod" : "dkh 11/22/2016 16:52",
"nestedBlockMethodWithArgs:b:" : "dkh 11/22/2016 16:52",
"nestedBlockNoSelf" : "dkh 11/22/2016 16:52",
"returnBlockNoSelf" : "dkh 11/22/2016 16:52",
"runTestBlockReturnStack:" : "dkh 11/22/2016 16:52",
"testNestedNoSelfReferences" : "dkh 11/22/2016 16:52",
"testNestedTempReferences" : "dkh 11/22/2016 16:52",
"testReturnBlockNoSelf" : "dkh 11/22/2016 16:52",
"testSimpleStack" : "dkh 11/22/2016 16:52",
"testSimpleTemp" : "dkh 11/22/2016 16:52",
"theHaltMethod" : "dkh 11/22/2016 16:52" } }
@@ -0,0 +1,14 @@
{
"category" : "Tode-GemStone-Server3x-Tests",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "dkh 11/22/2016 16:52",
"instvars" : [
],
"name" : "OldTDStackFrameTests",
"pools" : [
],
"super" : "TestCase",
"type" : "normal" }
@@ -0,0 +1,3 @@
block methods
blockComplexSelf
^ self execBlockComplexSelf value
@@ -0,0 +1,3 @@
block methods
blockValue0
^ self execBlock0 value
@@ -0,0 +1,25 @@
private
createFrames
| level framesArr aFrame frames previous stack |
stack := TDStack new
process: GsProcess _current;
yourself.
framesArr := {}.
level := 1.
[ (aFrame := GsProcess _frameContentsAt: level + 1) ~~ nil ]
whileTrue: [ framesArr at: level put: aFrame.
level := level + 1 ].
frames := {}.
previous := nil.
1 to: framesArr size do: [ :index | | frame |
frame := TDStackFrame new
frameIndex: index;
frameContents: (framesArr at: index);
stack: stack;
yourself.
frames add: frame.
previous ifNotNil: [ previous next: frame ].
frame previous: previous.
previous := frame ].
stack frames: frames.
^ frames
@@ -0,0 +1,5 @@
block methods
execBlock0
| block1 |
block1 := [ 1 halt ].
^ block1
@@ -0,0 +1,6 @@
block methods
execBlock1
| block1 |
block1 := [ :arg | ].
block1 value: 1.
^ block1
@@ -0,0 +1,6 @@
block methods
execBlock2
| block1 |
block1 := [ :arg1 :arg2 | ].
block1 value: 1 value: 2.
^ block1
@@ -0,0 +1,6 @@
block methods
execBlock3
| block1 |
block1 := [ :arg1 :arg2 :arg3 | ].
block1 value: 1 value: 2 value: 3.
^ block1
@@ -0,0 +1,10 @@
block methods
execBlock4
| block1 |
block1 := [ :arg1 :arg2 :arg3 :arg4 | ].
block1
value: 1
value: 2
value: 3
value: 4.
^ block1
@@ -0,0 +1,11 @@
block methods
execBlock5
| block1 |
block1 := [ :arg1 :arg2 :arg3 :arg4 :arg5 | ].
block1
value: 1
value: 2
value: 3
value: 4
value: 5.
^ block1
@@ -0,0 +1,11 @@
block methods
execBlock6
| block1 |
block1 := [ :arg1 :arg2 :arg3 :arg4 :arg5 :arg6 | ].
block1 valueWithArguments: {1.
2.
3.
4.
5.
6}.
^ block1
@@ -0,0 +1,3 @@
block methods
execBlockComplexReturn
^ [ ^ self ]
@@ -0,0 +1,3 @@
block methods
execBlockComplexSelf
^ [ self halt ]
@@ -0,0 +1,5 @@
block methods
execBlockComplexTemps
| a |
a := 1.
^ [ a ]
@@ -0,0 +1,3 @@
block methods
execBlockSimple
^ [ 1 ]
@@ -0,0 +1,4 @@
printing
printOn: aStream
testSelector ifNotNil: [ ^ super printOn: aStream ].
aStream nextPutAll: 'a' , self class name
@@ -0,0 +1,31 @@
tests
test
| frames homeMethod execBlock0Frame baseNodeMap argAndTempNames x |
homeMethod := self class compiledMethodAt: #'execBlockComplexSelf'.
[ self blockComplexSelf ]
on: Halt
do: [ :ex | frames := self createFrames ].
execBlock0Frame := frames first
findFrameSuchThat: [ :frame | frame homeMethod == homeMethod ].
baseNodeMap := execBlock0Frame baseNodeMap.
argAndTempNames := execBlock0Frame argAndTempNames.
self assert: argAndTempNames isEmpty.
self assert: baseNodeMap size == 5.
self assert: (baseNodeMap includesKey: '(context)').
self
assert:
(x := execBlock0Frame objectFor: '(homeMethod)' ifAbsent: [ self assert: false ])
== (self class compiledMethodAt: #'execBlock0').
self
assert:
(x := execBlock0Frame objectFor: '(varContext)' ifAbsent: [ self assert: false ])
== nil.
self
assert:
(x := execBlock0Frame objectFor: '(receiver)' ifAbsent: [ self assert: false ])
class == ExecBlock0.
self
assert:
(x := execBlock0Frame objectFor: '(self)' ifAbsent: [ self assert: false ])
== nil.
self halt
@@ -0,0 +1,30 @@
tests
testExecBlock0
| frames homeMethod execBlock0Frame baseNodeMap argAndTempNames x |
homeMethod := self class compiledMethodAt: #'execBlock0'.
[ self blockValue0 ]
on: Halt
do: [ :ex | frames := self createFrames ].
execBlock0Frame := frames first
findFrameSuchThat: [ :frame | frame homeMethod == homeMethod ].
baseNodeMap := execBlock0Frame baseNodeMap.
argAndTempNames := execBlock0Frame argAndTempNames.
self assert: argAndTempNames isEmpty.
self assert: baseNodeMap size == 5.
self assert: (baseNodeMap includesKey: '(context)').
self
assert:
(x := execBlock0Frame objectFor: '(homeMethod)' ifAbsent: [ self assert: false ])
== (self class compiledMethodAt: #'execBlock0').
self
assert:
(x := execBlock0Frame objectFor: '(varContext)' ifAbsent: [ self assert: false ])
== nil.
self
assert:
(x := execBlock0Frame objectFor: '(receiver)' ifAbsent: [ self assert: false ])
class == ExecBlock0.
self
assert:
(x := execBlock0Frame objectFor: '(self)' ifAbsent: [ self assert: false ])
== nil
Expand Up @@ -2,13 +2,20 @@
"class" : {
},
"instance" : {
"findHaltMethodFrameFrom:" : "dkh 11/21/2016 16:16",
"haltMethod" : "dkh 11/21/2016 15:47",
"nestedBlockMethodWithArgs:b:" : "dkh 11/21/2016 17:01",
"nestedBlockNoSelf" : "dkh 11/21/2016 17:26",
"runTestBlockReturnStack:" : "dkh 11/22/2016 11:03",
"testNestedNoSelfReferences" : "dkh 11/22/2016 11:02",
"testNestedTempReferences" : "dkh 11/22/2016 11:02",
"testSimpleStack" : "dkh 11/22/2016 11:02",
"testSimpleTemp" : "dkh 11/22/2016 11:02",
"theHaltMethod" : "dkh 11/21/2016 16:16" } }
"blockComplexSelf" : "dkh 11/22/2016 20:26",
"blockValue0" : "dkh 11/22/2016 18:30",
"createFrames" : "dkh 11/22/2016 19:15",
"execBlock0" : "dkh 11/22/2016 19:54",
"execBlock1" : "dkh 11/22/2016 18:22",
"execBlock2" : "dkh 11/22/2016 18:22",
"execBlock3" : "dkh 11/22/2016 18:22",
"execBlock4" : "dkh 11/22/2016 18:22",
"execBlock5" : "dkh 11/22/2016 18:22",
"execBlock6" : "dkh 11/22/2016 18:24",
"execBlockComplexReturn" : "dkh 11/22/2016 17:26",
"execBlockComplexSelf" : "dkh 11/22/2016 20:26",
"execBlockComplexTemps" : "dkh 11/22/2016 17:50",
"execBlockSimple" : "dkh 11/22/2016 17:22",
"printOn:" : "dkh 11/22/2016 17:12",
"test" : "dkh 11/22/2016 20:25",
"testExecBlock0" : "dkh 11/22/2016 20:24" } }
@@ -1 +1 @@
(name 'Tode-GemStone-Server3x-Tests-dkh.6' message 'isolate the GsProcess instances held onto by stack frames in the stack in a TransientValue, so that Travis can persist the stack workaround for https://github.com/hpi-swa/smalltalkCI/issues/237' id '315dd20d-4194-45c6-a532-e492d7147146' date '11/22/2016' time '11:09:10' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.5' message 'remove a bit of redundancy in TDStackFrame tests ...' id '7fb6e118-9af7-4ca2-84ff-68ff5cd28a5c' date '11/21/2016' time '17:40:57' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.4' message 'one more test to cover case where the block does not reference self directly ... ' id 'f82958e8-6a6f-4646-8d23-d6c1330a0224' date '11/21/2016' time '17:35:49' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.3' message 'add a couple of tests for TDStackFrame args and temp logic ...' id 'd843bf32-2c3c-452e-8497-d04d0d7189f4' date '11/21/2016' time '17:15:16' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.2' message 'move TDProjectEntryOutermostProjectPathTests to Tode-GemStone-Server3x-Tests ... I want 2.4.x variant of tODE to be mostly functional but the [failure of this test for 2.4.x](https://travis-ci.org/dalehenrich/tode/jobs/107915730#L3872) is way to esoteric to spend much time fixing for 2.4.x' id 'aefe7f03-ea52-45a9-a849-5d7af51ed161' date '02/08/2016' time '17:14:53' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.1' message '`gs sslLog` command only applies to gemstone 3.x' id '42d5bfa4-f01d-4bb0-b7f7-79b579ee600c' date '02/08/2016' time '16:50:08' author 'dkh' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
(name 'Tode-GemStone-Server3x-Tests-dkh.7' message 'checkpoint ... new approach to tests in TDStackFrameTests ... nothing facy for TDStackFrame ... pretty much honor the fields available from _frameContentsAt: and when you''ve got an execBlock receiver, use the additional information ... ' id '423e8e41-18ef-4248-a0cf-215cd1ab3f75' date '11/22/2016' time '20:29:17' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.6' message 'isolate the GsProcess instances held onto by stack frames in the stack in a TransientValue, so that Travis can persist the stack workaround for https://github.com/hpi-swa/smalltalkCI/issues/237' id '315dd20d-4194-45c6-a532-e492d7147146' date '11/22/2016' time '11:09:10' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.5' message 'remove a bit of redundancy in TDStackFrame tests ...' id '7fb6e118-9af7-4ca2-84ff-68ff5cd28a5c' date '11/21/2016' time '17:40:57' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.4' message 'one more test to cover case where the block does not reference self directly ... ' id 'f82958e8-6a6f-4646-8d23-d6c1330a0224' date '11/21/2016' time '17:35:49' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.3' message 'add a couple of tests for TDStackFrame args and temp logic ...' id 'd843bf32-2c3c-452e-8497-d04d0d7189f4' date '11/21/2016' time '17:15:16' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.2' message 'move TDProjectEntryOutermostProjectPathTests to Tode-GemStone-Server3x-Tests ... I want 2.4.x variant of tODE to be mostly functional but the [failure of this test for 2.4.x](https://travis-ci.org/dalehenrich/tode/jobs/107915730#L3872) is way to esoteric to spend much time fixing for 2.4.x' id 'aefe7f03-ea52-45a9-a849-5d7af51ed161' date '02/08/2016' time '17:14:53' author 'dkh' ancestors ((name 'Tode-GemStone-Server3x-Tests-dkh.1' message '`gs sslLog` command only applies to gemstone 3.x' id '42d5bfa4-f01d-4bb0-b7f7-79b579ee600c' date '02/08/2016' time '16:50:08' author 'dkh' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())

0 comments on commit 95ffe29

Please sign in to comment.