code coverage

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

code coverage

Eliot Miranda-2
Hi All,

     anyone have any bytecode-to-bytecode transformation tools for
doing basic-block resolution coverage?
--
best,
Eliot

Reply | Threaded
Open this post in threaded view
|

Re: code coverage

Frank Shearar-3
On 21 February 2013 19:52, Eliot Miranda <[hidden email]> wrote:
> Hi All,
>
>      anyone have any bytecode-to-bytecode transformation tools for
> doing basic-block resolution coverage?

Is it possible that Jejak [1] might vaguely fit this bill? It's a
tracing tool, but maybe one could hack something on the side to turn
it into a coverage tool?

Certainly I've wanted a fine resolution (branch/block level) coverage
tool for a long time.

frank

[1] http://lists.gforge.inria.fr/pipermail/pharo-project/2012-July/067679.html

Reply | Threaded
Open this post in threaded view
|

Re: code coverage

Bob Arning-2
In reply to this post by Eliot Miranda-2
In a much older Squeak, I just stepped though code like the debugger and recorded every PC that was executed. I could then pretty-print every method and color the parts executed or not differently. Was rather slow and did have trouble trying to step through primitives, but could yield nice results. The guts of it was this:

tallyCoverageInner: aBlock

    | tick str list smallSteps bigSteps incr prevContext |

    SequentialEventManager classNow: 0.
    smallSteps _ bigSteps _ 0.
    incr _ 200000.
    tick _ Time millisecondClockValue.
    byteCodeTallies _ IdentityDictionary new: 10000.
    prevContext _ nil.
    thisContext sender
        runSimulated: aBlock
        contextAtEachStep: [ :current |
            smallSteps _ smallSteps + 1.
            smallSteps >= incr ifTrue: [
                smallSteps _ 0.
                bigSteps _ bigSteps + 1.
                str _ (Time millisecondClockValue - tick / 1000) rounded asString,' ',
                    (bigSteps * incr) asStringWithCommas,' .. ',byteCodeTallies size asString,'    ',
                    (SequentialEventManager classNow ifNil: [0]) ddhhmm,'  ',
                    (self who: current method) asString,'    '.

                Summary add: str.
                str displayAt: 0@0.
            ].
            prevContext == current ifFalse: [
                prevContext _ current.
                list _ byteCodeTallies
                    at: current method
                    ifAbsentPut: [ByteArray new: current method endPC + 1].
            ].
            list at: current pc + 1 put: 1.
            "bigSteps > 3 ifTrue: [^byteCodeTallies]."
        ].
    ^byteCodeTallies

On 2/21/13 2:52 PM, Eliot Miranda wrote:
Hi All,

     anyone have any bytecode-to-bytecode transformation tools for
doing basic-block resolution coverage?



Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] [squeak-dev] code coverage

Marcus Denker-4
In reply to this post by Frank Shearar-3

On Feb 21, 2013, at 9:52 PM, Frank Shearar <[hidden email]> wrote:

> On 21 February 2013 19:52, Eliot Miranda <[hidden email]> wrote:
>> Hi All,
>>
>>     anyone have any bytecode-to-bytecode transformation tools for
>> doing basic-block resolution coverage?
>
> Is it possible that Jejak [1] might vaguely fit this bill? It's a
> tracing tool, but maybe one could hack something on the side to turn
> it into a coverage tool?
>
> Certainly I've wanted a fine resolution (branch/block level) coverage
> tool for a long time.
>

In Pharo 3.0 we will add Opal to the release (with the old Compiler to be an
unload able package, to be killed as the first action in 4.0)

This will allow *a lot* of very very interesting things to be done.

Imagine this combined with
        -> a Parser that can parse code with syntax errors (in Pharo 2.0)
        -> a new ClassBuilder
        -> The first class Slots replacing instance variables (see the OOPLSA Paper)
        -> the new Debugger Model and UI
        -> the new text model

It (slowly) start to get interesting!  :-)

        Marcus


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-project] code coverage

Marcus Denker-4
In reply to this post by Eliot Miranda-2

On Feb 21, 2013, at 8:52 PM, Eliot Miranda <[hidden email]> wrote:

> Hi All,
>
>     anyone have any bytecode-to-bytecode transformation tools for
> doing basic-block resolution coverage?
>

Opal can represent the byte code in a control flow graph.

This was used for ByteSurgeon, we should revisit that as soon as
the Compiler is in the image.

Of course for basic blocks, one need to take care about where
to add at the start of the block. Lots byte codes (creating tempVectors,
pushing the nil for the temps…) that have no semantic meaning in
Smalltalk.

In the long term I would like to get rid of byte code as a visible
artefact for reflection, though. It's just too low level.

Especially the current byte code set is very low level. You can not
even tell if a temp is a real temp without resorting to the full compiler
chain. (Which shows that it is an execution level artefact, not a reflective
one).

I think moving the reflective model to something closer to the language
is the way to go in the long term.

        Marcus