Code Coverage

From coreboot
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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 https://doc.coreboot.org/. Contributions welcome!

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