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 v3 05/10] scripts/code_cov_gather_on_build.sh: Improve the script
Date: Wed, 16 Mar 2022 15:59:58 +0100	[thread overview]
Message-ID: <20220316150003.1583681-6-mauro.chehab@linux.intel.com> (raw)
In-Reply-To: <20220316150003.1583681-1-mauro.chehab@linux.intel.com>

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

- speedup the script by allowing Sparse file detection instead
  of libz compression;

- use realpath for the paths to allow running them from everywhere;

- Speedup tarball generation by limiting the source file scope to
  the DRM subsystem;

- Indent with tabs instead of spaces.

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

diff --git a/scripts/code_cov_gather_on_build.sh b/scripts/code_cov_gather_on_build.sh
index 99c436f76fb8..eebee89f9f1c 100755
--- a/scripts/code_cov_gather_on_build.sh
+++ b/scripts/code_cov_gather_on_build.sh
@@ -4,20 +4,36 @@ 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
+	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=$(cd $KSRC; printf "all:\n\t@echo \${CURDIR}\n" | make -f -)
-KOBJ=$(cd $KOBJ; printf "all:\n\t@echo \${CURDIR}\n" | make -f -)
+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)"
 
-find $KSRC $KOBJ \( -name '*.gcno' -o -name '*.[ch]' -o -type l \) -a \
-                 -perm /u+r,g+r | tar cfz $DEST -P -T -
+tar cf${TAR_COMPRESS} $DEST $SRCS $OBJS
 
 if [ $? -eq 0 ] ; then
-  echo "$DEST successfully created, copy to test system and unpack with:"
-  echo "  tar xfz $DEST -P"
+	echo "$DEST successfully created, copy to test system and unpack with:"
+	echo "  tar xf${TAR_COMPRESS} $DEST"
 else
-  echo "Could not create file $DEST"
+	echo "Could not create file $DEST"
 fi
-- 
2.35.1

  parent reply	other threads:[~2022-03-16 15:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 14:59 [igt-dev] [PATCH v3 00/10] Add support to collect code coverage data Mauro Carvalho Chehab
2022-03-16 14:59 ` [igt-dev] [PATCH v3 01/10] runner: check if it has root permissions Mauro Carvalho Chehab
2022-03-16 14:59 ` [igt-dev] [PATCH v3 02/10] runner: Add support for code coverage Mauro Carvalho Chehab
2022-03-16 14:59 ` [igt-dev] [PATCH v3 03/10] runner: cleanup code_cov directory, if any Mauro Carvalho Chehab
2022-03-16 14:59 ` [igt-dev] [PATCH v3 04/10] scripts/code_cov_gather*/sh: add help scripts for code coverage Mauro Carvalho Chehab
2022-03-16 14:59 ` Mauro Carvalho Chehab [this message]
2022-03-16 14:59 ` [igt-dev] [PATCH v3 06/10] scripts/code_cov_capture.sh: add a script to use lcov on build+test machine Mauro Carvalho Chehab
2022-03-16 15:00 ` [igt-dev] [PATCH v3 07/10] scripts/code_cov_gen_report.sh: add a script to generate code coverage reports Mauro Carvalho Chehab
2022-03-16 15:00 ` [igt-dev] [PATCH v3 08/10] scripts/run-tests.sh: add code coverage support Mauro Carvalho Chehab
2022-03-16 15:00 ` [igt-dev] [PATCH v3 09/10] scripts:code_cov_gather_on_test: use a faster script Mauro Carvalho Chehab
2022-03-16 15:00 ` [igt-dev] [PATCH v3 10/10] docs: add documentation for code coverage Mauro Carvalho Chehab
2022-03-16 15:44 ` [igt-dev] ✓ Fi.CI.BAT: success for Add support to collect code coverage data Patchwork
2022-03-16 16:53 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20220316150003.1583681-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.