Wednesday, December 28, 2011

Using ICOV as Code coverage tool (Simple steps)

I was searching for some free code coverage tool which is simple for first setup and quick enough to show me the results without doing much. I found ICOV very quick and useful for this.
Here are the steps if you want to set it up or want to give it a try :)

I was using Ubuntu 10.10 (32bit version) and installed ICOV using command
sudo apt-get install icov

once done, i moved in temp work directory where my 'C' file was there : test.c
i compiled it using

 gcc -g -fprofile-arcs  -ftest-coverage test.c

and then run the executable.
./a.out

then i use this command to generate code coverage information...

lcov --directory . --capture --output-file app.info

as i need this information in nice HTML output, i use this command

genhtml --output-directory ./output app.info


it creates a OUTPUT folder which contains 'index.html' which have detailed information of code coverage (for the instance you run few step before, below is the sample output).



Happy  Code Coverage