]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
when using valgrind, make sure we set some env vars in order to
authorPeter Stamfest <peter@stamfest.at>
Mon, 1 Sep 2014 18:39:44 +0000 (20:39 +0200)
committerPeter Stamfest <peter@stamfest.at>
Mon, 1 Sep 2014 19:03:00 +0000 (21:03 +0200)
have glib behave better and more "understandeable" for valgrind

tests/functions

index e4eb066a6b51dd71cceaf75da7055f00f5440c30..ff794c1d1b7800fff652f2f638e215d35a0b2604 100644 (file)
@@ -5,18 +5,38 @@ export TZ
 BASEDIR=${BASEDIR:-$(dirname $0)}
 BUILDDIR=${BUILDDIR:-${BASEDIR}}
 TOP_BUILDDIR=${TOP_BUILDDIR:-${BASEDIR}/..}
-if [ -z "$RRDTOOL" ] ; then 
-       case "$TESTS_STYLE" in
-       valgrind)
-               echo >&2 "# Note: exit code 111 indicates a valgrind detected memory problem" 
-               RRDTOOL="libtool --mode=execute valgrind --tool=memcheck \
+
+#
+# because valgrind has trouble with glib memory handling
+# (see e.g. https://developer.gnome.org/glib/2.30/glib-running.html or 
+# https://stackoverflow.com/questions/4254610/valgrind-reports-memory-possibly-lost-when-using-glib-data-types)
+# we set some env. vars to work around them:
+
+function rrdtool_valgrind {
+  (
+    G_DEBUG=gc-friendly
+    G_SLICE=all
+
+    export G_DEBUG 
+    export G_SLICE
+
+    libtool --mode=execute valgrind --tool=memcheck \
                        --suppressions=$BASEDIR/valgrind-supressions \
                        --leak-check=full --show-reachable=yes \
                        --leak-resolution=high --num-callers=20 \
                        --error-exitcode=111 \
                        --track-fds=yes \
+                        --track-origins=yes \
                        --free-fill=ad \
-                       $TOP_BUILDDIR/src/rrdtool"
+                       $TOP_BUILDDIR/src/rrdtool "$@"
+  )
+}
+
+if [ -z "$RRDTOOL" ] ; then 
+       case "$TESTS_STYLE" in
+       valgrind)
+               echo >&2 "# Note: exit code 111 indicates a valgrind detected memory problem" 
+               RRDTOOL=rrdtool_valgrind
                ;;
        *)
                RRDTOOL=$TOP_BUILDDIR/src/rrdtool