[folks] Don't set a timeout for contacts adding stress test



commit 5beccf217070b20abccb8485b44ca6b4fcc02af4
Author: Raul Gutierrez Segales <rgs collabora co uk>
Date:   Wed Aug 3 10:13:42 2011 +0100

    Don't set a timeout for contacts adding stress test
    
    Helps: https://bugzilla.gnome.org/show_bug.cgi?id=655008

 tests/eds/add-contacts-stress-test.vala |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/tests/eds/add-contacts-stress-test.vala b/tests/eds/add-contacts-stress-test.vala
index b850ef3..0d530d8 100644
--- a/tests/eds/add-contacts-stress-test.vala
+++ b/tests/eds/add-contacts-stress-test.vala
@@ -29,7 +29,8 @@ public class AddContactsStressTestTests : Folks.TestCase
   private Edsf.PersonaStore _pstore;
   private bool _added_contacts = false;
   private HashTable<string, bool> _contacts_found;
-  private int _contacts_cnt = 150;
+  private int _contacts_cnt = 1000;
+  private DateTime _start_time;
 
   public AddContactsStressTestTests ()
     {
@@ -56,23 +57,25 @@ public class AddContactsStressTestTests : Folks.TestCase
     {
       this._main_loop = new GLib.MainLoop (null, false);
 
-     this._contacts_found = new HashTable<string, bool> (str_hash, str_equal);
-     for (var i=0; i<this._contacts_cnt; i++)
-       {
-         var persona_name = "full_name -%d".printf (i);
-         this._contacts_found.insert (persona_name, false);
-       }
+      this._contacts_found = new HashTable<string, bool> (str_hash, str_equal);
+      for (var i = 0; i < this._contacts_cnt; i++)
+        {
+          var persona_name = "full_name -%d".printf (i);
+          this._contacts_found.insert (persona_name, false);
+        }
 
-      this._test_add_persona_async ();
+      this._start_time = new DateTime.now_utc ();
 
-      Timeout.add_seconds (5, () =>
-        {
-          this._main_loop.quit ();
-          assert_not_reached ();
-        });
+      this._test_add_persona_async ();
 
       this._main_loop.run ();
 
+      var now = new DateTime.now_utc ();
+      var difference = now.difference (this._start_time);
+
+      int diff = difference / TimeSpan.SECOND;
+      GLib.stdout.printf ("(Elapsed time: %d secs) ", diff);
+
       int found = 0;
       foreach (var k in this._contacts_found.get_values ())
         {



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