aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2007-12-29 23:49:28 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-12-29 23:49:28 +0800
commit2c4f7c6b6549f8b95845f1838dd0dc710c9e8304 (patch)
tree73f77284e63c07544111aae1cea50f8fced8acf0
parent876e427bafc95f2f13a333b9bca0d8982b7faf3d (diff)
downloadgsoc2013-empathy-2c4f7c6b6549f8b95845f1838dd0dc710c9e8304.tar
gsoc2013-empathy-2c4f7c6b6549f8b95845f1838dd0dc710c9e8304.tar.gz
gsoc2013-empathy-2c4f7c6b6549f8b95845f1838dd0dc710c9e8304.tar.bz2
gsoc2013-empathy-2c4f7c6b6549f8b95845f1838dd0dc710c9e8304.tar.lz
gsoc2013-empathy-2c4f7c6b6549f8b95845f1838dd0dc710c9e8304.tar.xz
gsoc2013-empathy-2c4f7c6b6549f8b95845f1838dd0dc710c9e8304.tar.zst
gsoc2013-empathy-2c4f7c6b6549f8b95845f1838dd0dc710c9e8304.zip
Add "check" framework support. Fixes bug #505622 (Guillaume Desmottes).
svn path=/trunk/; revision=509
-rw-r--r--.gitignore1
-rw-r--r--configure.ac25
-rw-r--r--m4/.gitignore2
-rw-r--r--m4/Makefile.am0
-rw-r--r--m4/acinclude.m4 (renamed from acinclude.m4)0
-rw-r--r--m4/empathy-args.m419
-rw-r--r--m4/empathy-valgrind.m431
-rw-r--r--rules/check.mak120
-rw-r--r--tests/.gitignore3
-rw-r--r--tests/Makefile.am27
-rw-r--r--tests/check-empathy-utils.c29
-rw-r--r--tests/check-helpers.c63
-rw-r--r--tests/check-helpers.h43
-rw-r--r--tests/check-libempathy.h6
-rw-r--r--tests/check-main.c40
-rw-r--r--tests/dlopen.supp127
-rw-r--r--tests/valgrind.supp711
17 files changed, 1245 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 0aa2d30c3..069396fb5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,4 @@ ltmain.sh
missing
mkinstalldirs
omf.make
+compile
diff --git a/configure.ac b/configure.ac
index c86b1190f..4f164ac78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,6 +39,7 @@ MISSION_CONTROL_REQUIRED=4.37
# AC_DEFINE(G_DISABLE_DEPRECATED, 1, [Disable deprecated GLib symbols])
# AC_DEFINE(LIBTELEPATHY_DISABLE_DEPRECATED, 1, [Disable deprecated libtelepathy symbols])
+AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(.)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(1.9 dist-bzip2 no-define)
@@ -210,11 +211,24 @@ AM_CONDITIONAL(HAVE_NOTHERE, test "x$have_nothere" = "xyes")
# Tests
# -----------------------------------------------------------
AC_ARG_ENABLE(tests,
- AS_HELP_STRING([--enable-tests=@<:@no/yes@:>@],
+ AS_HELP_STRING([--enable-tests=@<:@no/yes/auto@:>@],
[build tests]), ,
enable_tests=no)
-AM_CONDITIONAL(HAVE_TESTS, test "x$enable_tests" = "xyes")
+if test "x$enable_tests" != "xno"; then
+ PKG_CHECK_MODULES(CHECK,
+ [
+ check >= 0.9.4
+ ], have_check="yes", have_check="no")
+else
+ have_check=no
+fi
+
+if test "x$enable_tests" = "xyes" -a "x$have_check" != "xyes"; then
+ AC_MSG_ERROR([Couldn't find check dependencies.])
+fi
+
+AM_CONDITIONAL(HAVE_TESTS, test "x$have_check" = "xyes")
# -----------------------------------------------------------
# Python Bindings
@@ -267,6 +281,12 @@ fi
AM_CONDITIONAL(HAVE_VOIP, test "x$enable_voip" = "xyes")
+# Checks for the 'check' unit testing library
+PKG_CHECK_MODULES([CHECK], [check >= 0.9.4],
+ [ HAVE_CHECK=yes ],
+ [ HAVE_CHECK=no ] )
+AM_CONDITIONAL(HAVE_CHECK, test "x$HAVE_CHECK" = "xyes")
+
# -----------------------------------------------------------
AC_OUTPUT([
@@ -280,6 +300,7 @@ AC_OUTPUT([
libempathy-gtk/Makefile
libempathy-gtk/libempathy-gtk.pc
src/Makefile
+ m4/Makefile
megaphone/Makefile
megaphone/src/Makefile
megaphone/data/Makefile
diff --git a/m4/.gitignore b/m4/.gitignore
new file mode 100644
index 000000000..e429342b9
--- /dev/null
+++ b/m4/.gitignore
@@ -0,0 +1,2 @@
+gtk-doc.m4
+intltool.m4
diff --git a/m4/Makefile.am b/m4/Makefile.am
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/m4/Makefile.am
diff --git a/acinclude.m4 b/m4/acinclude.m4
index 3120d8620..3120d8620 100644
--- a/acinclude.m4
+++ b/m4/acinclude.m4
diff --git a/m4/empathy-args.m4 b/m4/empathy-args.m4
new file mode 100644
index 000000000..3daacbaba
--- /dev/null
+++ b/m4/empathy-args.m4
@@ -0,0 +1,19 @@
+dnl configure-time options for Empathy
+
+dnl EMPATHY_ARG_VALGRIND
+
+AC_DEFUN([EMPATHY_ARG_VALGRIND],
+[
+ dnl valgrind inclusion
+ AC_ARG_ENABLE(valgrind,
+ AC_HELP_STRING([--enable-valgrind],[enable valgrind checking and run-time detection]),
+ [
+ case "${enableval}" in
+ yes|no) enable="${enableval}" ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind) ;;
+ esac
+ ],
+ [enable=no])
+
+ EMPATHY_VALGRIND($enable, [2.1])
+])
diff --git a/m4/empathy-valgrind.m4 b/m4/empathy-valgrind.m4
new file mode 100644
index 000000000..7a44e103f
--- /dev/null
+++ b/m4/empathy-valgrind.m4
@@ -0,0 +1,31 @@
+dnl Detect Valgrind location and flags
+
+AC_DEFUN([EMPATHY_VALGRIND],
+[
+ enable=$1
+ if test -n "$2"; then
+ valgrind_req=$2
+ else
+ valgrind_req="2.1"
+ fi
+
+ PKG_CHECK_MODULES(VALGRIND, valgrind > "$valgrind_req",
+ have_valgrind_runtime="yes", have_valgrind_runtime="no")
+
+ AC_PATH_PROG(VALGRIND_PATH, valgrind)
+
+ # Compile the instrumentation for valgrind only if the valgrind
+ # libraries are installed and the valgrind executable is found
+ if test "x$enable" = xyes &&
+ test "$have_valgrind_runtime" = yes &&
+ test -n "$VALGRIND_PATH" ;
+ then
+ AC_DEFINE(HAVE_VALGRIND, 1, [Define if valgrind should be used])
+ AC_MSG_NOTICE(using compile-time instrumentation for valgrind)
+ fi
+
+ AC_SUBST(VALGRIND_CFLAGS)
+ AC_SUBST(VALGRIND_LIBS)
+
+ AM_CONDITIONAL(HAVE_VALGRIND, test -n "$VALGRIND_PATH")
+])
diff --git a/rules/check.mak b/rules/check.mak
new file mode 100644
index 000000000..bbb9819f2
--- /dev/null
+++ b/rules/check.mak
@@ -0,0 +1,120 @@
+LOOPS = 10
+CLEANFILES += valgrind.*.log
+
+# run any given test by running make test.check
+# if the test fails, run it again at at least debug level 2
+%.check: %
+ @$(TESTS_ENVIRONMENT) \
+ $* || \
+ $(TESTS_ENVIRONMENT) \
+ $*
+
+# run any given test in a loop
+%.torture: %
+ @for i in `seq 1 $(LOOPS)`; do \
+ $(TESTS_ENVIRONMENT) \
+ $*; done
+
+# run any given test in an infinite loop
+%.forever: %
+ @while true; do \
+ $(TESTS_ENVIRONMENT) \
+ $* || break; done
+
+# valgrind any given test by running make test.valgrind
+%.valgrind: %
+ $(TESTS_ENVIRONMENT) \
+ CK_DEFAULT_TIMEOUT=360 \
+ G_SLICE=always-malloc \
+ G_DEBUG=gc-friendly \
+ libtool --mode=execute \
+ $(VALGRIND_PATH) -q \
+ $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \
+ --tool=memcheck --leak-check=full --trace-children=yes \
+ --leak-resolution=high --num-callers=20 \
+ ./$* 2>&1 | tee "valgrind.$*.log"
+ @if grep "==" "valgrind.$*.log" > /dev/null 2>&1; then \
+ exit 1; \
+ fi
+
+# valgrind any given test and generate suppressions for it
+%.valgrind.gen-suppressions: %
+ $(TESTS_ENVIRONMENT) \
+ CK_DEFAULT_TIMEOUT=360 \
+ G_SLICE=always-malloc \
+ G_DEBUG=gc-friendly \
+ libtool --mode=execute \
+ $(VALGRIND_PATH) -q \
+ $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \
+ --tool=memcheck --leak-check=full --trace-children=yes \
+ --leak-resolution=high --num-callers=20 \
+ --gen-suppressions=all \
+ ./$* 2>&1 | tee suppressions.log
+
+# valgrind any given test until failure by running make test.valgrind-forever
+%.valgrind-forever: %
+ @while $(MAKE) $*.valgrind; do \
+ true; done
+
+# gdb any given test by running make test.gdb
+%.gdb: %
+ $(TESTS_ENVIRONMENT) \
+ CK_FORK=no \
+ libtool --mode=execute \
+ gdb $*
+
+# torture tests
+torture: $(TESTS)
+ @echo "Torturing tests ..."
+ for i in `seq 1 $(LOOPS)`; do \
+ $(MAKE) check || \
+ (echo "Failure after $$i runs"; exit 1) || \
+ exit 1; \
+ done
+ @banner="All $(LOOPS) loops passed"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo $$dashes; echo $$banner; echo $$dashes
+
+# forever tests
+forever: $(TESTS)
+ @echo "Forever tests ..."
+ while true; do \
+ $(MAKE) check || \
+ (echo "Failure"; exit 1) || \
+ exit 1; \
+ done
+
+# valgrind all tests
+valgrind: $(TESTS)
+ @echo "Valgrinding tests ..."
+ @failed=0; \
+ for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
+ $(MAKE) $$t.valgrind; \
+ if test "$$?" -ne 0; then \
+ echo "Valgrind error for test $$t"; \
+ failed=`expr $$failed + 1`; \
+ whicht="$$whicht $$t"; \
+ fi; \
+ done; \
+ if test "$$failed" -ne 0; then \
+ echo "$$failed tests had leaks or errors under valgrind:"; \
+ echo "$$whicht"; \
+ false; \
+ fi
+
+help:
+ @echo "make check -- run all checks"
+ @echo "make torture -- run all checks $(LOOPS) times"
+ @echo "make (dir)/(test).check -- run the given check once"
+ @echo "make (dir)/(test).forever -- run the given check forever"
+ @echo "make (dir)/(test).torture -- run the given check $(LOOPS) times"
+ @echo
+ @echo "make (dir)/(test).gdb -- start up gdb for the given test"
+ @echo
+ @echo "make valgrind -- valgrind all tests"
+ @echo "make (dir)/(test).valgrind -- valgrind the given test"
+ @echo "make (dir)/(test).valgrind-forever -- valgrind the given test forever"
+ @echo "make (dir)/(test).valgrind.gen-suppressions -- generate suppressions"
+ @echo " and save to suppressions.log"
+ @echo "make inspect -- inspect all plugin features"
+
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 000000000..edf303249
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,3 @@
+check-main
+contact-manager
+*.log
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8c6094c95..29ed270ed 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,3 +1,9 @@
+CLEANFILES=
+
+include $(top_srcdir)/rules/check.mak
+
+SUPPRESSIONS=valgrind.supp dlopen.supp
+
AM_CPPFLAGS = \
-I$(top_srcdir) \
$(EMPATHY_CFLAGS) \
@@ -13,3 +19,24 @@ bin_PROGRAMS = \
contact_manager_SOURCES = contact-manager.c
+if HAVE_CHECK
+check_PROGRAMS = check-main
+TESTS = check-main
+check_main_SOURCES = \
+ check-main.c \
+ check-helpers.c \
+ check-helpers.h \
+ check-libempathy.h \
+ check-empathy-utils.c
+
+check_main_LDADD = \
+ @CHECK_LIBS@ \
+ $(top_builddir)/libempathy-gtk/libempathy-gtk.la \
+ $(top_builddir)/libempathy/libempathy.la \
+ $(AM_LDFLAGS)
+
+check_main_CFLAGS = \
+ @CHECK_CFLAGS@ \
+ $(AM_CFLAGS)
+
+endif
diff --git a/tests/check-empathy-utils.c b/tests/check-empathy-utils.c
new file mode 100644
index 000000000..faf261058
--- /dev/null
+++ b/tests/check-empathy-utils.c
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <check.h>
+#include "check-helpers.h"
+#include "check-libempathy.h"
+
+#include <libempathy/empathy-utils.h>
+
+START_TEST (test_empathy_substring)
+{
+ gchar *tmp;
+
+ tmp = empathy_substring ("empathy", 2, 6);
+ fail_if (tmp == NULL);
+ fail_if (strcmp (tmp, "path") != 0);
+
+ g_free (tmp);
+}
+END_TEST
+
+TCase *
+make_empathy_utils_tcase (void)
+{
+ TCase *tc = tcase_create ("empathy-utils");
+ tcase_add_test (tc, test_empathy_substring);
+ return tc;
+}
diff --git a/tests/check-helpers.c b/tests/check-helpers.c
new file mode 100644
index 000000000..1bb14cdec
--- /dev/null
+++ b/tests/check-helpers.c
@@ -0,0 +1,63 @@
+/*
+ * check-helpers.c - Source for some check helpers
+ * Copyright (C) 2007 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "check-helpers.h"
+
+static gboolean expecting_critical = FALSE;
+static gboolean received_critical = FALSE;
+
+static void
+check_helper_log_critical_func (const gchar *log_damain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+
+ if (!expecting_critical)
+ {
+ fail("Unexpected critical message: %s\n", message);
+ }
+
+ g_assert (log_level & G_LOG_LEVEL_CRITICAL);
+
+ received_critical = TRUE;
+}
+
+gboolean
+got_critical (void)
+{
+ return received_critical;
+}
+
+void
+expect_critical (gboolean expected)
+{
+ expecting_critical = expected;
+ received_critical = FALSE;
+}
+
+void
+check_helpers_init (void)
+{
+ g_log_set_handler (NULL, G_LOG_LEVEL_CRITICAL,
+ check_helper_log_critical_func, NULL);
+}
diff --git a/tests/check-helpers.h b/tests/check-helpers.h
new file mode 100644
index 000000000..b71b3b65b
--- /dev/null
+++ b/tests/check-helpers.h
@@ -0,0 +1,43 @@
+/*
+ * check-helpers.c - Source for some check helpers
+ * Copyright (C) 2007 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#ifndef __CHECK_HELPERS_H__
+#define __CHECK_HELPERS_H__
+
+#include <glib.h>
+#include <check.h>
+
+void
+check_helpers_init (void);
+
+void
+expect_critical (gboolean expected);
+
+gboolean
+got_critical (void);
+
+#define fail_unless_critical(expr, ...) \
+G_STMT_START { \
+ expect_critical (TRUE); \
+ expr; \
+ _fail_unless (got_critical (), __FILE__, __LINE__, \
+ "Expected g_critical, got none", ## __VA_ARGS__, NULL); \
+ expect_critical (FALSE); \
+} G_STMT_END;
+
+#endif /* #ifndef __CHECK_HELPERS_H__ */
diff --git a/tests/check-libempathy.h b/tests/check-libempathy.h
new file mode 100644
index 000000000..1f3302583
--- /dev/null
+++ b/tests/check-libempathy.h
@@ -0,0 +1,6 @@
+#ifndef __CHECK_LIBEMPATHY__
+#define __CHECK_LIBEMPATHY__
+
+TCase * make_empathy_utils_tcase (void);
+
+#endif /* #ifndef __CHECK_LIBEMPATHY__ */
diff --git a/tests/check-main.c b/tests/check-main.c
new file mode 100644
index 000000000..6dcfe3237
--- /dev/null
+++ b/tests/check-main.c
@@ -0,0 +1,40 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <glib-object.h>
+
+#include <check.h>
+
+#include "check-helpers.h"
+#include "check-libempathy.h"
+
+#include "config.h"
+
+static Suite *
+make_libempathy_suite (void)
+{
+ Suite *s = suite_create ("libempathy");
+
+ suite_add_tcase (s, make_empathy_utils_tcase ());
+
+ return s;
+}
+
+int
+main (void)
+{
+ int number_failed = 0;
+ Suite *s;
+ SRunner *sr;
+
+ check_helpers_init ();
+ g_type_init ();
+
+ s = make_libempathy_suite ();
+ sr = srunner_create (s);
+ srunner_run_all (sr, CK_NORMAL);
+ number_failed += srunner_ntests_failed (sr);
+ srunner_free (sr);
+
+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/tests/dlopen.supp b/tests/dlopen.supp
new file mode 100644
index 000000000..f6300a3a7
--- /dev/null
+++ b/tests/dlopen.supp
@@ -0,0 +1,127 @@
+{
+ <dlopen>
+ Addrcheck,Memcheck:Cond
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ fun:dlopen
+}
+{
+ <dlopen>
+ Addrcheck,Memcheck:Addr4
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ fun:dlopen
+}
+{
+ <dlopen>
+ Addrcheck,Memcheck:Cond
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ fun:dlopen
+}
+{
+ <dlsym>
+ Addrcheck,Memcheck:Addr4
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libc-2.5.so
+ fun:_dl_sym
+ obj:/lib/i686/cmov/libdl-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ fun:dlsym
+}
+{
+ <dlsym>
+ Addrcheck,Memcheck:Cond
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libc-2.5.so
+ fun:_dl_sym
+ obj:/lib/i686/cmov/libdl-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ fun:dlsym
+}
+{
+ <dlopen>
+ Addrcheck,Memcheck:Addr1
+ fun:malloc
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ fun:dlopen
+}
+{
+ <dlopen>
+ Addrcheck,Memcheck:Addr1
+ fun:malloc
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ fun:dlopen
+}
+{
+ <dlopen>
+ Addrcheck,Memcheck:Addr1
+ fun:malloc
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ fun:dlopen
+}
+{
+ <libdl>
+ Addrcheck,Memcheck:Addr4
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+ obj:/lib/ld-2.5.so
+ obj:/lib/i686/cmov/libdl-2.5.so
+}
diff --git a/tests/valgrind.supp b/tests/valgrind.supp
new file mode 100644
index 000000000..29bb04547
--- /dev/null
+++ b/tests/valgrind.supp
@@ -0,0 +1,711 @@
+### this file contains suppressions for valgrind when running
+### the gibber/telepathy-salut unit tests based on the gstreamer one
+
+### syscall suppressions
+
+{
+ <clone on Wim's Debian>
+ Memcheck:Param
+ clone(parent_tidptr)
+ fun:clone
+ fun:clone
+}
+
+{
+ <clone on Wim's Debian>
+ Memcheck:Param
+ clone(child_tidptr)
+ fun:clone
+ fun:clone
+}
+
+{
+ <clone on Wim's Debian>
+ Memcheck:Param
+ clone(tlsinfo)
+ fun:clone
+ fun:clone
+}
+
+### glibc suppressions
+
+{
+ <conditional jump on wim's debian 2/2/06>
+ Memcheck:Cond
+ obj:/lib/ld-2.3.*.so
+ fun:dl_open_worker
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_open
+ fun:dlopen_doit
+ obj:/lib/ld-2.3.*.so
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+# glibc does not deallocate thread-local storage
+
+{
+ <tls>
+ Memcheck:Leak
+ fun:calloc
+ fun:_dl_allocate_tls
+ fun:pthread_create@@*
+}
+
+# I get an extra stack entry on x86/dapper
+{
+ <tls>
+ Memcheck:Leak
+ fun:calloc
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_allocate_tls
+ fun:pthread_create@@*
+}
+
+
+{
+ <pthread strstr>
+ Memcheck:Cond
+ fun:strstr
+ fun:__pthread_initialize_minimal
+ obj:/lib/libpthread-*.so
+ obj:/lib/libpthread-*.so
+ fun:call_init
+ fun:_dl_init
+ obj:/lib/ld-*.so
+}
+
+# a thread-related free problem in glibc from Edgard
+{
+ __libc_freeres_rw_acess
+ Memcheck:Addr4
+ obj:*
+ obj:*
+ obj:*
+ obj:*
+ obj:*
+ fun:__libc_freeres
+}
+
+{
+ <a conditional jump on wim's debian>
+ Memcheck:Cond
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+}
+
+# g_module_open-related problems
+{
+ <started showing up on fc4-quick>
+ Memcheck:Addr2
+ fun:memcpy
+ fun:_dl_map_object_deps
+ fun:dl_open_worker
+ fun:_dl_catch_error
+ fun:_dl_open
+ fun:dlopen_doit
+ fun:_dl_catch_error
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+{
+ <started showing up on fc4-quick>
+ Memcheck:Addr4
+ fun:memcpy
+ fun:_dl_map_object_deps
+ fun:dl_open_worker
+ fun:_dl_catch_error
+ fun:_dl_open
+ fun:dlopen_doit
+ fun:_dl_catch_error
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+{
+ <g_module_open on wim's debian>
+ Memcheck:Cond
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ fun:do_sym
+ fun:_dl_sym
+ fun:dlsym_doit
+ obj:/lib/ld-2.3.*.so
+ fun:_dlerror_run
+ fun:dlsym
+ fun:g_module_symbol
+ fun:g_module_open
+}
+
+{
+ <g_module_open on wim's debian>
+ Memcheck:Cond
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ fun:dl_open_worker
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_open
+ fun:dlopen_doit
+ obj:/lib/ld-2.3.*.so
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+{
+ <g_module_open on wim's debian>
+ Memcheck:Cond
+ obj:/lib/ld-2.3.*.so
+ fun:dl_open_worker
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_open
+ fun:dlopen_doit
+ obj:/lib/ld-2.3.*.so
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+{
+ <leak on wim's debian in g_module_open>
+ Memcheck:Leak
+ fun:malloc
+ obj:/lib/ld-2.3.*.so
+ fun:dl_open_worker
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_open
+ fun:dlopen_doit
+ obj:/lib/ld-2.3.*.so
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+{
+ <invalid read on wim's debian>
+ Memcheck:Addr4
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ fun:dl_open_worker
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_open
+ fun:dlopen_doit
+ obj:/lib/ld-2.3.*.so
+}
+
+{
+ <invalid read on wim's debian>
+ Memcheck:Addr4
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ fun:dl_open_worker
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_open
+ fun:dlopen_doit
+ obj:/lib/ld-2.3.*.so
+ fun:_dlerror_run
+}
+
+{
+ <invalid read on wim's debian - 2006-02-02>
+ Memcheck:Addr4
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ fun:dl_open_worker
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_open
+ fun:dlopen_doit
+ obj:/lib/ld-2.3.*.so
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+{
+ <invalid read on wim's debian - 2006-02-02>
+ Memcheck:Addr4
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ fun:dl_open_worker
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_open
+ fun:dlopen_doit
+ obj:/lib/ld-2.3.*.so
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+{
+ <invalid read on wim's debian - 2006-02-02>
+ Memcheck:Addr4
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ fun:do_sym
+ fun:_dl_sym
+ fun:dlsym_doit
+ obj:/lib/ld-2.3.*.so
+ fun:_dlerror_run
+ fun:dlsym
+ fun:g_module_symbol
+ fun:g_module_open
+}
+
+{
+ <futex on Andy's 64-bit ubuntu>
+ Memcheck:Param
+ futex(uaddr2)
+ fun:pthread_once
+ obj:/lib/libc-2.3.*.so
+ obj:/lib/libc-2.3.*.so
+ fun:mbsnrtowcs
+ fun:vfprintf
+ fun:vsprintf
+ fun:sprintf
+ obj:/lib/libc-2.3.*.so
+}
+
+# valgrind doesn't allow me to specify a suppression for Addr1, Addr2, Addr4
+# as Addr*, so 3 copies for that; and then 2 of each for that pesky memcpy
+{
+ <Invalid read of size 1, 2, 4 on thomas's FC4>
+ Memcheck:Addr1
+ fun:_dl_signal_error
+ fun:_dl_map_object_deps
+ fun:dl_open_worker
+ fun:_dl_catch_error
+ fun:_dl_open
+ fun:dlopen_doit
+ fun:_dl_catch_error
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+{
+ <Invalid read of size 1, 2, 4 on thomas's FC4>
+ Memcheck:Addr2
+ fun:_dl_signal_error
+ fun:_dl_map_object_deps
+ fun:dl_open_worker
+ fun:_dl_catch_error
+ fun:_dl_open
+ fun:dlopen_doit
+ fun:_dl_catch_error
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+{
+ <Invalid read of size 1, 2, 4 on thomas's FC4>
+ Memcheck:Addr4
+ fun:_dl_signal_error
+ fun:_dl_map_object_deps
+ fun:dl_open_worker
+ fun:_dl_catch_error
+ fun:_dl_open
+ fun:dlopen_doit
+ fun:_dl_catch_error
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+{
+ <Invalid read of size 1, 2, 4 on thomas's FC4>
+ Memcheck:Addr1
+ fun:memcpy
+ fun:_dl_signal_error
+ fun:_dl_map_object_deps
+ fun:dl_open_worker
+ fun:_dl_catch_error
+ fun:_dl_open
+ fun:dlopen_doit
+ fun:_dl_catch_error
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+{
+ <Invalid read of size 1, 2, 4 on thomas's FC4>
+ Memcheck:Addr2
+ fun:memcpy
+ fun:_dl_signal_error
+ fun:_dl_map_object_deps
+ fun:dl_open_worker
+ fun:_dl_catch_error
+ fun:_dl_open
+ fun:dlopen_doit
+ fun:_dl_catch_error
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+{
+ <Invalid read of size 1, 2, 4 on thomas's FC4>
+ Memcheck:Addr4
+ fun:memcpy
+ fun:_dl_signal_error
+ fun:_dl_map_object_deps
+ fun:dl_open_worker
+ fun:_dl_catch_error
+ fun:_dl_open
+ fun:dlopen_doit
+ fun:_dl_catch_error
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+ fun:g_module_open
+}
+
+{
+ <Addr8 on Andy's AMD64 ubuntu in dl_open>
+ Memcheck:Addr8
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/libc-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_open
+ obj:/lib/libdl-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+}
+
+{
+ <Conditional jump on Andy's AMD64 ubuntu>
+ Memcheck:Cond
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/libc-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ fun:_dl_open
+ obj:/lib/libdl-2.3.*.so
+ obj:/lib/ld-2.3.*.so
+ obj:/lib/libdl-2.3.*.so
+ fun:dlopen
+ fun:g_module_open
+}
+
+{
+ <Mike's x86 dapper>
+ Memcheck:Addr4
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/tls/i686/cmov/libc-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ fun:_dl_open
+ obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+ fun:dlopen
+}
+
+{
+ <Mike's x86 dapper>
+ Memcheck:Cond
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/tls/i686/cmov/libc-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ fun:_dl_open
+ obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+ fun:dlopen
+}
+
+{
+ <Another dapper one>
+ Memcheck:Cond
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/tls/i686/cmov/libc-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ fun:_dl_open
+ obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/tls/i686/cmov/libdl-2.3.6.so
+ fun:dlopen
+}
+
+### glib suppressions
+{
+ <g_parse_debug_string>
+ Memcheck:Cond
+ fun:g_parse_debug_string
+ obj:/usr/lib*/libglib-2.0.so.*
+ fun:g_slice_alloc
+ fun:g_slice_alloc0
+}
+
+{
+ <g_type_init malloc>
+ Memcheck:Leak
+ fun:malloc
+ fun:g_malloc
+ fun:g_strdup
+ fun:g_quark_from_string
+ obj:*
+ obj:*
+ fun:g_type_register_fundamental
+ obj:*
+ fun:g_type_init_with_debug_flags
+ fun:g_type_init
+}
+
+{
+ <g_type_init calloc>
+ Memcheck:Leak
+ fun:calloc
+ fun:g_malloc0
+ obj:*
+ obj:*
+ fun:g_type_register_fundamental
+}
+
+{
+ <g_type_init calloc 2>
+ Memcheck:Leak
+ fun:calloc
+ fun:g_malloc0
+ obj:*
+ obj:*
+ fun:g_type_init_with_debug_flags
+}
+
+{
+ <g_type_init calloc 3, GSlice version>
+ Memcheck:Leak
+ fun:calloc
+ fun:g_malloc0
+ fun:g_slice_alloc
+ obj:*
+ obj:*
+ fun:g_type_init_with_debug_flags
+}
+
+#pthread memleaks
+
+{
+ Thread creation leak
+ Memcheck:Leak
+ fun:calloc
+ fun:allocate_dtv
+ fun:_dl_allocate*
+ fun:_dl_allocate*
+ fun:__pthread_initialize_minimal
+}
+
+{
+ Thread management leak
+ Memcheck:Leak
+ fun:calloc
+ fun:allocate_dtv
+ fun:_dl_allocate*
+ fun:_dl_allocate*
+ fun:__pthread_*
+}
+
+{
+ Thread management leak 2
+ Memcheck:Leak
+ fun:memalign
+ fun:_dl_allocate*
+ fun:_dl_allocate*
+ fun:__pthread_*
+}
+
+{
+ pthread_create Syscall param write(buf) points to uninitialised byte(s)
+ Memcheck:Param
+ write(buf)
+ fun:pthread_create@@GLIBC_2.2.5
+ fun:g_thread_create*
+
+}
+
+# nss_parse_* memleak (used by g_option_context_parse)
+{
+ nss_parse_* memleak
+ Memcheck:Leak
+ fun:malloc
+ fun:nss_parse_service_list
+ fun:__nss_database_lookup
+}
+
+{
+ <annoying read error inside dlopen stuff on Ubuntu Dapper x86_64>
+ Memcheck:Addr8
+ obj:/lib/ld-2.3.6.so
+}
+
+{
+ <Ubuntu Dapper x86_64>
+ Memcheck:Param
+ futex(uaddr2)
+ fun:pthread_once
+ obj:/lib/libc-2.3.6.so
+ obj:/lib/libc-2.3.6.so
+ fun:setlocale
+ fun:init_pre
+ fun:g_option_context_parse
+}
+
+{
+ <Ubuntu Dapper x86_64 dlopen stuff again>
+ Memcheck:Cond
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ fun:_dl_open
+ obj:/lib/libdl-2.3.6.so
+ obj:/lib/ld-2.3.6.so
+ obj:/lib/libdl-2.3.6.so
+ fun:dlopen
+ fun:g_module_open
+}
+# this exists in a bunch of different variations, hence the short tail/trace
+{
+ <dlopen invalid read of size 4 suppression on tpm's Ubuntu edgy/x86>
+ Memcheck:Addr4
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+}
+{
+ <and the same for 64bit systems>
+ Memcheck:Addr8
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+}
+
+# More edgy suppressions (Mike)
+{
+ <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
+ Memcheck:Cond
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ fun:dlopen_doit
+ obj:/lib/ld-2.4.so
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+}
+
+{
+ <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
+ Memcheck:Cond
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ fun:dlopen_doit
+ obj:/lib/ld-2.4.so
+ fun:_dlerror_run
+ fun:dlopen@@GLIBC_2.1
+}
+
+{
+ <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
+ Memcheck:Cond
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ fun:do_sym
+ fun:_dl_sym
+}
+
+# This one's overly general, but there's zero other information in the stack
+# trace - just these five lines!
+{
+ <dlopen Condition jump suppressions for Ubuntu Edgy/x86>
+ Memcheck:Cond
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+ obj:/lib/ld-2.4.so
+}
+
+{
+ <tls leaks on Edgy/x86>
+ Memcheck:Leak
+ fun:calloc
+ obj:/lib/ld-2.4.so
+ fun:_dl_allocate_tls
+ fun:pthread_create@@GLIBC_2.1
+}
+
+{
+ <libcdio 0.76 leak>
+ Memcheck:Leak
+ fun:calloc
+ obj:/usr/lib/libcdio.so.6.0.1
+ fun:cdio_open_am_linux
+ obj:/usr/lib/libcdio.so.6.0.1
+ fun:cdio_open_am
+}
+
+# TLS leaks for feisty/x86
+{
+ <tls leaks on Feisty/x86>
+ Memcheck:Leak
+ fun:calloc
+ fun:allocate_dtv
+ fun:_dl_allocate_tls
+ fun:pthread_create@@GLIBC_2.1
+}
+
+{
+ <Addr8 on Jan's AMD64 ubuntu Feisty in dl_open>
+ Memcheck:Addr8
+ obj:/lib/ld-2.5.so
+}
+
+{
+ <GLib caching the home dir>
+ Memcheck:Leak
+ fun:malloc
+ obj:/lib/libc-*.so
+ fun:__nss_database_lookup
+ obj:*
+ obj:*
+ fun:getpwnam_r
+ fun:g_get_any_init_do
+ fun:g_get_home_dir
+}
+{
+ <GLib caching the user name>
+ Memcheck:Leak
+ fun:malloc
+ obj:/lib/libc-*.so
+ fun:__nss_database_lookup
+ obj:*
+ obj:*
+ fun:getpwnam_r
+ fun:g_get_any_init_do
+ fun:g_get_user_name
+}