[PATCH] D140730: 59559 Explain code coverage with Lit in docs/SourceBasedCodeCoverage.rst
Flash Sheridan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 28 08:45:08 PST 2022
FlashSheridan created this revision.
Herald added a project: All.
FlashSheridan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
The documentation for code coverage in docs/SourceBasedCodeCoverage.rst omits a couple of crucial steps when using it with Lit. I’d suggest the following additions:
At the end of “Running the instrumented program”:
> For a program such as the :doc:Lit <CommandGuide/lit> testing tool which
> invokes other programs, it may be necessary to set LLVM_PROFILE_FILE for
> each invocation. The pattern strings "%p" or "%Nm" may help to avoid
> corruption due to concurrency.
18 lines later, after “code-block:: console”:
> For an example of merging multiple profiles created by testing,
> see the LLVM coverage build script https://github.com/llvm/llvm-zorg/blob/main/zorg/jenkins/jobs/jobs/llvm-coverage_.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140730
Files:
clang/docs/SourceBasedCodeCoverage.rst
Index: clang/docs/SourceBasedCodeCoverage.rst
===================================================================
--- clang/docs/SourceBasedCodeCoverage.rst
+++ clang/docs/SourceBasedCodeCoverage.rst
@@ -127,6 +127,11 @@
other platforms by passing the ``-runtime-counter-relocation`` option to the
backend during compilation.
+For a program such as the :doc:`Lit <CommandGuide/lit>` testing tool which
+invokes other programs, it may be necessary to set ``LLVM_PROFILE_FILE`` for
+each invocation. The pattern strings "%p" or "%Nm" may help to avoid
+corruption due to concurrency.
+
.. code-block:: console
% clang++ -fprofile-instr-generate -fcoverage-mapping -mllvm -runtime-counter-relocation foo.cc -o foo
@@ -143,6 +148,9 @@
# Step 3(a): Index the raw profile.
% llvm-profdata merge -sparse foo.profraw -o foo.profdata
+For an example of merging multiple profiles created by testing,
+see the LLVM `coverage build script <https://github.com/llvm/llvm-zorg/blob/main/zorg/jenkins/jobs/jobs/llvm-coverage>`_.
+
There are multiple different ways to render coverage reports. The simplest
option is to generate a line-oriented report:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140730.485511.patch
Type: text/x-patch
Size: 1164 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221228/d6623c9a/attachment-0001.bin>
More information about the cfe-commits
mailing list