0

I'm doing unit testing for device drivers for that i need to use gcov and lcov tools to generate reports.I compiled my code in native machine and the .gcno files are generated perfectly.Then i executed my output file in a arm based board and the gcda files also generated correctly.Then i have taken those files to my native and i generated .gcov files.

But when i use lcov to that files it is showing errors like "negative length in /usr/src/geninfo line no 2414".

1.So,For this what i need to do.?. 2.And one more question is I'm using "arm-none-gnueabi-" toolchain(2011.03) for this it has gcov seperately but lcov is not present in the executables.Is it possible to use lcov.?.If yes how to use.?..Thanks in advance.

  • No..I'm new 2 this.But why are you asking these kind of question. – P.Ravi chandran Nov 30 '14 at 06:15
  • Sorry, you question seemed very similar to one asked a few days ago (which seems to be a duplicate). Look at the last question in [arm+gcov]; Use the `lcov` option **--gcov-tool**; can it really be that hard to find? You know you need the cross compiler; so you know it is best to use the cross-gcov? – artless noise Nov 30 '14 at 22:17
  • Thank you artless noise..:-)..But can you elabarate that one as an answer.Thanks for your time. – P.Ravi chandran Dec 01 '14 at 05:02

1 Answers1

1

Once you are able to generate the .gcda & .gcno files correctly, you need lcov tool to capture the code coverage. Here you should cross compile your lcov tool and add it into the file system.

I am working on similar kind of task, where i am trying to capture the coverage for ARMv7 based system. I have used yocto for the build framework. In yocto, meta-oe layer provides the support of the lcov. you can add it into the conf/local.conf file by adding following line into the configuration file.

CORE_IMAGE_EXTRA_INSTALL += "lcov"

after following all steps of your build, you will have the lcov tool on to the target board in /bin directory. Refer the lcov man page

You can use below command to generate the coverage files.

lcov --capture --directory <path-to-your-generated-files-dir> --gcov-tool /usr/bin/arm-linux-gnueabi-gcov --output-file <file_name>

Above command will generate a file, if your target board does not have enough capability then you can copy the generated file into your build system.

At the build system, you can execute below command to generate the HTML output with the exact coverage details,

genhtml <path_to_generated_file> --output-directory <out_dir>

Refer below links for more details about the GCOV & LCOV integration. 1. How to use GCOV & LCOV

  1. GCOV in linux kernel
Parthiv Shah
  • 350
  • 3
  • 17