summaryrefslogtreecommitdiff
path: root/make_gcov.sh
diff options
context:
space:
mode:
authorgreg@kroah.com <greg@kroah.com>2004-04-17 00:09:17 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:35:15 -0700
commitd9154d11760bc650ca396d19bd31240616d4f80a (patch)
tree47704644b2e137acfbdc2cafa26074111b2913a9 /make_gcov.sh
parentb2983b9d4a05b44c9230e17a3d6737d185d1c749 (diff)
[PATCH] add scripts to run gcov for udev from Leann Ogasawara <ogasawara@osdl.org>
Diffstat (limited to 'make_gcov.sh')
-rw-r--r--make_gcov.sh53
1 files changed, 53 insertions, 0 deletions
diff --git a/make_gcov.sh b/make_gcov.sh
new file mode 100644
index 0000000000..907c1ebd48
--- /dev/null
+++ b/make_gcov.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# gcov capability for udev
+#
+# Provides code coverage analysis for udev.
+#
+# make_gcov.sh assumes the same same default parameters as make, but also
+# accepts the same parameters as make (see README file in udev/ for
+# parameter info). There is one exception, klibc can not be used with
+# gcov as it will not compile cleanly.
+#
+# make_gcov.sh then overrides CFLAGS to strip out optimization in order
+# for gcov to get correct code coverage analysis.
+#
+# Leann Ogasawara <ogasawara@osdl.org>, April 2004
+
+# clean up udev dir
+clean_udev () {
+ find -name "*.da" -exec rm -f "{}" \;
+ find -name "*.bb" -exec rm -f "{}" \;
+ find -name "*.bbg" -exec rm -f "{}" \;
+ find -name "*.gcov" -exec rm -f "{}" \;
+ make clean
+}
+
+PWD=`pwd`
+GCCINCDIR=`gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"`
+LIBSYSFS="-I$PWD/libsysfs"
+WARNINGS="-Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations"
+GCC="-I$GCCINCDIR"
+USE_LOG="-DLOG"
+DEBUG="-D_GNU_SOURCE"
+GCOV_FLAGS="-pipe -fprofile-arcs -ftest-coverage"
+
+for i in $*; do
+ pre=`echo $i | sed 's/=.*//g'`
+ post=`echo $i | sed 's/.*=//g'`
+ if [ $pre = "USE_KLIBC" ] && [ $post = "true" ]; then
+ echo "cannot use gcov with klibc, will not compile"
+ exit
+ elif [ $pre = "USE_LOG" ] && [ $post = "false" ]; then
+ USE_LOG=""
+ elif [ $pre = "DEBUG" ] && [ $post = "true" ]; then
+ DEBUG="-g -DDEBUG -D_GNU_SOURCE"
+ elif [ $pre = "clean" ]; then
+ clean_udev
+ exit
+ fi
+done
+
+clean_udev
+
+make $* CFLAGS="$WARNINGS $GCOV_FLAGS $USE_LOG $DEBUG $GCC $LIBSYSFS"