top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Is there a way for gcov to provide coverage analysis of a shared library without executable

+1 vote
1,050 views

Is there a way for gcov to provide coverage analysis of a shared library without building the main() program that uses the shared library?

I have external users of the library that have their own executable programs that use the library and I need to test code coverage with those programs but I do not have access to their source code.

posted Sep 3, 2013 by Ahmed Patel

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Do you mean, you have a .so shared library and you don't have an executable using the same library right? if yes then answer is no. I mean you should have an executable using the library and set of test cases or you need to run the executable to find the coverage.

And i guess the shared library has to be compiled with gcov library support.

answer Sep 10, 2013 by Nagaraja Sadar
Thanks Nagaraja, I got the answer have to have executable for this purpose. Thanks for showing the interest in my problem.
Similar Questions
+2 votes

I need to use gcov to test coverage of a shared library where I have ownership of the source code for the library, but I do not have the source code for the executable test program that uses the library. Is there a way for gcov to provide coverage analysis of a shared library without building the main() program that uses the shared library?

All the examples I have seen show the main() program is built with gcov. I have used gcov to build the .gcno files that correspond to the .so file. I have been able to use gcov to build a test program that I have source code for that uses the shared library and get it to generate execution trace .gcda files for the shared library objects.

However, I have external users of the library that have their own executable programs that use the library and I need to test code coverage with those programs but I do not have access to their source code.

+3 votes

Is there a way to append a list of files as an executable to the file itself such that the file is still executable?

For example let's say I have 2 files file1 and file2. How might I append the the files in a way to the binary. Again this is a simple example, I would like to have a cross Operating System way to extract Unix and Windows functions. Cross operating system way to append zips (or tar.gz) to a file only to extract it later.

The following illustrates how the files might be extracted and or created.

create ./a.exe ./output.exe file1 file2

extract output.exe
...