tests: added valgrind hook and also made symlinks for all the plugins to single folder
authorImran Zaman <imran.zaman@linux.intel.com>
Fri, 26 Apr 2013 12:22:20 +0000 (15:22 +0300)
committerImran Zaman <imran.zaman@linux.intel.com>
Fri, 26 Apr 2013 12:22:20 +0000 (15:22 +0300)
14 files changed:
Makefile.am
configure.ac
src/Makefile.am
src/plugins/Makefile.am
src/plugins/digest/Makefile.am
src/plugins/password/Makefile.am
src/plugins/ssotest/Makefile.am
test/Makefile.am
test/common/Makefile.am
test/daemon/Makefile.am
test/db/Makefile.am
test/plugins/Makefile.am
test/valgrind.supp [new file with mode: 0644]
test/valgrind_common.mk [new file with mode: 0644]

index c0702c5..23411d7 100644 (file)
@@ -5,3 +5,5 @@ pkgconfig_DATA = gsignond.pc
 
 SUBDIRS = src test
 
+valgrind:
+       cd test; make valgrind
index b7b4ab5..2c7dc4f 100644 (file)
@@ -8,7 +8,7 @@ AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
-AM_INIT_AUTOMAKE([1.11 -Wall nostdinc silent-rules subdir-objects])
+AM_INIT_AUTOMAKE([1.11 nostdinc silent-rules subdir-objects -Wno-portability])
 
 # Checks for programs.
 AC_PROG_CC
index 236aae9..3800c38 100644 (file)
@@ -1 +1,2 @@
 SUBDIRS=common daemon extensions plugins
+
index 0d23ac6..e8b814a 100644 (file)
@@ -1 +1,6 @@
-SUBDIRS=password ssotest digest
+SUBDIRS=. password ssotest digest
+
+all-local: createlibs
+
+createlibs:
+       $(MKDIR_P) .libs
index d052aab..c7e45f8 100644 (file)
@@ -18,4 +18,8 @@ libdigest_la_SOURCES = \
     gsignond-digest-plugin.c \
     $(NULL)
 
-CLEANFILES = 
+all-local: slink
+
+slink:
+       ln -sf $(top_builddir)/src/plugins/digest/.libs/libdigest.so ../.libs/libdigest.so
+
index 770d4b6..834e961 100644 (file)
@@ -18,4 +18,7 @@ libpassword_la_SOURCES = \
     gsignond-password-plugin.c \
     $(NULL)
 
-CLEANFILES = 
+all-local: slink
+
+slink:
+       ln -sf $(top_builddir)/src/plugins/password/.libs/libpassword.so ../.libs/libpassword.so
index a2a930d..f2a9297 100644 (file)
@@ -18,4 +18,9 @@ libssotest_la_SOURCES = \
     gsignond-ssotest-plugin.c \
     $(NULL)
 
-CLEANFILES = 
+all-local: slink
+
+slink:
+       ln -sf $(top_builddir)/src/plugins/ssotest/.libs/libssotest.so ../.libs/libssotest.so
+    
+
index b6b6c1e..1bd0f7b 100644 (file)
@@ -1 +1,7 @@
-SUBDIRS = common daemon db plugins
+SUBDIRS=common daemon db plugins
+
+VALGRIND_TESTS_DISABLE=
+valgrind: $(SUBDIRS)
+       for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(SUBDIRS)); do \
+               cd $$t; $(MAKE) valgrind; \
+       done;
index 2030a50..e940f71 100644 (file)
@@ -1,5 +1,7 @@
 TESTS = commontest
-TESTS_ENVIRONMENT= SSO_PLUGINS_DIR=$(top_builddir)/src/plugins/password/.libs
+TESTS_ENVIRONMENT=
+VALGRIND_TESTS_DISABLE=
+include $(top_srcdir)/test/valgrind_common.mk
 
 check_PROGRAMS = commontest
 commontest_SOURCES = commontest.c
@@ -11,4 +13,4 @@ commontest_CFLAGS = \
 commontest_LDADD = \
     $(top_builddir)/src/common/libgsignond-common.la \
     $(GSIGNOND_LIBS) \
-    $(CHECK_LIBS)
\ No newline at end of file
+    $(CHECK_LIBS)
index 9d94f17..8acf902 100644 (file)
@@ -3,6 +3,10 @@ TESTS = daemontest
 else
 TESTS = test-daemon-setup.sh
 endif
