[folks] Added valgrind support in make check.



commit 5f6b4ee0522dfbac090838498f50b93bbaf2e8c6
Author: Eitan Isaacson <eitan monotonous org>
Date:   Wed Jan 12 22:51:12 2011 +0200

    Added valgrind support in make check.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=639366

 tests/folks/Makefile.am                         |    1 +
 tests/folks/aggregation.vala                    |   14 +++++++++-----
 tests/key-file/Makefile.am                      |    1 +
 tests/key-file/individual-retrieval.vala        |    8 ++++++--
 tests/telepathy/Makefile.am                     |    1 +
 tests/telepathy/individual-properties.vala      |   10 +++++++---
 tests/telepathy/individual-retrieval.vala       |    8 ++++++--
 tests/telepathy/persona-store-capabilities.vala |    6 +++++-
 valgrind.mk                                     |   18 ++++++++++++++++++
 9 files changed, 54 insertions(+), 13 deletions(-)
---
diff --git a/tests/folks/Makefile.am b/tests/folks/Makefile.am
index fddbbaa..dd96a8d 100644
--- a/tests/folks/Makefile.am
+++ b/tests/folks/Makefile.am
@@ -79,3 +79,4 @@ EXTRA_DIST = \
 	$(NULL)
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/valgrind.mk
diff --git a/tests/folks/aggregation.vala b/tests/folks/aggregation.vala
index 2eed177..10ab3df 100644
--- a/tests/folks/aggregation.vala
+++ b/tests/folks/aggregation.vala
@@ -8,6 +8,7 @@ public class AggregationTests : Folks.TestCase
   private TpTest.Backend _tp_backend;
   private HashSet<string> _default_individuals;
   private string _individual_id_prefix = "telepathy:protocol:";
+  private int _test_timeout = 3;
 
   public AggregationTests ()
     {
@@ -36,6 +37,9 @@ public class AggregationTests : Folks.TestCase
           this.test_linkable_properties_different_stores);
       this.add_test ("user", this.test_user);
       this.add_test ("untrusted store", this.test_untrusted_store);
+
+      if (Environment.get_variable ("FOLKS_TEST_VALGRIND") != null)
+          this._test_timeout = 10;
     }
 
   public override void set_up ()
