summaryrefslogtreecommitdiff
path: root/Documentation/dev-tools
diff options
context:
space:
mode:
authorMichał Winiarski <michal.winiarski@intel.com>2023-10-20 11:21:59 +0200
committerRichard Weinberger <richard@nod.at>2024-01-05 16:28:56 +0100
commit21822553a5f424892c12d1664b3c1235b095c6c6 (patch)
tree4d89df57488f296603b5d67e86efef42d7bdc09d /Documentation/dev-tools
parent32a84cfc6caf830431375c5182391284986d4066 (diff)
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>
Diffstat (limited to 'Documentation/dev-tools')
-rw-r--r--Documentation/dev-tools/kunit/running_tips.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/Documentation/dev-tools/kunit/running_tips.rst b/Documentation/dev-tools/kunit/running_tips.rst
index 766f9cdea0fa..221c730b9cb2 100644
--- a/Documentation/dev-tools/kunit/running_tips.rst
+++ b/Documentation/dev-tools/kunit/running_tips.rst
@@ -139,6 +139,17 @@ If your installed version of gcc doesn't work, you can tweak the steps:
$ ./tools/testing/kunit/kunit.py run --make_options=CC=/usr/bin/gcc-6
$ lcov -t "my_kunit_tests" -o coverage.info -c -d .kunit/ --gcov-tool=/usr/bin/gcov-6
+Alternatively, LLVM-based toolchains can also be used:
+
+.. code-block:: bash
+
+ # Build with LLVM and append coverage options to the current config
+ $ ./tools/testing/kunit/kunit.py run --make_options LLVM=1 --kunitconfig=.kunit/ --kunitconfig=tools/testing/kunit/configs/coverage_uml.config
+ $ llvm-profdata merge -sparse default.profraw -o default.profdata
+ $ llvm-cov export --format=lcov .kunit/vmlinux -instr-profile default.profdata > coverage.info
+ # The coverage.info file is in lcov-compatible format and it can be used to e.g. generate HTML report
+ $ genhtml -o /tmp/coverage_html coverage.info
+
Running tests manually
======================