Test report: show also a bytecode for each method on the stack jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 18 Jan 2016 09:41:22 +0000
branchjv
changeset 2964c26321be573
parent 295 4dd4d4b67e42
child 300 bb05cfcd8427
Test report: show also a bytecode for each method on the stack

...if available. This is a (temporary) measure debug some strange failing
stx:libjava tests where a funny native implementation is called.
reports/Builder__TestReportFormat.st
     1.1 --- a/reports/Builder__TestReportFormat.st	Mon Jan 18 09:39:21 2016 +0000
     1.2 +++ b/reports/Builder__TestReportFormat.st	Mon Jan 18 09:41:22 2016 +0000
     1.3 @@ -97,19 +97,24 @@
     1.4  
     1.5  writeContext: context on: s
     1.6  
     1.7 -    |home mthd src|
     1.8 +    |home mthd src vars args argAndVarNames |
     1.9      [
    1.10      context printOn: s.
    1.11      s cr.
    1.12      s nextPutAll:'receiver: '. context receiver printOn: s. s cr.
    1.13 -    s nextPutAll:'selector: '. context selector printOn: s. s cr.
    1.14 +    s nextPutAll:'selector: '. context selector storeOn: s. s cr.
    1.15 +
    1.16 +    args := context args.
    1.17 +    vars := context vars.
    1.18 +    argAndVarNames := context argAndVarNames.
    1.19      s nextPutAll:'args: '; cr.
    1.20 -    context args keysAndValuesDo:[:idx :eachArg |
    1.21 -        s nextPutAll:'  '. idx printOn: s. s nextPutAll:': '. eachArg printOn: s.s cr.
    1.22 +
    1.23 +    args keysAndValuesDo:[:idx :eachArg |
    1.24 +        s nextPutAll:'  '. idx printOn: s leftPaddedTo:2 . s space. (argAndVarNames at: idx ifAbsent:['']) printOn: s paddedTo:12. s nextPutAll:': '. eachArg printOn: s.s cr.
    1.25      ].
    1.26      s nextPutAll:'vars: '; cr.
    1.27 -    context vars keysAndValuesDo:[:idx :eachVar |
    1.28 -        s nextPutAll:'  '. idx printOn: s. s nextPutAll:': '. 
    1.29 +    vars keysAndValuesDo:[:idx :eachVar |
    1.30 +        s nextPutAll:'  '. idx printOn: s leftPaddedTo:2. s space. (argAndVarNames at: idx + args size ifAbsent:['']) printOn: s paddedTo:12. s nextPutAll:': '. 
    1.31          eachVar isString ifTrue:[
    1.32              eachVar storeOn: s.
    1.33          ] ifFalse:[
    1.34 @@ -117,11 +122,25 @@
    1.35          ].
    1.36          s cr.
    1.37      ].
    1.38 +    home := context methodHome.
    1.39 +    mthd := home method.  
    1.40 +
    1.41 +    s nextPutAll:'bytecode: '; cr.    
    1.42 +    mthd notNil ifTrue:[ 
    1.43 +        (mthd isJavaMethod and:[mthd class ~~ JavaNativeMethod]) ifFalse:[ 
    1.44 +            Decompiler decompile: mthd to: s.
    1.45 +        ] ifTrue:[ 
    1.46 +            (Smalltalk at: #JavaByteCodeDisassembler) notNil ifTrue:[ 
    1.47 +                (Smalltalk at: #JavaByteCodeDisassembler) diassemble: mthd to: s.
    1.48 +            ] ifFalse:[ 
    1.49 +                s nextPutAll: ' ** no JavaByteCodeDisassembler **'  
    1.50 +            ].
    1.51 +        ].
    1.52 +    ].
    1.53 +
    1.54 +    s cr.
    1.55      s nextPutAll:'source: '; cr.    
    1.56 -
    1.57      [
    1.58 -    home := context methodHome.
    1.59 -    mthd := home method.
    1.60      mthd isNil ifTrue:[
    1.61           s nextPutAll: '** no source **'. s cr. s cr.
    1.62          ^ self.
    1.63 @@ -153,9 +172,14 @@
    1.64          s   cr;
    1.65              nextPutAll:'!!!!!!ERROR WHEN GETTING STACK TRACE!!!!!!'; cr;
    1.66              nextPutAll: ex description; cr
    1.67 -    ]
    1.68 +    ]. 
    1.69 +
    1.70 +    "
    1.71 +    String streamContents:[ :s | Builder::TestReportFormat basicNew writeContext: thisContext on: s ]
    1.72 +    "
    1.73  
    1.74      "Created: / 03-08-2011 / 14:53:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    1.75 +    "Modified: / 18-01-2016 / 08:12:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    1.76  !
    1.77  
    1.78  writeStackTrace:err of:aTestCase on: str
    1.79 @@ -701,6 +725,11 @@
    1.80      ^ '$Header$'
    1.81  !
    1.82  
    1.83 +version_HG
    1.84 +
    1.85 +    ^ '$Changeset: <not expanded> $'
    1.86 +!
    1.87 +
    1.88  version_SVN
    1.89      ^ '$Id$'
    1.90  ! !