@@ -114,7 +118,7 @@ public class AggregationTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If there are still individuals
        * in the set of expected individuals, the aggregator has either failed or
        * been too slow (which we can consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
@@ -231,7 +235,7 @@ public class AggregationTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If there are still individuals
        * in the set of expected individuals, the aggregator has either failed or
        * been too slow (which we can consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
@@ -404,7 +408,7 @@ public class AggregationTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If there are still individuals
        * in the set of expected individuals, the aggregator has either failed or
        * been too slow (which we can consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
@@ -519,7 +523,7 @@ public class AggregationTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If there are still individuals
        * in the set of expected individuals, the aggregator has either failed or
        * been too slow (which we can consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
@@ -605,7 +609,7 @@ public class AggregationTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If there are still individuals
        * in the set of expected individuals, the aggregator has either failed or
        * been too slow (which we can consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
diff --git a/tests/key-file/Makefile.am b/tests/key-file/Makefile.am
index ba79962..4df1f2a 100644
--- a/tests/key-file/Makefile.am
+++ b/tests/key-file/Makefile.am
@@ -62,3 +62,4 @@ EXTRA_DIST = \
 	$(NULL)
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/valgrind.mk
diff --git a/tests/key-file/individual-retrieval.vala b/tests/key-file/individual-retrieval.vala
index f385689..531f636 100644
--- a/tests/key-file/individual-retrieval.vala
+++ b/tests/key-file/individual-retrieval.vala
@@ -5,6 +5,7 @@ using KfTest;
 public class IndividualRetrievalTests : Folks.TestCase
 {
   private KfTest.Backend kf_backend;
+  private int _test_timeout = 3;
 
   public IndividualRetrievalTests ()
     {
@@ -14,6 +15,9 @@ public class IndividualRetrievalTests : Folks.TestCase
 
       this.add_test ("singleton individuals", this.test_singleton_individuals);
       this.add_test ("aliases", this.test_aliases);
+
+      if (Environment.get_variable ("FOLKS_TEST_VALGRIND") != null)
+          this._test_timeout = 10;
     }
 
   public override void set_up ()
@@ -61,7 +65,7 @@ public class IndividualRetrievalTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If there are still individuals
        * in the set of expected individuals, the aggregator has either failed
        * or been too slow (which we can consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
@@ -101,7 +105,7 @@ public class IndividualRetrievalTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If there are still individuals
        * in the set of expected individuals, the aggregator has either failed
        * or been too slow (which we can consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
diff --git a/tests/telepathy/Makefile.am b/tests/telepathy/Makefile.am
index f94c9f3..4d1c562 100644
--- a/tests/telepathy/Makefile.am
+++ b/tests/telepathy/Makefile.am
@@ -96,3 +96,4 @@ EXTRA_DIST = \
 	$(NULL)
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/valgrind.mk
diff --git a/tests/telepathy/individual-properties.vala b/tests/telepathy/individual-properties.vala
index 3b7c661..30e4cb0 100644
--- a/tests/telepathy/individual-properties.vala
+++ b/tests/telepathy/individual-properties.vala
@@ -10,6 +10,7 @@ public class IndividualPropertiesTests : Folks.TestCase
   private TpTest.Backend tp_backend;
   private void* _account_handle;
   private string individual_id_prefix = "telepathy:protocol:";
+  private int _test_timeout = 3;
 
   public IndividualPropertiesTests ()
     {
@@ -23,6 +24,9 @@ public class IndividualPropertiesTests : Folks.TestCase
           this.test_individual_properties_change_alias_through_tp_backend);
       this.add_test ("individual properties:change alias through test cm",
           this.test_individual_properties_change_alias_through_test_cm);
+
+      if (Environment.get_variable ("FOLKS_TEST_VALGRIND") != null)
+          this._test_timeout = 10;
     }
 
   public override void set_up ()
@@ -73,7 +77,7 @@ public class IndividualPropertiesTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If there are still individuals
        * in the set of expected individuals, the aggregator has either failed
        * or been too slow (which we can consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
@@ -134,7 +138,7 @@ public class IndividualPropertiesTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If the alias hasn't been
        * notified, something along the way failed or been too slow (which we can
        * consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
@@ -198,7 +202,7 @@ public class IndividualPropertiesTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If the alias hasn't been
        * notified, something along the way failed or been too slow (which we can
        * consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
diff --git a/tests/telepathy/individual-retrieval.vala b/tests/telepathy/individual-retrieval.vala
index d39ccb2..5e652b1 100644
--- a/tests/telepathy/individual-retrieval.vala
+++ b/tests/telepathy/individual-retrieval.vala
@@ -11,6 +11,7 @@ public class IndividualRetrievalTests : Folks.TestCase
   private void* _account_handle;
   private HashSet<string> default_individuals;
   private string individual_id_prefix = "telepathy:protocol:";
+  private int _test_timeout = 3;
 
   public IndividualRetrievalTests ()
     {
@@ -33,6 +34,9 @@ public class IndividualRetrievalTests : Folks.TestCase
 
       this.add_test ("aggregator", this.test_aggregator);
       this.add_test ("aggregator:add", this.test_aggregator_add);
+
+      if (Environment.get_variable ("FOLKS_TEST_VALGRIND") != null)
+          this._test_timeout = 10;
     }
 
   public override void set_up ()
@@ -70,7 +74,7 @@ public class IndividualRetrievalTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If there are still individuals
        * in the set of expected individuals, the aggregator has either failed or
        * been too slow (which we can consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
@@ -140,7 +144,7 @@ public class IndividualRetrievalTests : Folks.TestCase
       /* Kill the main loop after a few seconds. If there are still individuals
        * in the set of expected individuals, the aggregator has either failed or
        * been too slow (which we can consider to be failure). */
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
diff --git a/tests/telepathy/persona-store-capabilities.vala b/tests/telepathy/persona-store-capabilities.vala
index 4f6f392..38a5c2c 100644
--- a/tests/telepathy/persona-store-capabilities.vala
+++ b/tests/telepathy/persona-store-capabilities.vala
@@ -10,6 +10,7 @@ public class PersonaStoreCapabilitiesTests : Folks.TestCase
   private TpTest.Backend tp_backend;
   private void* _account_handle;
   private HashSet<string> group_flags_received;
+  private int _test_timeout = 3;
 
   public PersonaStoreCapabilitiesTests ()
     {
@@ -19,6 +20,9 @@ public class PersonaStoreCapabilitiesTests : Folks.TestCase
 
       this.add_test ("persona store capabilities",
           this.test_persona_store_capabilities);
+
+      if (Environment.get_variable ("FOLKS_TEST_VALGRIND") != null)
+          this._test_timeout = 10;
     }
 
   public override void set_up ()
@@ -61,7 +65,7 @@ public class PersonaStoreCapabilitiesTests : Folks.TestCase
 
       backend_store.load_backends ();
 
-      Timeout.add_seconds (3, () =>
+      Timeout.add_seconds (this._test_timeout, () =>
         {
           main_loop.quit ();
           return false;
diff --git a/valgrind.mk b/valgrind.mk
new file mode 100644
index 0000000..5e365bb
--- /dev/null
+++ b/valgrind.mk
@@ -0,0 +1,18 @@
+check: $(TESTS)
+	if test -n "$$FOLKS_TEST_VALGRIND"; then \
+		G_DEBUG=${G_DEBUG:+"${G_DEBUG},"}gc-friendly; \
+		G_SLICE=${G_SLICE},always-malloc; \
+		$(MAKE) \
+			TESTS_ENVIRONMENT="$(TESTS_ENVIRONMENT) \
+			libtool --mode=execute valgrind \
+					--leak-check=full \
+					--show-reachable=no \
+					--gen-suppressions=all \
+					--num-callers=20 \
+					--error-exitcode=0 \
+					--log-file=valgrind.log.%p" \
+			check-TESTS; \
+	else \
+		$(MAKE) check-TESTS; \
+	fi
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]