Code coverage for "C"

Darrell darrell at dorb.com
Sat Feb 26 18:58:44 EST 2000


I need a code coverage tool for "C" with some strange requirements.All the
code is in a case tool and must be parsed out of a twisted text file. Not to
mention that it will run deeply embedded with some kind of network as the
only feedback path.

The approach I've taken is to insert some code into the control structures.
    if(x)
    {
        coverage(1);
        ++x;
    }

The problem comes when you have code like:
    if(x)
        ++x;
    else
        if(y)
            --x;

Before "coverage" can be inserted braces must be added.

As always I'm prepared to be told that this is child's play if I had only
used XYZ.

I used a variation of John Aycock's scanner to build a list of events. Then
passed the events though state machines that drop in the braces as needed.

Can anyone share code or ideas on how I should have done it ?
Should have asked this before I wrote it !

Thanks
--Darrell








More information about the Python-list mailing list