Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run gcov tool on folder

Tags:

gcov

I run gcov tool on some .c files using gcc -fprofile-arcs -ftest-coverage [filenames]. command
But its is very tedious job of supplying file names to this command.
Instead I need help in which I can run gcov tool on a folder which contains all source files.
Is this possible? Please help me out with a solution.

Thanks in advance.

like image 551
Coding Master Avatar asked Dec 06 '12 07:12

Coding Master


1 Answers

I ran into the same problem, my project contains ~3000 files. Write a shell script to grab all .c .gcno and .gcda files to a common folder using find exec, then run gcov using the same command. sample:

LOCATION=your_gcov_folder_name
find -name '*.c' -exec cp -t $LOCATION {} +
find -name '*.gcno' -exec cp -t $LOCATION {} +
find -name '*.gcda' -exec cp -t $LOCATION {} +
cd $LOCATION
find -name '*.c' -exec gcov -bf {} \;

run it on your code folder which contains your project.

like image 69
Venkat Avatar answered Sep 24 '22 14:09

Venkat