Code coverage

Code coverage

Post by christian liesc » Sun, 26 Aug 2001 00:05:51



hi all,

I'm wondering if there is a tool for linux to do code coverage? means
list all code in a programm which is not hit by tests.

Thanks a lot in advance
best regards
Christian

 
 
 

Code coverage

Post by Lars Luthma » Sun, 26 Aug 2001 00:45:00



> hi all,

> I'm wondering if there is a tool for linux to do code coverage? means
> list all code in a programm which is not hit by tests.

I'm not sure, but I think that gprof does something like that. It's a part
of the GNU binutils package (at least it's in the binutils RPM in Mandrake
8.0).

--ll

 
 
 

Code coverage

Post by Paul Kimot » Sun, 26 Aug 2001 02:26:34



> I'm wondering if there is a tool for linux to do code coverage? means
> list all code in a programm which is not hit by tests.

gcov, which is documented in the gcc info pages.

--
Paul Kimoto
This message was originally posted on Usenet in plain text.  Any images,
hyperlinks, or the like shown here have been added without my consent,
and may be a violation of international copyright law.

 
 
 

Code coverage

Post by Bruce Stephen » Sun, 26 Aug 2001 05:34:58



> I'm wondering if there is a tool for linux to do code coverage? means
> list all code in a programm which is not hit by tests.

gcc can do this, together with gcov.

However, it (and gprof and friends) appear to fail entirely with
shared libraries, which I find very annoying.

Anyone know why I shouldn't be able to build a set of shared libraries
and an executable using those with the appropriate flags, and then use
gprof (or gcov) and get useful information about what happened in the
shared libraries?

 
 
 

Code coverage

Post by Marc Britte » Sun, 26 Aug 2001 02:56:06


because the shared libs(and the source files that make it) have to be
compile w/ the -pg flag


> Anyone know why I shouldn't be able to build a set of shared libraries
> and an executable using those with the appropriate flags, and then use
> gprof (or gcov) and get useful information about what happened in the
> shared libraries?

--
2 dots does not a net make
 
 
 

Code coverage

Post by Ken Whale » Sun, 26 Aug 2001 09:57:50


No, it's because glibc just doesn't support it.   Whether or not
the libraries are also compiled -pg is moot.  The reason
is that the statistics gathering code in glibc will not record any
sample who's program counter value does not fall within the text section
of the main program.  Fixing this would require changes to glibc to
accomodate multiple, non-contiguous, dynamic sampling regions,
and to the dynamic loader so that when a new library is loaded, glibc's
monitor functions are made aware of the new range of possible PC values
so that buckets could be created for them.

Or use something like oprofile:
http://oprofile.sourceforge.net/

which doesn't even require that you compile your programs in a special
way in order to get simple PC-sample-based profiling.

Ken


> because the shared libs(and the source files that make it) have to be
> compile w/ the -pg flag


> > Anyone know why I shouldn't be able to build a set of shared libraries
> > and an executable using those with the appropriate flags, and then use
> > gprof (or gcov) and get useful information about what happened in the
> > shared libraries?

> --
> 2 dots does not a net make

 
 
 

Code coverage

Post by christian liesc » Tue, 28 Aug 2001 16:08:15


Thanks a lot for all answers! I'll try that gcov/gprof stuff right now
:-)

best regards
Christian

 
 
 

1. Code coverage for .ksh scripts

Are there any _instrumentation_ tools or unit test tools that enable
"code coverage" testing to be performed and testing analysis/results to
be saved on shell scripts (ksh)?

Thanx

Joe

Sent via Deja.com http://www.deja.com/
Before you buy.

2. X as a memory-hog

3. code coverage tool

4. Linux hangs when playing .mp2 files with maplay

5. Code coverage tools for FreeBSD?

6. cd rom recognition

7. kernel code coverage tool ( GCOV )

8. alter filenames

9. Fw: kernel code coverage tool

10. Code coverage and memory allocation tools

11. Source code coverage tools

12. kernel code coverage tool

13. Q: Code coverage/error detection/performance analysis tools