views:

350

answers:

2

Hello C people.

I'm looking for a static analysis tool with the maturity of splint that also produces test coverage analysis of the code. For instance, all non-static functions in libfoo.c should be present in libfoo.h, by that token all functions in libfoo.h should have unit tests.

Of course, such behavior would need some kind of granular control, but this would be defined in some kind of start up configuration file for the static analysis tool.

I'm working on a project that is moving very quickly, all kinds of stuff is being added daily, I'm hoping to find some static analysis tool that helps ensure unit test coverage remains adequate. Its a large, geographically distributed team which means stuff gets committed 24/7, I need nightly builds to be smarter.

I don't need it to be super smart, I just need it to break the build if something isn't being tested, unless its explicitly taken out of scope.

CCAN is working on something similar, however its going to be months before anything substantial is written. I also need something mature.

Thanks in advance for links to any gems.

+4  A: 

The GCC documentation points the reader to gcov for code coverage analysis. This 2005 Dr. Dobbs article on Defensive programming includes a discussion of using gcov.

bignose
Thanks for the Defensive programming link.
Liran Orevi
gcov is good, I was hoping for something built into a de-linter (not so much a profile). All I really need it to do is the coverage analysis, not based on how many times something is actually entered, but simply used.
Tim Post
A: 

You may be interested in checking out: What is the best command-line tool to clean up code? I don't know if it will help, but there are many great suggestions on there.

Anthony Cuozzo
I'm really happy with splint, what I'm hoping for is something just like it, which also provides test coverage analysis. I just need to know (nightly) if functions that really should be tested aren't being tested.
Tim Post