Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

code coverage in C [closed]

I'm looking to have code coverage in C. I cannot rely on tools like gcov as I am working on different platforms/compilers.

Basically I am looking for a strategy to incorporate code coverage into my(own implementation) unit-test framework.

like image 749
FL4SOF Avatar asked Jul 10 '26 18:07

FL4SOF


1 Answers

Do you have so many platform-specific code that you want to measure the unit test coverage on every platform ? I mean that unless you have a lot of platform-specific code, your unit testing coverage should be similar on all your targets so you might not need to measure it on each and every target you have. It could be interesting to move your platform-specific code to platform-specific modules so that the coverage level of the common code is not lowered by the specific code.

Are you looking at branch coverage or function coverage ? If the latter you can just use gcc to instrument your code so that each function outputs its name or its address to a file and write a script to aggregate the results from all the platforms.

Sorry for answering with questions only ... HTH

like image 180
philant Avatar answered Jul 13 '26 22:07

philant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!