summaryrefslogtreecommitdiff
path: root/scripts/code_cov_capture
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@kernel.org>2022-04-14 14:24:51 +0200
committerPetri Latvala <petri.latvala@intel.com>2022-04-14 18:19:39 +0300
commitce05f2d4d34b2f4b506ffce04b34b9d242b3c4cc (patch)
tree1198745725fb26573d04f53fd581429360b32f0f /scripts/code_cov_capture
parenta3885810ccc0ce9e6552a20c910a0a322eca466c (diff)
scripts/code_cov*: remove the extensions from them
As those scripts will be installed and executed from the PATH, remove the extensions from them, in order to make it more elegant when installed on distros. Reviewed-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'scripts/code_cov_capture')
-rwxr-xr-xscripts/code_cov_capture25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/code_cov_capture b/scripts/code_cov_capture
new file mode 100755
index 00000000..8662b0f1
--- /dev/null
+++ b/scripts/code_cov_capture
@@ -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"