All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michał Winiarski" <michal.winiarski@intel.com>
To: <llvm@lists.linux.dev>, <linux-um@lists.infradead.org>,
	<linux-doc@vger.kernel.org>, <kunit-dev@googlegroups.com>,
	<linux-kselftest@vger.kernel.org>
Cc: "Tom Rix" <trix@redhat.com>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"David Gow" <davidgow@google.com>,
	"Brendan Higgins" <brendan.higgins@linux.dev>,
	"Michał Winiarski" <michal.winiarski@intel.com>
Subject: [PATCH 2/2] Documentation: kunit: Add clang UML coverage example
Date: Fri, 20 Oct 2023 11:21:59 +0200	[thread overview]
Message-ID: <20231020092159.2486063-3-michal.winiarski@intel.com> (raw)
In-Reply-To: <20231020092159.2486063-1-michal.winiarski@intel.com>

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>
---
 Documentation/dev-tools/kunit/running_tips.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Documentation/dev-tools/kunit/running_tips.rst b/Documentation/dev-tools/kunit/running_tips.rst
index 766f9cdea0fa..9f69c122dee7 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 toolchain 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
 ======================
-- 
2.42.0


WARNING: multiple messages have this Message-ID (diff)
From: "Michał Winiarski" <michal.winiarski@intel.com>
To: <llvm@lists.linux.dev>, <linux-um@lists.infradead.org>,
	<linux-doc@vger.kernel.org>, <kunit-dev@googlegroups.com>,
	<linux-kselftest@vger.kernel.org>
Cc: "Tom Rix" <trix@redhat.com>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"David Gow" <davidgow@google.com>,
	"Brendan Higgins" <brendan.higgins@linux.dev>,
	"Michał Winiarski" <michal.winiarski@intel.com>
Subject: [PATCH 2/2] Documentation: kunit: Add clang UML coverage example
Date: Fri, 20 Oct 2023 11:21:59 +0200	[thread overview]
Message-ID: <20231020092159.2486063-3-michal.winiarski@intel.com> (raw)
In-Reply-To: <20231020092159.2486063-1-michal.winiarski@intel.com>

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>
---
 Documentation/dev-tools/kunit/running_tips.rst | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Documentation/dev-tools/kunit/running_tips.rst b/Documentation/dev-tools/kunit/running_tips.rst
index 766f9cdea0fa..9f69c122dee7 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 toolchain 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
 ======================
-- 
2.42.0


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

  parent reply	other threads:[~2023-10-20  9:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20  9:21 [PATCH 0/2] um: kunit: Add Clang support for CONFIG_GCOV Michał Winiarski
2023-10-20  9:21 ` Michał Winiarski
2023-10-20  9:21 ` [PATCH 1/2] arch: um: Add Clang coverage support Michał Winiarski
2023-10-20  9:21   ` Michał Winiarski
2023-10-25  8:25   ` David Gow
2023-10-25  8:25     ` David Gow
2023-10-20  9:21 ` Michał Winiarski [this message]
2023-10-20  9:21   ` [PATCH 2/2] Documentation: kunit: Add clang UML coverage example Michał Winiarski
2023-10-25  8:28   ` David Gow
2023-10-25  8:28     ` David Gow
2023-10-23 14:58 ` [PATCH 0/2] um: kunit: Add Clang support for CONFIG_GCOV Arthur Grillo
2023-10-23 14:58   ` Arthur Grillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231020092159.2486063-3-michal.winiarski@intel.com \
    --to=michal.winiarski@intel.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=brendan.higgins@linux.dev \
    --cc=corbet@lwn.net \
    --cc=davidgow@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=richard@nod.at \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.