All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH v2 5/9] scripts/code_cov_capture.sh: add a script to use lcov on build+test machine
Date: Tue,  1 Mar 2022 08:59:25 +0100	[thread overview]
Message-ID: <20220301075929.125733-6-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20220301075929.125733-1-mauro.chehab@linux.intel.com>

From: Mauro Carvalho Chehab <mchehab@kernel.org>

When the test machine is also the build machine, it is possible to run
lcov directly on it. That makes the IGT tests faster, as it won't need
to generate a results tarball, and the produced results will be
independent on the Kernel object files, making the output files more
portable.

It should be noticed that, in order to generate html files, the Kernel
source will still be needed, due to the detailed view.

Reviewed-by: Tomi Sarvela <tomi.p.sarvela@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
 scripts/code_cov_capture.sh | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100755 scripts/code_cov_capture.sh

diff --git a/scripts/code_cov_capture.sh b/scripts/code_cov_capture.sh
new file mode 100755
index 000000000000..8662b0f145b8
--- /dev/null
+++ b/scripts/code_cov_capture.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+trap 'catch $LINENO' ERR
+catch() {
+	echo "$0: error on line $1. Code coverage not stored." >&2
+	exit 1
+}
+
+if [ -z "$IGT_KERNEL_TREE" ] ; then
+	echo "Error! IGT_KERNEL_TREE environment var was not defined." >&2
+	exit 1
+fi
+
+if [ -z "$1" ] ; then
+	echo "Usage: $0 <output>" >&2
+	echo "   Please notice that this script assumes $IGT_KERNEL_TREE is used as both Kernel source and object dir." >&2
+	exit 1
+fi
+
+lcov -q --rc lcov_branch_coverage=1 \
+	--test-name "$(basename $1)" -b $IGT_KERNEL_TREE --capture \
+	--output-file $1.info
+
+uptime=$(cat /proc/uptime|cut -d' ' -f 1)
+echo "[$uptime]     Code coverage wrote to $1.info"
-- 
2.35.1

  parent reply	other threads:[~2022-03-01  7:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  7:59 [igt-dev] [PATCH v2 0/9] Add support to collect code coverage data Mauro Carvalho Chehab
2022-03-01  7:59 ` [igt-dev] [PATCH v2 1/9] runner: check if it has root permissions Mauro Carvalho Chehab
2022-03-01  7:59 ` [igt-dev] [PATCH v2 2/9] runner: Add support for code coverage Mauro Carvalho Chehab
2022-03-01  7:59 ` [igt-dev] [PATCH v2 3/9] scripts/code_cov_gather*/sh: add help scripts " Mauro Carvalho Chehab
2022-03-01  7:59 ` [igt-dev] [PATCH v2 4/9] scripts/code_cov_gather_on_build.sh: Improve the script Mauro Carvalho Chehab
2022-03-01  7:59 ` Mauro Carvalho Chehab [this message]
2022-03-01  7:59 ` [igt-dev] [PATCH v2 6/9] scripts/code_cov_gen_report.sh: add a script to generate code coverage reports Mauro Carvalho Chehab
2022-03-01  7:59 ` [igt-dev] [PATCH v2 7/9] scripts/run-tests.sh: add code coverage support Mauro Carvalho Chehab
2022-03-01  7:59 ` [igt-dev] [PATCH v2 8/9] scripts:code_cov_gather_on_test: use a faster script Mauro Carvalho Chehab
2022-03-01  7:59 ` [igt-dev] [PATCH v2 9/9] docs: add documentation for code coverage Mauro Carvalho Chehab
2022-03-01  9:14 ` [igt-dev] ✓ Fi.CI.BAT: success for Add support to collect code coverage data Patchwork
2022-03-01 15:48 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2022-03-01 16:13 ` [igt-dev] [PATCH v2 0/9] " Petri Latvala
2022-03-08  7:54 ` Mauro Carvalho Chehab

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=20220301075929.125733-6-mauro.chehab@linux.intel.com \
    --to=mauro.chehab@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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.