Code Coverage

From coreboot
Revision as of 00:52, 9 January 2013 by Stepan (talk | contribs) (Created page with "= Prerequisites = You need * The code coverage patch for coreboot: * The latest version of lcov:")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The wiki is being retired!

Documentation is now handled by the same processes we use for code: Add something to the Documentation/ directory in the coreboot repo, and it will be rendered to Contributions welcome!


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 @@
 	$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 --gcov-tool i386-elf-gcov
$ genhtml --output-directory coreboot-coverage
  • Find your html files visualizing code coverage in coreboot-coverage