Commit 0bb55bab authored by Mukund Sivaraman's avatar Mukund Sivaraman

[2036] Integrate valgrind into our test suite

* Supply --enable-valgrind to configure to run tests (make check)
  under valgrind

* Use two classes of suppressions files:
 + src/valgrind-suppressions for permanent suppressions that we
   never want to re-consider again
 + src/valgrind-suppressions.revisit for temporary suppressions
  (such as issues in testcases) that are not a priority to fix,
  but we'd like to fix them sometime
parent 32b494b4
......@@ -982,6 +982,19 @@ AC_ARG_ENABLE(logger-checks, [AC_HELP_STRING([--enable-logger-checks],
AM_CONDITIONAL(ENABLE_LOGGER_CHECKS, test x$enable_logger_checks != xno)
AM_COND_IF([ENABLE_LOGGER_CHECKS], [AC_DEFINE([ENABLE_LOGGER_CHECKS], [1], [Check logger messages?])])
# Check for valgrind
AC_PATH_PROG(VALGRIND, valgrind, no)
AM_CONDITIONAL(HAVE_VALGRIND, test "x$VALGRIND" != "xno")
AC_ARG_ENABLE(valgrind, [AC_HELP_STRING([--enable-valgrind],
[run tests under Valgrind [default=no]])], enable_valgrind=$enableval, enable_valgrind=no)
AM_CONDITIONAL(ENABLE_VALGRIND, test "x$enable_valgrind" != "xno")
if test "x$VALGRIND" != "xno" -a "x$enable_valgrind" != "xno"; then
VALGRIND_COMMAND="$VALGRIND --gen-suppressions=all --suppressions=\$(top_srcdir)/src/valgrind-suppressions --suppressions=\$(top_srcdir)/src/valgrind-suppressions.revisit --leak-check=full --track-fds=yes --fullpath-after="
fi
AC_SUBST(VALGRIND_COMMAND)
AC_CONFIG_FILES([Makefile
doc/Makefile
doc/guide/Makefile
......
SUBDIRS = lib bin
EXTRA_DIST = \
cppcheck-suppress.lst \
valgrind-suppressions \
valgrind-suppressions.revisit
......@@ -19,6 +19,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
# Do not define global tests, use check-local so
# environment can be set (needed for dynamic loading)
TESTS =
......
......@@ -38,6 +38,9 @@ if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
......
......@@ -34,6 +34,9 @@ if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
......
......@@ -14,6 +14,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -8,6 +8,9 @@ if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -8,6 +8,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -12,6 +12,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -18,6 +18,9 @@ AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG)
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -5,6 +5,9 @@ AM_CXXFLAGS = $(B10_CXXFLAGS)
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -28,6 +28,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -16,6 +16,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -14,6 +14,9 @@ CLEANFILES = *.gcno *.gcda
noinst_LTLIBRARIES = libfake_session.la
libfake_session_la_SOURCES = fake_session.h fake_session.cc
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -10,6 +10,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -17,6 +17,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
noinst_PROGRAMS =
if HAVE_GTEST
......
......@@ -13,6 +13,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += libdhcp++_unittests
......
......@@ -14,6 +14,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -9,6 +9,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -47,6 +47,9 @@ logger_lock_test_LDADD += $(top_builddir)/src/lib/util/libutil.la
logger_lock_test_LDADD += $(top_builddir)/src/lib/exceptions/libexceptions.la
logger_lock_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
if HAVE_GTEST
TESTS =
......
......@@ -25,6 +25,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -8,6 +8,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -22,6 +22,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -15,6 +15,9 @@ AM_CXXFLAGS += $(WARNING_NO_MISSING_FIELD_INITIALIZERS_CFLAG)
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -15,6 +15,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -8,6 +8,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
# Valgrind suppressions file. Place permanent suppressions that we never
# want to reconsider again into this file. For temporary suppressions
# that we want to revisit in the future, use
# valgrind-suppressions.revisit.
# Place temporary suppressions that we want to revisit in the future
# into this file. For permanent suppressions that we don't want to look
# at again, use valgrind-suppressions.
......@@ -10,6 +10,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
......@@ -10,6 +10,9 @@ endif
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
libtool --mode=execute $(VALGRIND_COMMAND)
TESTS =
if HAVE_GTEST
TESTS += run_unittests
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment