Travis modifications and gcov coverage

August 30, 2013 - 3 minute read -
gcov coverage travis gsoc

Commits:

Travis Build

The TypeError has not been solved. The same code runs fine on my quantal machine as well as VM. I suspect two things that might be causing it:

  • Some package is missing. The package is related to
  • There is some incomplete or difference in the Gio modules of Quantal and Precise( travis servers ) which causes the problem.

C Coverage

C coverage can be done using gcov. gcov helps in collecting coverage information from the programs. For gcov to work the c code should be compiled with the options -fprofile-arcs -ftest-coverage. This will create .gcno file, which contains information to reconstruct the basic block graphs and assign source line numbers to blocks. When the program is run, a separate .gcda file is created for each object file compiled with this option. It contains arc transition counts, value profile counts, and some summary information. The gcov can now be run on the original object files, which uses these .gcno and .gcda files to generate .c.gcov files. The .gcov files contain the ‘:’ separated fields along with program source code. The format is execution_count:line_number:source line text

However, gcov only produces the .gcda files when the process terminates through the exit() defined in the c code. Else, no .gcda file is produced. gst-switch-srv runs more like a infinite process which is mostly ended by Control+A or terminating the process by SIGKILL etc. Currently the gst-switch-srv supports gcov, however it has no support for handling the infinite process part.

A good solution to this problem can be found at https://www.osadl.org/Dumping-gcov-data-at-runtime-simple-ex.online-coverage-analysis.0.html. The __gcov_flush(); method can be used to conditionally provide coverage in between program run. As described in the article, the C code is modified and a signal handler is added. Here they use SIGUSR1. Therefore, whenever SIGUSR1 is caught by the program, it calls back the __gcov_flush(); method, generating .gcda files.

So the necessary files have to be modified with the signal handlers. Also the python-api has to be modified such that it sends a SIGUSR1 signal while ending a gst-switch-srv process.

Comments Section

Feel free to comment on the post but keep it clean and on topic.

blog comments powered by Disqus