summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Šimerda <psimerda@redhat.com>2013-07-26 14:16:47 +0200
committerPavel Šimerda <psimerda@redhat.com>2013-07-26 19:08:03 +0200
commitb38f76cdb4d5b2d475e443a2c41f268928a6be7a (patch)
tree6f0720bd572784c09d2a6fda6e89615f9469eb69
parent7b2a4054b0fc077ce4213909c5587865c7d6300b (diff)
downloadNetworkManager-b38f76cdb4d5b2d475e443a2c41f268928a6be7a.tar.gz
build: use a helper script for all valgrind tests
-rw-r--r--.gitignore2
-rw-r--r--configure.ac2
-rwxr-xr-xtools/run-test-valgrind.sh26
3 files changed, 29 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index a32ea69d62..c37c123815 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,8 @@ INSTALL
ABOUT-NLS
*.pc
cscope.*out
+valgrind-*.log
+
man/*.[185]
man/nm-settings.xml
po/*.gmo
diff --git a/configure.ac b/configure.ac
index 72e93fd4c0..c198708a28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -646,7 +646,7 @@ AS_IF([test "$with_valgrind" == "yes"],
AM_CONDITIONAL(ENABLE_TESTS, test "$enable_tests" != "no")
AM_CONDITIONAL(RUN_ROOT_TESTS, test "$enable_tests" == "root")
AS_IF([test "$with_valgrind" != "no"],
- AC_SUBST(VALGRIND_RULES, "TESTS_ENVIRONMENT = G_SLICE=always-malloc G_DEBUG=gc-friendly \$(LIBTOOL) --mode=execute $with_valgrind --quiet --error-exitcode=1 --leak-check=full --gen-suppressions=all --suppressions=\$(top_srcdir)/valgrind.suppressions"),
+ AC_SUBST(VALGRIND_RULES, 'TESTS_ENVIRONMENT = "$(top_srcdir)/tools/run-test-valgrind.sh" "$(LIBTOOL)" "$(with_valgrind)" "$(top_srcdir)/valgrind.suppressions"'),
AC_SUBST(VALGRIND_RULES, []))
GTK_DOC_CHECK(1.0)
diff --git a/tools/run-test-valgrind.sh b/tools/run-test-valgrind.sh
new file mode 100755
index 0000000000..abd32860ff
--- /dev/null
+++ b/tools/run-test-valgrind.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+LIBTOOL="$1"; shift
+VALGRIND="$1"; shift
+SUPPRESSIONS="$1"; shift
+TEST="$1"; shift
+
+LOGFILE="valgrind-`echo "$TEST" | tr -cd '[:alpha:]-'`.log"
+
+export G_SLICE=always-malloc
+export G_DEBUG=gc-friendly
+$LIBTOOL --mode=execute "$VALGRIND" \
+ --quiet \
+ --error-exitcode=1 \
+ --leak-check=full \
+ --gen-suppressions=all \
+ --suppressions="$SUPPRESSIONS" \
+ --log-file="$LOGFILE" \
+ "$TEST"
+RESULT=$?
+
+if [ $RESULT -ne 0 ]; then
+ echo "Don't forget to check the valgrind log at '$LOGFILE'." >&2
+fi
+
+exit $RESULT