All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amerigo Wang <amwang@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Amerigo Wang <amwang@redhat.com>,
	Peter Oberparleiter <oberpar@linux.vnet.ibm.com>,
	akpm@linux-foundation.org, Sam Ravnborg <sam@ravnborg.org>,
	linux-kbuild@vger.kernel.org
Subject: [Patch 3/5] doc: move the scripts in gcov.txt to tools/gcov/
Date: Thu, 3 Sep 2009 21:25:51 -0400	[thread overview]
Message-ID: <20090904012819.3749.33913.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090904012755.3749.69645.sendpatchset@localhost.localdomain>


Move the two bash scripts in gcov.txt into tools/gcov/,
so that we can use them directly.

Signed-off-by: WANG Cong <amwang@redhat.com>

---
Index: linux-2.6/Documentation/gcov.txt
===================================================================
--- linux-2.6.orig/Documentation/gcov.txt
+++ linux-2.6/Documentation/gcov.txt
@@ -8,8 +8,6 @@ Using gcov with the Linux kernel
 5. Modules
 6. Separated build and test machines
 7. Troubleshooting
-Appendix A: sample script: gather_on_build.sh
-Appendix B: sample script: gather_on_test.sh
 
 
 1. Introduction
@@ -155,6 +153,8 @@ exact same file system location on the t
 machine. If any of the path components is symbolic link, the actual
 directory needs to be used instead (due to make's CURDIR handling).
 
+Try tools/gcov/gather_on_build.sh.
+
 b) gcov is run on the BUILD machine
 
 The following files need to be copied after each test case from test
@@ -167,6 +167,8 @@ from the gcov directory in sysfs:
 These files can be copied to any location on the build machine. gcov
 must then be called with the -o option pointing to that directory.
 
+Try tools/gcov/gather_on_test.sh.
+
 Example directory setup on the build machine:
 
   /tmp/linux:    kernel source tree
@@ -192,62 +194,6 @@ Problem:  Files copied from sysfs appear
 Cause:    Due to the way seq_file works, some tools such as cp or tar
           may not correctly copy files from sysfs.
 Solution: Use 'cat' to read .gcda files and 'cp -d' to copy links.
-          Alternatively use the mechanism shown in Appendix B.
-
-
-Appendix A: gather_on_build.sh
-==============================
-
-Sample script to gather coverage meta files on the build machine
-(see 6a):
-#!/bin/bash
-
-KSRC=$1
-KOBJ=$2
-DEST=$3
-
-if [ -z "$KSRC" ] || [ -z "$KOBJ" ] || [ -z "$DEST" ]; then
-  echo "Usage: $0 <ksrc directory> <kobj directory> <output.tar.gz>" >&2
-  exit 1
-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 -)
-
-find $KSRC $KOBJ \( -name '*.gcno' -o -name '*.[ch]' -o -type l \) -a \
-                 -perm /u+r,g+r | tar cfz $DEST -P -T -
-
-if [ $? -eq 0 ] ; then
-  echo "$DEST successfully created, copy to test system and unpack with:"
-  echo "  tar xfz $DEST -P"
-else
-  echo "Could not create file $DEST"
-fi
-
-
-Appendix B: gather_on_test.sh
-=============================
-
-Sample script to gather coverage data files on the test machine
-(see 6b):
-
-#!/bin/bash -e
-
-DEST=$1
-GCDA=/sys/kernel/debug/gcov
-
-if [ -z "$DEST" ] ; then
-  echo "Usage: $0 <output.tar.gz>" >&2
-  exit 1
-fi
-
-TEMPDIR=$(mktemp -d)
-echo Collecting data..
-find $GCDA -type d -exec mkdir -p $TEMPDIR/\{\} \;
-find $GCDA -name '*.gcda' -exec sh -c 'cat < $0 > '$TEMPDIR'/$0' {} \;
-find $GCDA -name '*.gcno' -exec sh -c 'cp -d $0 '$TEMPDIR'/$0' {} \;
-tar czf $DEST -C $TEMPDIR sys
-rm -rf $TEMPDIR
+          Alternatively use the mechanism shown in
+          tools/gcov/gather_on_test.sh.
 
-echo "$DEST successfully created, copy to build system and unpack with:"
-echo "  tar xfz $DEST"
Index: linux-2.6/tools/gcov/gather_on_build.sh
===================================================================
--- /dev/null
+++ linux-2.6/tools/gcov/gather_on_build.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+KSRC=$1
+KOBJ=$2
+DEST=$3
+
+if [ -z "$KSRC" ] || [ -z "$KOBJ" ] || [ -z "$DEST" ]; then
+  echo "Usage: $0 <ksrc directory> <kobj directory> <output.tar.gz>" >&2
+  exit 1
+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 -)
+
+find $KSRC $KOBJ \( -name '*.gcno' -o -name '*.[ch]' -o -type l \) -a \
+                 -perm /u+r,g+r | tar cfz $DEST -P -T -
+
+if [ $? -eq 0 ] ; then
+  echo "$DEST successfully created, copy to test system and unpack with:"
+  echo "  tar xfz $DEST -P"
+else
+  echo "Could not create file $DEST"
+fi
+
Index: linux-2.6/tools/gcov/gather_on_test.sh
===================================================================
--- /dev/null
+++ linux-2.6/tools/gcov/gather_on_test.sh
@@ -0,0 +1,20 @@
+#!/bin/bash -e
+
+DEST=$1
+GCDA=/sys/kernel/debug/gcov
+
+if [ -z "$DEST" ] ; then
+  echo "Usage: $0 <output.tar.gz>" >&2
+  exit 1
+fi
+
+TEMPDIR=$(mktemp -d)
+echo Collecting data..
+find $GCDA -type d -exec mkdir -p $TEMPDIR/\{\} \;
+find $GCDA -name '*.gcda' -exec sh -c 'cat < $0 > '$TEMPDIR'/$0' {} \;
+find $GCDA -name '*.gcno' -exec sh -c 'cp -d $0 '$TEMPDIR'/$0' {} \;
+tar czf $DEST -C $TEMPDIR sys
+rm -rf $TEMPDIR
+
+echo "$DEST successfully created, copy to build system and unpack with:"
+echo "  tar xfz $DEST"

  parent reply	other threads:[~2009-09-04  1:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-04  1:25 [RFC Patch 0/5] gcov: integrate gcov into kbuild Amerigo Wang
2009-09-04  1:25 ` [Patch 1/5] gitignore: add .gcov files Amerigo Wang
2009-09-04  1:25 ` [Patch 2/5] Makefile: clean " Amerigo Wang
2009-09-04  1:25 ` Amerigo Wang [this message]
2009-09-04  1:25 ` [Patch 4/5] scripts: add gen_gcov.sh Amerigo Wang
2009-09-04  1:26 ` [Patch 5/5] Makefile: implement "make foo.c.gcov" Amerigo Wang
2009-09-07  8:24 ` [RFC Patch 0/5] gcov: integrate gcov into kbuild Peter Oberparleiter
2009-09-07  9:58   ` Amerigo Wang

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=20090904012819.3749.33913.sendpatchset@localhost.localdomain \
    --to=amwang@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oberpar@linux.vnet.ibm.com \
    --cc=sam@ravnborg.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.