From: Peter Stamfest Date: Mon, 1 Sep 2014 18:39:44 +0000 (+0200) Subject: when using valgrind, make sure we set some env vars in order to X-Git-Tag: v1.5.0-rc1~42^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b61f93bba72d76989e22222c9375b281ddc5440;p=thirdparty%2Frrdtool-1.x.git when using valgrind, make sure we set some env vars in order to have glib behave better and more "understandeable" for valgrind --- diff --git a/tests/functions b/tests/functions index e4eb066a..ff794c1d 100644 --- a/tests/functions +++ b/tests/functions @@ -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