I'm trying to use some test scenarios from Linux test Project and get the Kernel source code coverage.
I'm using GCOV/LCOV to do so.
here are the things I have so far:
GCOV-based kernel profiling
CONFIG_GCOV_KERNEL=y
CONFIG_GCOV_PROFILE_ALL=y
On Linux kernel version: 2.6.32.60+drm33.26
Things that I should have but I don't
Now what I want is to run the test scenarios and with LCOV get which portion of Linux Kernel Code has been used so far. but when I call LCOV -c this is what I get even though all the build flags are ok.
Loading required gcov kernel module.
lcov: ERROR: cannot load required gcov kernel module!
There is a kernel patch for < 2.6.30 and afterwards it is built in.
gcov is a test coverage program. Use it in concert with GCC to analyze your programs to help create more efficient, faster running code and to discover untested parts of your program. You can use gcov as a profiling tool to help discover where your optimization efforts will best affect your code.
gcov produces files called mangledname. gcov in the current directory. These contain the coverage information of the source file they correspond to. One . gcov file is produced for each source (or header) file containing code, which was compiled to produce the data files.
LCOV is a graphical front-end for GCC's coverage testing tool gcov. It collects gcov data for multiple source files and creates HTML pages containing the source code annotated with coverage information. It also adds overview pages for easy navigation within the file structure.
please read this document
http://www.mjmwired.net/kernel/Documentation/gcov.txt
Here is answer to your questions:
There is no proc fs for kernel coverage. After booting from the new kenrel, you had to mount the debug-fs via command: "mount -t debugfs none /sys/kernel/debug" and read coverage log of kernel from this file
Kernel coverage can not be built as module. As you see, the CONFIG option is 'Y', not 'M'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With