diff options
author | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-03-16 15:59:59 +0100 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2022-03-21 18:34:59 +0200 |
commit | c4048c3393aaaa5ab9af0f41c0fc88444e37957e (patch) | |
tree | 4665a7664caba4f276ea9aacc8898bfcaa8f1178 /scripts | |
parent | c078ba892ba931aa2f54e4760b8306cde8b3ba51 (diff) |
scripts/code_cov_capture.sh: add a script to use lcov on build+test machine
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>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/code_cov_capture.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/code_cov_capture.sh b/scripts/code_cov_capture.sh new file mode 100755 index 00000000..8662b0f1 --- /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" |