Skip to content

Commit 2182255

Browse files
mwiniarsrichardweinberger
authored andcommitted
Documentation: kunit: Add clang UML coverage example
LLVM-based toolchain is using a different set of tools for coverage. Add an example that produces output in lcov format. Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: David Gow <davidgow@google.com> [rw: Added spelling fixes from David Gow] Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 32a84cf commit 2182255

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Documentation/dev-tools/kunit/running_tips.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ If your installed version of gcc doesn't work, you can tweak the steps:
139139
$ ./tools/testing/kunit/kunit.py run --make_options=CC=/usr/bin/gcc-6
140140
$ lcov -t "my_kunit_tests" -o coverage.info -c -d .kunit/ --gcov-tool=/usr/bin/gcov-6
141141
142+
Alternatively, LLVM-based toolchains can also be used:
143+
144+
.. code-block:: bash
145+
146+
# Build with LLVM and append coverage options to the current config
147+
$ ./tools/testing/kunit/kunit.py run --make_options LLVM=1 --kunitconfig=.kunit/ --kunitconfig=tools/testing/kunit/configs/coverage_uml.config
148+
$ llvm-profdata merge -sparse default.profraw -o default.profdata
149+
$ llvm-cov export --format=lcov .kunit/vmlinux -instr-profile default.profdata > coverage.info
150+
# The coverage.info file is in lcov-compatible format and it can be used to e.g. generate HTML report
151+
$ genhtml -o /tmp/coverage_html coverage.info
152+
142153
143154
Running tests manually
144155
======================

0 commit comments

Comments
 (0)