summaryrefslogtreecommitdiff
path: root/scripts/code_cov_gather_on_build
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_gather_on_build
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_gather_on_build')
-rwxr-xr-xscripts/code_cov_gather_on_build39
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/code_cov_gather_on_build b/scripts/code_cov_gather_on_build
new file mode 100755
index 00000000..eebee89f
--- /dev/null
+++ b/scripts/code_cov_gather_on_build
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+KSRC=$1
+KOBJ=$2
+DEST=$3
+
+# Limit scope in order to speedup tarball creation
+GCOV_SCOPE=drivers/gpu/drm/
+
+if [ -z "$KSRC" ] || [ -z "$KOBJ" ] || [ -z "$DEST" ]; then
+ echo "Usage: $0 <ksrc directory> <kobj directory> <output.tar[.gz]>" >&2
+ exit 1
+fi
+
+if [ "x$(echo $DEST|grep '\.gz')" != "x" ]; then
+ TAR_COMPRESS="z"
+else
+ # gcno files are sparsed. So, if no compression is used, store the
+ # results as a sparse file, in order to save disk space
+ TAR_COMPRESS="S"
+fi
+
+KSRC=$(realpath $KSRC)
+KOBJ=$(realpath $KOBJ)
+
+# Source files
+SRCS="${KSRC}/include ${KSRC}/arch/x86/include $(find ${KSRC}/${GCOV_SCOPE} -name '*.[ch]')"
+
+# Generated gcno files and links
+OBJS="$(find $KOBJ/${GCOV_SCOPE} \( -name '*.gcno' -o -name '*.[ch]' -o -type l \) -a -perm /u+r,g+r)"
+
+tar cf${TAR_COMPRESS} $DEST $SRCS $OBJS
+
+if [ $? -eq 0 ] ; then
+ echo "$DEST successfully created, copy to test system and unpack with:"
+ echo " tar xf${TAR_COMPRESS} $DEST"
+else
+ echo "Could not create file $DEST"
+fi