Code Coverage: Difference between revisions

From coreboot
Jump to navigation Jump to search
(Created page with "= Prerequisites = You need * The code coverage patch for coreboot: http://review.coreboot.org/#/c/2052/ * The latest version of lcov: http://ltp.cvs.sourceforge.net/viewvc/lt...")
 
No edit summary
 
Line 35: Line 35:


http://www.coreboot.org/~stepan/coreboot-coverage/
http://www.coreboot.org/~stepan/coreboot-coverage/
= See Also =
* http://ltp.sourceforge.net/coverage/lcov.php
* http://gcc.gnu.org/onlinedocs/gcc/Gcov.html

Latest revision as of 01:14, 9 January 2013

Prerequisites

You need

Getting started

  • Install lcov. You will need to patch geninfo to make it work with the coreboot toolchain:
--- bin/geninfo	2012-11-13 01:58:53.000000000 -0800
+++ bin/geninfo	2013-01-08 16:44:48.041362229 -0800
@@ -1871,7 +1871,7 @@
 	close(GCOV_PIPE);
 
 	$result = 0;
-	if ($version_string =~ /(\d+)\.(\d+)(\.(\d+))?/)
+	if ($version_string =~ /(\d+)\.(\d+)(\.(\d+))$/)
 	{
 		if (defined($4))
 		{

Getting code coverage information

  • Compile coreboot with CONFIG_COVERAGE enabled
  • Flash and run coreboot on the target system
  • Run cbmem on the target system to extract coverage data (see coreboot/util/cbmem/)
$ sudo ./cbmem -CV
  • Transfer the files back to your host system
  • Run lcov and genhtml on the host system
$ lcov --capture --directory $( pwd ) --output-file coreboot.info --gcov-tool i386-elf-gcov
$ genhtml coreboot.info --output-directory coreboot-coverage
  • Find your html files visualizing code coverage in coreboot-coverage

Demo

http://www.coreboot.org/~stepan/coreboot-coverage/

See Also