+TESTS_ENVIRONMENT=
+VALGRIND_TESTS_DISABLE=
+include $(top_srcdir)/test/valgrind_common.mk
+
 check_PROGRAMS = daemontest
 
 daemontest_SOURCES = daemon-test.c
@@ -24,3 +28,4 @@ daemontest_LDADD = \
     $(CHECK_LIBS)
 
 EXTRA_DIST = "$(top_builddir)/test/daemon/services/com.google.code.AccountsSSO.SingleSignOn.service.in"
+
index 6218b09..7397f0e 100644 (file)
@@ -1,4 +1,8 @@
 TESTS = dbtest
+TESTS_ENVIRONMENT=
+VALGRIND_TESTS_DISABLE=
+include $(top_srcdir)/test/valgrind_common.mk
+
 check_PROGRAMS = dbtest
 dbtest_SOURCES = dbtest.c
 dbtest_CFLAGS = \
@@ -11,4 +15,4 @@ dbtest_LDADD = \
     $(top_builddir)/src/common/libgsignond-common.la \
     $(top_builddir)/src/daemon/db/libgsignond-db.la \
     $(GSIGNOND_LIBS) \
-    $(CHECK_LIBS)
\ No newline at end of file
+    $(CHECK_LIBS)
index 897180b..0761d5e 100644 (file)
@@ -1,6 +1,8 @@
 TESTS = digestplugintest passwordplugintest pluginproxytest
-TESTS_ENVIRONMENT= SSO_PLUGINS_DIR=$(top_builddir)/src/plugins/password/.libs
-
+TESTS_ENVIRONMENT= SSO_PLUGINS_DIR=$(top_builddir)/src/plugins/.libs
+VALGRIND_TESTS_DISABLE =
+include $(top_srcdir)/test/valgrind_common.mk
+    
 check_PROGRAMS = digestplugintest passwordplugintest pluginproxytest
 digestplugintest_SOURCES = digestplugintest.c
 digestplugintest_CFLAGS = \
@@ -40,4 +42,6 @@ pluginproxytest_LDADD = \
     $(top_builddir)/src/daemon/plugins/libgsignond-plugins.la \
     $(GSIGNOND_LIBS) \
     $(CHECK_LIBS)
-    
+
+
+
diff --git a/test/valgrind.supp b/test/valgrind.supp
new file mode 100644 (file)
index 0000000..e791e62
--- /dev/null
@@ -0,0 +1,56 @@
+{
+<insert_a_suppression_name_here>
+Memcheck:Leak
+...
+fun:g_type_init_with_debug_flags
+}
+{
+<insert_a_suppression_name_here>
+Memcheck:Leak
+fun:malloc
+fun:getdelim
+fun:init_lib
+fun:call_init
+fun:_dl_init
+obj:/lib64/ld-2.15.so
+}
+{
+<insert_a_suppression_name_here>
+Memcheck:Leak
+fun:malloc
+...
+fun:g_type_add_interface_static
+}
+{
+<insert_a_suppression_name_here>
+Memcheck:Leak
+fun:malloc
+...
+fun:g_type_add_interface_dynamic
+}
+{
+<insert_a_suppression_name_here>
+Memcheck:Leak
+...
+fun:g_type_register_static
+}
+{
+<insert_a_suppression_name_here>
+Memcheck:Leak
+...
+fun:g_type_register_dynamic
+}
+{
+<insert_a_suppression_name_here>
+Memcheck:Leak
+...
+fun:g_type_class_ref
+}
+{
+<insert_a_suppression_name_here>
+Memcheck:Leak
+...
+fun:g_resolver_lookup_by_name_async
+}
+
+
diff --git a/test/valgrind_common.mk b/test/valgrind_common.mk
new file mode 100644 (file)
index 0000000..585928a
--- /dev/null
@@ -0,0 +1,21 @@
+SUPPRESSIONS = $(top_srcdir)/test/valgrind.supp
+
+%.valgrind: %
+       @$(TESTS_ENVIRONMENT) \
+       CK_FORK=no \
+       CK_DEFAULT_TIMEOUT=120 \
+       G_SLICE=always-malloc \
+       $(LIBTOOL) --mode=execute \
+       valgrind -q \
+       $(foreach s,$(SUPPRESSIONS),--suppressions=$(s)) \
+       --tool=memcheck --leak-check=full --trace-children=yes \
+       --leak-resolution=high --num-callers=20 \
+       --error-exitcode=1 \
+       ./$*
+
+valgrind: $(TESTS)
+       for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
+               $(MAKE) $$t.valgrind; \
+       done;
+
+