aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlash Sheridan <flash@pobox.com>2023-01-27 17:51:18 -0800
committerGalina Kistanova <gkistanova@gmail.com>2023-01-27 17:51:18 -0800
commit01f13f4877751e6d5aa6f07984ebd76f67047839 (patch)
tree2c49c69606d89d455acf006b940af74480a45299
parent305d718539659fb5fccd9b6e0771bbabc6c3c821 (diff)
downloadllvm-01f13f4877751e6d5aa6f07984ebd76f67047839.zip
llvm-01f13f4877751e6d5aa6f07984ebd76f67047839.tar.gz
llvm-01f13f4877751e6d5aa6f07984ebd76f67047839.tar.bz2
Explain code coverage with Lit in docs/SourceBasedCodeCoverage.rst
The documentation for code coverage in clang/docs/SourceBasedCodeCoverage.rst omits a couple of crucial steps when using it with Lit. This patch should fix that. Differential revision: https://reviews.llvm.org/D140730
-rw-r--r--clang/docs/SourceBasedCodeCoverage.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/docs/SourceBasedCodeCoverage.rst b/clang/docs/SourceBasedCodeCoverage.rst
index 5f4bcf8..f92e8d8 100644
--- a/clang/docs/SourceBasedCodeCoverage.rst
+++ b/clang/docs/SourceBasedCodeCoverage.rst
@@ -127,6 +127,11 @@ copy that's mapped into memory). This implementation can be also enabled for
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 @@ coverage reports. This is done using the "merge" tool in ``llvm-profdata``
# 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: