Code Coverage

From coreboot
Revision as of 01:14, 9 January 2013 by Stepan (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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