[evolution-data-server/treitter-test-suites] Make tests silent by default.



commit ebd7fff1b59b7e0dbe160a5dba4d1e8084c3afc3
Author: Travis Reitter <treitter gmail com>
Date:   Tue Dec 29 15:29:22 2009 -0800

    Make tests silent by default.

 addressbook/tests/ebook/ebook-test-utils.c         |   50 +++++++++---
 addressbook/tests/ebook/ebook-test-utils.h         |    4 +
 addressbook/tests/ebook/test-ebook-add-contact.c   |    2 +-
 .../tests/ebook/test-ebook-commit-contact.c        |    2 +-
 addressbook/tests/ebook/test-ebook-get-book-view.c |   14 ++--
 addressbook/tests/ebook/test-ebook-get-contact.c   |    2 +-
 .../tests/ebook/test-ebook-get-required-fields.c   |   12 ++--
 .../ebook/test-ebook-get-static-capabilities.c     |    2 +-
 .../ebook/test-ebook-get-supported-auth-methods.c  |   12 ++--
 .../tests/ebook/test-ebook-get-supported-fields.c  |   12 ++--
 .../tests/ebook/test-ebook-remove-contact.c        |    2 +-
 .../tests/ebook/test-ebook-remove-contacts.c       |    2 +-
 calendar/tests/ecal/ecal-test-utils.c              |   79 +++++++++++++-------
 calendar/tests/ecal/ecal-test-utils.h              |    4 +
 .../tests/ecal/test-ecal-get-alarm-email-address.c |    2 +-
 calendar/tests/ecal/test-ecal-get-cal-address.c    |    2 +-
 calendar/tests/ecal/test-ecal-get-default-object.c |    2 +-
 calendar/tests/ecal/test-ecal-get-ldap-attribute.c |    2 +-
 calendar/tests/ecal/test-ecal-get-query.c          |    8 +-
 19 files changed, 135 insertions(+), 80 deletions(-)
---
diff --git a/addressbook/tests/ebook/ebook-test-utils.c b/addressbook/tests/ebook/ebook-test-utils.c
index 5717303..66c73cc 100644
--- a/addressbook/tests/ebook/ebook-test-utils.c
+++ b/addressbook/tests/ebook/ebook-test-utils.c
@@ -7,6 +7,30 @@
 
 #include "ebook-test-utils.h"
 
+void
+test_print (const char *format,
+	    ...)
+{
+	va_list args;
+	const char *debug_string;
+	static gboolean debug_set = FALSE;
+	static gboolean debug = FALSE;
+
+	if (!debug_set) {
+		debug_string = g_getenv ("EDS_TEST_DEBUG");
+		if (debug_string) {
+			debug = (g_ascii_strtoll (debug_string, NULL, 10) >= 1);
+		}
+		debug_set = TRUE;
+	}
+
+	if (debug) {
+		va_start (args, format);
+		vprintf (format, args);
+		va_end (args);
+	}
+}
+
 gboolean
 ebook_test_utils_callback_quit (gpointer user_data)
 {
@@ -117,7 +141,7 @@ add_contact_cb (EBook            *book,
                 exit (1);
         }
 
-        g_print ("successfully asynchronously added the contact "
+        test_print ("successfully asynchronously added the contact "
                         "addressbook\n");
         if (closure) {
                 (*closure->cb) (closure);
@@ -172,7 +196,7 @@ commit_contact_cb (EBook            *book,
                 exit (1);
         }
 
-        g_print ("successfully asynchronously committed the contact to the "
+        test_print ("successfully asynchronously committed the contact to the "
                         "addressbook\n");
         if (closure) {
                 (*closure->cb) (closure);
@@ -232,7 +256,7 @@ get_contact_cb (EBook            *book,
         }
 
         uid = e_contact_get_const (contact, E_CONTACT_UID);
-        g_print ("successfully asynchronously retrieved the contact '%s'\n",
+        test_print ("successfully asynchronously retrieved the contact '%s'\n",
                         uid);
 
         if (closure) {
@@ -292,7 +316,7 @@ get_required_fields_cb (EBook            *book,
 
         closure->list = fields;
 
-        g_print ("successfully asynchronously retrieved the required fields\n");
+        test_print ("successfully asynchronously retrieved the required fields\n");
 
         if (closure) {
                 (*closure->cb) (closure);
@@ -368,7 +392,7 @@ get_supported_auth_methods_cb (EBook            *book,
 
         closure->list = methods;
 
-        g_print ("successfully asynchronously retrieved the supported auth "
+        test_print ("successfully asynchronously retrieved the supported auth "
                         "methods\n");
 
         if (closure) {
@@ -427,7 +451,7 @@ get_supported_fields_cb (EBook            *book,
 
         closure->list = fields;
 
-        g_print ("successfully asynchronously retrieved the supported fields\n");
+        test_print ("successfully asynchronously retrieved the supported fields\n");
 
         if (closure) {
                 (*closure->cb) (closure);
@@ -480,7 +504,7 @@ remove_contact_cb (EBook            *book,
                 exit (1);
         }
 
-        g_print ("successfully asynchronously removed the contact\n");
+        test_print ("successfully asynchronously removed the contact\n");
 
         if (closure) {
                 (*closure->cb) (closure);
@@ -518,7 +542,7 @@ remove_contact_by_id_cb (EBook            *book,
                 exit (1);
         }
 
-        g_print ("successfully asynchronously removed the contact by id\n");
+        test_print ("successfully asynchronously removed the contact by id\n");
 
         if (closure) {
                 (*closure->cb) (closure);
@@ -572,7 +596,7 @@ remove_contacts_cb (EBook            *book,
                 exit (1);
         }
 
-        g_print ("successfully asynchronously removed the contacts\n");
+        test_print ("successfully asynchronously removed the contacts\n");
 
         if (closure) {
                 (*closure->cb) (closure);
@@ -620,7 +644,7 @@ ebook_test_utils_book_new_temp (char **uri)
 	g_free (file_template);
 
 	/* create a temp addressbook in /tmp */
-	g_print ("loading addressbook\n");
+	test_print ("loading addressbook\n");
 	book = e_book_new_from_uri (uri_result, &error);
 	if (!book) {
                 g_warning ("failed to create addressbook: `%s': %s", *uri,
@@ -662,7 +686,7 @@ ebook_test_utils_book_remove (EBook *book)
                 g_warning ("failed to remove book; %s\n", error->message);
                 exit(1);
         }
-        g_print ("successfully removed the temporary addressbook\n");
+        test_print ("successfully removed the temporary addressbook\n");
 
         g_object_unref (book);
 }
@@ -676,7 +700,7 @@ remove_cb (EBook *book, EBookStatus status, EBookTestClosure *closure)
                 exit (1);
         }
 
-        g_print ("successfully asynchronously removed the temporary "
+        test_print ("successfully asynchronously removed the temporary "
                         "addressbook\n");
         if (closure)
                 (*closure->cb) (closure);
@@ -730,7 +754,7 @@ get_book_view_cb (EBook            *book,
 
         closure->view = view;
 
-        g_print ("successfully asynchronously retrieved the book view\n");
+        test_print ("successfully asynchronously retrieved the book view\n");
         if (closure)
                 (*closure->cb) (closure);
 }
diff --git a/addressbook/tests/ebook/ebook-test-utils.h b/addressbook/tests/ebook/ebook-test-utils.h
index a22eb04..5cb36b7 100644
--- a/addressbook/tests/ebook/ebook-test-utils.h
+++ b/addressbook/tests/ebook/ebook-test-utils.h
@@ -35,6 +35,10 @@ typedef struct {
 	EList       *list;
 } EBookTestClosure;
 
+void
+test_print (const char *format,
+	    ...);
+
 gboolean
 ebook_test_utils_callback_quit (gpointer user_data);
 
diff --git a/addressbook/tests/ebook/test-ebook-add-contact.c b/addressbook/tests/ebook/test-ebook-add-contact.c
index 5d0b887..37c587a 100644
--- a/addressbook/tests/ebook/test-ebook-add-contact.c
+++ b/addressbook/tests/ebook/test-ebook-add-contact.c
@@ -28,7 +28,7 @@ main (gint argc, gchar **argv)
 	 */
 	uid = ebook_test_utils_book_add_contact_from_test_case_verify (book, "simple-1", &contact_final);
 
-	g_print ("successfully added and retrieved contact '%s'\n", uid);
+	test_print ("successfully added and retrieved contact '%s'\n", uid);
 	g_object_unref (contact_final);
 
 	ebook_test_utils_book_remove (book);
diff --git a/addressbook/tests/ebook/test-ebook-commit-contact.c b/addressbook/tests/ebook/test-ebook-commit-contact.c
index fe181e8..b057980 100644
--- a/addressbook/tests/ebook/test-ebook-commit-contact.c
+++ b/addressbook/tests/ebook/test-ebook-commit-contact.c
@@ -69,7 +69,7 @@ main (gint argc, gchar **argv)
 
 	verify_commit (contact);
 
-	g_print ("successfully committed changes to contact contact '%s'\n", uid);
+	test_print ("successfully committed changes to contact contact '%s'\n", uid);
 	g_object_unref (contact);
 	g_free (uid);
 
diff --git a/addressbook/tests/ebook/test-ebook-get-book-view.c b/addressbook/tests/ebook/test-ebook-get-book-view.c
index 1caffad..064364a 100644
--- a/addressbook/tests/ebook/test-ebook-get-book-view.c
+++ b/addressbook/tests/ebook/test-ebook-get-book-view.c
@@ -12,18 +12,18 @@ print_contact (EContact *contact)
 {
 	GList *emails, *e;
 
-	g_print ("Contact: %s\n", (gchar *)e_contact_get_const (contact, E_CONTACT_FULL_NAME));
-	g_print ("UID: %s\n", (gchar *)e_contact_get_const (contact, E_CONTACT_UID));
-	g_print ("Email addresses:\n");
+	test_print ("Contact: %s\n", (gchar *)e_contact_get_const (contact, E_CONTACT_FULL_NAME));
+	test_print ("UID: %s\n", (gchar *)e_contact_get_const (contact, E_CONTACT_UID));
+	test_print ("Email addresses:\n");
 
 	emails = e_contact_get (contact, E_CONTACT_EMAIL);
 	for (e = emails; e; e = e->next) {
-		g_print ("\t%s\n",  (gchar *)e->data);
+		test_print ("\t%s\n",  (gchar *)e->data);
 	}
 	g_list_foreach (emails, (GFunc)g_free, NULL);
 	g_list_free (emails);
 
-	g_print ("\n");
+	test_print ("\n");
 }
 
 static void
@@ -42,7 +42,7 @@ contacts_removed (EBookView *book_view, const GList *ids)
 	GList *l;
 
 	for (l = (GList*)ids; l; l = l->next) {
-		g_print ("Removed contact: %s\n", (gchar *)l->data);
+		test_print ("Removed contact: %s\n", (gchar *)l->data);
 	}
 }
 
@@ -104,7 +104,7 @@ main (gint argc, gchar **argv)
 	ebook_test_utils_book_get_book_view (book, query, &view);
 	setup_and_start_view (view);
 
-	g_print ("successfully set up the book view\n");
+	test_print ("successfully set up the book view\n");
 
 	loop = g_main_loop_new (NULL, TRUE);
 	g_main_loop_run (loop);
diff --git a/addressbook/tests/ebook/test-ebook-get-contact.c b/addressbook/tests/ebook/test-ebook-get-contact.c
index 9adcfcb..7c81536 100644
--- a/addressbook/tests/ebook/test-ebook-get-contact.c
+++ b/addressbook/tests/ebook/test-ebook-get-contact.c
@@ -26,7 +26,7 @@ main (gint argc, gchar **argv)
 	 */
 	uid = ebook_test_utils_book_add_contact_from_test_case_verify (book, "simple-1", &contact_final);
 
-	g_print ("successfully added and retrieved contact '%s'\n", uid);
+	test_print ("successfully added and retrieved contact '%s'\n", uid);
 	g_object_unref (contact_final);
 
 	/*
diff --git a/addressbook/tests/ebook/test-ebook-get-required-fields.c b/addressbook/tests/ebook/test-ebook-get-required-fields.c
index 4f4d744..a5f7aea 100644
--- a/addressbook/tests/ebook/test-ebook-get-required-fields.c
+++ b/addressbook/tests/ebook/test-ebook-get-required-fields.c
@@ -9,7 +9,7 @@ static void
 list_member_print_and_free (char     *member,
 		            gpointer  user_data)
 {
-	g_print ("    %s\n", member);
+	test_print ("    %s\n", member);
 	g_free (member);
 }
 
@@ -22,13 +22,13 @@ get_required_fields_cb (EBookTestClosure *closure)
 		EIterator *iter;
 		const char *field;
 
-		g_print ("required fields:\n");
+		test_print ("required fields:\n");
 		iter = e_list_get_iterator (closure->list);
 		while ((field = e_iterator_get (iter))) {
-			g_print ("    %s\n", field);
+			test_print ("    %s\n", field);
 			e_iterator_next (iter);
 		}
-		g_print ("----------------\n");
+		test_print ("----------------\n");
 	}
 
 	g_object_unref (closure->list);
@@ -56,9 +56,9 @@ main (gint argc, gchar **argv)
 	 */
 	fields = ebook_test_utils_book_get_required_fields (book);
 
-	g_print ("successfully retrieved required fields:\n");
+	test_print ("successfully retrieved required fields:\n");
 	g_list_foreach (fields, (GFunc) list_member_print_and_free, NULL);
-	g_print ("----------------\n");
+	test_print ("----------------\n");
 	g_list_free (fields);
 
 	/*
diff --git a/addressbook/tests/ebook/test-ebook-get-static-capabilities.c b/addressbook/tests/ebook/test-ebook-get-static-capabilities.c
index ccc0ea6..3e42eb5 100644
--- a/addressbook/tests/ebook/test-ebook-get-static-capabilities.c
+++ b/addressbook/tests/ebook/test-ebook-get-static-capabilities.c
@@ -24,7 +24,7 @@ main (gint argc, gchar **argv)
 	 */
 	caps = ebook_test_utils_book_get_static_capabilities (book);
 
-	g_print ("successfully retrieved static capabilities: '%s'\n", caps);
+	test_print ("successfully retrieved static capabilities: '%s'\n", caps);
 
 	ebook_test_utils_book_remove (book);
 
diff --git a/addressbook/tests/ebook/test-ebook-get-supported-auth-methods.c b/addressbook/tests/ebook/test-ebook-get-supported-auth-methods.c
index d557b95..db668e1 100644
--- a/addressbook/tests/ebook/test-ebook-get-supported-auth-methods.c
+++ b/addressbook/tests/ebook/test-ebook-get-supported-auth-methods.c
@@ -9,7 +9,7 @@ static void
 list_member_print_and_free (char     *member,
 		            gpointer  user_data)
 {
-	g_print ("    %s\n", member);
+	test_print ("    %s\n", member);
 	g_free (member);
 }
 
@@ -22,13 +22,13 @@ get_supported_auth_methods_cb (EBookTestClosure *closure)
 		EIterator *iter;
 		const char *field;
 
-		g_print ("supported auth methods:\n");
+		test_print ("supported auth methods:\n");
 		iter = e_list_get_iterator (closure->list);
 		while ((field = e_iterator_get (iter))) {
-			g_print ("    %s\n", field);
+			test_print ("    %s\n", field);
 			e_iterator_next (iter);
 		}
-		g_print ("----------------\n");
+		test_print ("----------------\n");
 	}
 
 	g_object_unref (closure->list);
@@ -56,9 +56,9 @@ main (gint argc, gchar **argv)
 	 */
 	auth_methods = ebook_test_utils_book_get_supported_auth_methods (book);
 
-	g_print ("successfully retrieved supported auth methods:\n");
+	test_print ("successfully retrieved supported auth methods:\n");
 	g_list_foreach (auth_methods, (GFunc) list_member_print_and_free, NULL);
-	g_print ("----------------\n");
+	test_print ("----------------\n");
 	g_list_free (auth_methods);
 
 	/*
diff --git a/addressbook/tests/ebook/test-ebook-get-supported-fields.c b/addressbook/tests/ebook/test-ebook-get-supported-fields.c
index 0eab176..584ae1c 100644
--- a/addressbook/tests/ebook/test-ebook-get-supported-fields.c
+++ b/addressbook/tests/ebook/test-ebook-get-supported-fields.c
@@ -9,7 +9,7 @@ static void
 list_member_print_and_free (char     *member,
 		            gpointer  user_data)
 {
-	g_print ("    %s\n", member);
+	test_print ("    %s\n", member);
 	g_free (member);
 }
 
@@ -22,13 +22,13 @@ get_supported_fields_cb (EBookTestClosure *closure)
 		EIterator *iter;
 		const char *field;
 
-		g_print ("supported fields:\n");
+		test_print ("supported fields:\n");
 		iter = e_list_get_iterator (closure->list);
 		while ((field = e_iterator_get (iter))) {
-			g_print ("    %s\n", field);
+			test_print ("    %s\n", field);
 			e_iterator_next (iter);
 		}
-		g_print ("----------------\n");
+		test_print ("----------------\n");
 	}
 
 	g_object_unref (closure->list);
@@ -56,9 +56,9 @@ main (gint argc, gchar **argv)
 	 */
 	fields = ebook_test_utils_book_get_supported_fields (book);
 
-	g_print ("successfully retrieved supported fields:\n");
+	test_print ("successfully retrieved supported fields:\n");
 	g_list_foreach (fields, (GFunc) list_member_print_and_free, NULL);
-	g_print ("----------------\n");
+	test_print ("----------------\n");
 	g_list_free (fields);
 
 	/*
diff --git a/addressbook/tests/ebook/test-ebook-remove-contact.c b/addressbook/tests/ebook/test-ebook-remove-contact.c
index a8ebd4e..8b77d27 100644
--- a/addressbook/tests/ebook/test-ebook-remove-contact.c
+++ b/addressbook/tests/ebook/test-ebook-remove-contact.c
@@ -29,7 +29,7 @@ main (gint argc, gchar **argv)
 	e_book_get_contact (book, uid, &contact_final, NULL);
 
         g_assert (contact_final == NULL);
-        g_print ("successfully added and removed contact '%s'\n", uid);
+        test_print ("successfully added and removed contact '%s'\n", uid);
 
         ebook_test_utils_book_remove (book);
         g_free (uid);
diff --git a/addressbook/tests/ebook/test-ebook-remove-contacts.c b/addressbook/tests/ebook/test-ebook-remove-contacts.c
index 1f9f401..658b4a9 100644
--- a/addressbook/tests/ebook/test-ebook-remove-contacts.c
+++ b/addressbook/tests/ebook/test-ebook-remove-contacts.c
@@ -37,7 +37,7 @@ main (gint argc, gchar **argv)
 	e_book_get_contact (book, uid_2, &contact_final, NULL);
         g_assert (contact_final == NULL);
 
-        g_print ("successfully added and removed contacts\n");
+        test_print ("successfully added and removed contacts\n");
 
         ebook_test_utils_book_remove (book);
         g_free (uid_1);
diff --git a/calendar/tests/ecal/ecal-test-utils.c b/calendar/tests/ecal/ecal-test-utils.c
index 7602c6d..2195db6 100644
--- a/calendar/tests/ecal/ecal-test-utils.c
+++ b/calendar/tests/ecal/ecal-test-utils.c
@@ -26,6 +26,29 @@
 
 #include "ecal-test-utils.h"
 
+void
+test_print (const char *format,
+	    ...)
+{
+	va_list args;
+	const char *debug_string;
+	static gboolean debug_set = FALSE;
+	static gboolean debug = FALSE;
+
+	if (!debug_set) {
+		debug_string = g_getenv ("EDS_TEST_DEBUG");
+		if (debug_string) {
+			debug = (g_ascii_strtoll (debug_string, NULL, 10) >= 1);
+		}
+		debug_set = TRUE;
+	}
+
+	if (debug) {
+		va_start (args, format);
+		vprintf (format, args);
+		va_end (args);
+	}
+}
 
 ECal*
 ecal_test_utils_cal_new_temp (char           **uri,
@@ -49,7 +72,7 @@ ecal_test_utils_cal_new_temp (char           **uri,
         g_free (file_template);
 
         /* create a temp calendar in /tmp */
-        g_print ("loading calendar\n");
+        test_print ("loading calendar\n");
         cal = e_cal_new_from_uri (uri_result, type);
         if (!cal) {
                 g_warning ("failed to create calendar: `%s'", *uri);
@@ -88,7 +111,7 @@ open_cb (ECal            *cal,
 {
 	if (FALSE) {
 	} else if (status == E_CALENDAR_STATUS_BUSY) {
-		g_print ("calendar server is busy; waiting...");
+		test_print ("calendar server is busy; waiting...");
 		return;
 	} else if (status != E_CALENDAR_STATUS_OK) {
                 g_warning ("failed to asynchronously remove the calendar: "
@@ -96,7 +119,7 @@ open_cb (ECal            *cal,
                 exit (1);
         }
 
-        g_print ("successfully asynchronously removed the temporary "
+        test_print ("successfully asynchronously removed the temporary "
                         "calendar\n");
         if (closure)
                 (*closure->cb) (closure);
@@ -130,7 +153,7 @@ ecal_test_utils_cal_remove (ECal *cal)
                 g_warning ("failed to remove calendar; %s\n", error->message);
                 exit(1);
         }
-        g_print ("successfully removed the temporary calendar\n");
+        test_print ("successfully removed the temporary calendar\n");
 
         g_object_unref (cal);
 }
@@ -145,7 +168,7 @@ ecal_test_utils_cal_get_alarm_email_address (ECal *cal)
                 g_warning ("failed to get alarm email address; %s\n", error->message);
                 exit(1);
         }
-        g_print ("successfully got the alarm email address\n");
+        test_print ("successfully got the alarm email address\n");
 
 	return address;
 }
@@ -160,7 +183,7 @@ ecal_test_utils_cal_get_cal_address (ECal *cal)
                 g_warning ("failed to get calendar address; %s\n", error->message);
                 exit(1);
         }
-        g_print ("successfully got the calendar address\n");
+        test_print ("successfully got the calendar address\n");
 
 	return address;
 }
@@ -175,7 +198,7 @@ ecal_test_utils_cal_get_ldap_attribute (ECal *cal)
                 g_warning ("failed to get ldap attribute; %s\n", error->message);
                 exit(1);
         }
-        g_print ("successfully got the ldap attribute\n");
+        test_print ("successfully got the ldap attribute\n");
 
 	return attr;
 }
@@ -189,8 +212,8 @@ b2s (gboolean value)
 void
 ecal_test_utils_cal_get_capabilities (ECal *cal)
 {
-        g_print ("calendar capabilities:\n");
-        g_print ("        One alarm only:                  %s\n"
+        test_print ("calendar capabilities:\n");
+        test_print ("        One alarm only:                  %s\n"
                  "        Organizers must attend meetings: %s\n"
                  "        Organizers must accept meetings: %s\n"
                  "        Master object for recurrences:   %s\n"
@@ -325,7 +348,7 @@ ecal_test_utils_cal_get_object (ECal       *cal,
                 g_warning ("retrieved icalcomponent is invalid\n");
                 exit(1);
         }
-        g_print ("successfully got the icalcomponent object '%s'\n", uid);
+        test_print ("successfully got the icalcomponent object '%s'\n", uid);
 
 	return component;
 }
@@ -345,7 +368,7 @@ ecal_test_utils_cal_modify_object (ECal          *cal,
                 g_warning ("failed to modify icalcomponent object; %s\n", error->message);
                 exit(1);
         }
-        g_print ("successfully modified the icalcomponent object\n");
+        test_print ("successfully modified the icalcomponent object\n");
 }
 
 void
@@ -358,7 +381,7 @@ ecal_test_utils_cal_remove_object (ECal       *cal,
                 g_warning ("failed to remove icalcomponent object '%s'; %s\n", uid, error->message);
                 exit(1);
         }
-        g_print ("successfully remoed the icalcomponent object '%s'\n", uid);
+        test_print ("successfully remoed the icalcomponent object '%s'\n", uid);
 }
 
 icalcomponent*
@@ -375,7 +398,7 @@ ecal_test_utils_cal_get_default_object (ECal *cal)
                 g_warning ("default icalcomponent is invalid\n");
                 exit(1);
         }
-        g_print ("successfully got the default icalcomponent object\n");
+        test_print ("successfully got the default icalcomponent object\n");
 
 	return component;
 }
@@ -391,7 +414,7 @@ ecal_test_utils_cal_get_object_list (ECal       *cal,
                 g_warning ("failed to get list of icalcomponent objects for query '%s'; %s\n", query, error->message);
                 exit(1);
         }
-        g_print ("successfully got list of icalcomponent objects for the query '%s'\n", query);
+        test_print ("successfully got list of icalcomponent objects for the query '%s'\n", query);
 
 	return objects;
 }
@@ -407,7 +430,7 @@ ecal_test_utils_cal_get_objects_for_uid (ECal       *cal,
                 g_warning ("failed to get icalcomponent objects for UID '%s'; %s\n", uid, error->message);
                 exit(1);
         }
-        g_print ("successfully got objects for the icalcomponent with UID '%s'\n", uid);
+        test_print ("successfully got objects for the icalcomponent with UID '%s'\n", uid);
 
 	return objects;
 }
@@ -431,7 +454,7 @@ ecal_test_utils_cal_create_object (ECal          *cal,
         }
 
 	ical_string = icalcomponent_as_ical_string (component);
-        g_print ("successfully created icalcomponent object '%s'\n%s\n", uid,
+        test_print ("successfully created icalcomponent object '%s'\n%s\n", uid,
 			ical_string);
 	g_free (ical_string);
 
@@ -446,7 +469,7 @@ cal_set_mode_cb (ECal            *cal,
 {
 	if (FALSE) {
 	} else if (status == E_CALENDAR_STATUS_BUSY) {
-		g_print ("calendar server is busy; waiting...");
+		test_print ("calendar server is busy; waiting...");
 		return;
 	} else if (status != E_CALENDAR_STATUS_OK) {
                 g_warning ("failed to asynchronously remove the calendar: "
@@ -456,7 +479,7 @@ cal_set_mode_cb (ECal            *cal,
 
 	closure->mode = mode;
 
-        g_print ("successfully set the calendar mode to %d\n", mode);
+        test_print ("successfully set the calendar mode to %d\n", mode);
         if (closure)
                 (*closure->cb) (closure);
 
@@ -543,7 +566,7 @@ ecal_test_utils_cal_get_timezone (ECal       *cal,
                 g_warning ("failed to get icaltimezone* for ID '%s'; %s\n", tzid, error->message);
                 exit(1);
         }
-        g_print ("successfully got icaltimezone* for ID '%s'\n", tzid);
+        test_print ("successfully got icaltimezone* for ID '%s'\n", tzid);
 
 	return zone;
 }
@@ -561,7 +584,7 @@ ecal_test_utils_cal_add_timezone (ECal         *cal,
                 g_warning ("failed to add icaltimezone '%s'; %s\n", name, error->message);
                 exit(1);
         }
-        g_print ("successfully added icaltimezone '%s'\n", name);
+        test_print ("successfully added icaltimezone '%s'\n", name);
 }
 
 void
@@ -577,7 +600,7 @@ ecal_test_utils_cal_set_default_timezone (ECal         *cal,
                 g_warning ("failed to set default icaltimezone '%s'; %s\n", name, error->message);
                 exit(1);
         }
-        g_print ("successfully set default icaltimezone '%s'\n", name);
+        test_print ("successfully set default icaltimezone '%s'\n", name);
 }
 
 GList*
@@ -594,14 +617,14 @@ ecal_test_utils_cal_get_free_busy (ECal   *cal,
 		g_error ("Test free/busy : Could not retrieve free busy information :  %s\n", error->message);
 	}
 	if (free_busy) {
-		g_print ("Printing free/busy information\n");
+		test_print ("Printing free/busy information\n");
 
 		for (l = free_busy; l; l = l->next) {
 			gchar *comp_string;
 			ECalComponent *comp = E_CAL_COMPONENT (l->data);
 
 			comp_string = e_cal_component_get_as_string (comp);
-			g_print ("%s\n", comp_string);
+			test_print ("%s\n", comp_string);
 			g_object_unref (comp);
 			g_free (comp_string);
 		}
@@ -625,13 +648,13 @@ ecal_test_utils_cal_send_objects (ECal           *cal,
 		g_error ("sending objects: %s\n", error->message);
 	}
 
-	g_print ("successfully sent the objects to the following users:\n");
+	test_print ("successfully sent the objects to the following users:\n");
 	if (g_list_length (*users) <= 0) {
-		g_print ("        (none)\n");
+		test_print ("        (none)\n");
 		return;
 	}
 	for (l = *users; l; l = l->next) {
-		g_print ("        %s\n", (const char*) l->data);
+		test_print ("        %s\n", (const char*) l->data);
 	}
 }
 
@@ -645,7 +668,7 @@ ecal_test_utils_cal_receive_objects (ECal          *cal,
 		g_error ("receiving objects: %s\n", error->message);
 	}
 
-	g_print ("successfully received the objects\n");
+	test_print ("successfully received the objects\n");
 }
 
 ECalView*
@@ -659,7 +682,7 @@ ecal_test_utils_get_query (ECal       *cal,
 		g_error (G_STRLOC ": Unable to obtain calendar view: %s\n",
 				error->message);
 	}
-	g_print ("successfully retrieved calendar view for query '%s'", sexp);
+	test_print ("successfully retrieved calendar view for query '%s'", sexp);
 
 	return query;
 }
diff --git a/calendar/tests/ecal/ecal-test-utils.h b/calendar/tests/ecal/ecal-test-utils.h
index 1f904b0..3a0d77b 100644
--- a/calendar/tests/ecal/ecal-test-utils.h
+++ b/calendar/tests/ecal/ecal-test-utils.h
@@ -31,6 +31,10 @@ typedef struct {
 	CalMode      mode;
 } ECalTestClosure;
 
+void
+test_print (const char *format,
+            ...);
+
 ECal*
 ecal_test_utils_cal_new_temp (char           **uri,
 		              ECalSourceType   type);
diff --git a/calendar/tests/ecal/test-ecal-get-alarm-email-address.c b/calendar/tests/ecal/test-ecal-get-alarm-email-address.c
index 4ac39ef..f32254c 100644
--- a/calendar/tests/ecal/test-ecal-get-alarm-email-address.c
+++ b/calendar/tests/ecal/test-ecal-get-alarm-email-address.c
@@ -18,7 +18,7 @@ main (gint argc, gchar **argv)
 	ecal_test_utils_cal_open (cal, FALSE);
 
 	address = ecal_test_utils_cal_get_alarm_email_address (cal);
-	g_print ("alarm email address: '%s'\n", address);
+	test_print ("alarm email address: '%s'\n", address);
 
 	ecal_test_utils_cal_remove (cal);
 
diff --git a/calendar/tests/ecal/test-ecal-get-cal-address.c b/calendar/tests/ecal/test-ecal-get-cal-address.c
index b015d39..1522baf 100644
--- a/calendar/tests/ecal/test-ecal-get-cal-address.c
+++ b/calendar/tests/ecal/test-ecal-get-cal-address.c
@@ -18,7 +18,7 @@ main (gint argc, gchar **argv)
 	ecal_test_utils_cal_open (cal, FALSE);
 
 	address = ecal_test_utils_cal_get_cal_address (cal);
-	g_print ("calendar address: '%s'\n", address);
+	test_print ("calendar address: '%s'\n", address);
 
 	ecal_test_utils_cal_remove (cal);
 
diff --git a/calendar/tests/ecal/test-ecal-get-default-object.c b/calendar/tests/ecal/test-ecal-get-default-object.c
index 39d0afa..a003179 100644
--- a/calendar/tests/ecal/test-ecal-get-default-object.c
+++ b/calendar/tests/ecal/test-ecal-get-default-object.c
@@ -21,7 +21,7 @@ main (gint argc, gchar **argv)
 
 	component = ecal_test_utils_cal_get_default_object (cal);
 	component_string = icalcomponent_as_ical_string (component);
-	g_print ("default object:\n%s", component_string);
+	test_print ("default object:\n%s", component_string);
 
 	ecal_test_utils_cal_remove (cal);
 
diff --git a/calendar/tests/ecal/test-ecal-get-ldap-attribute.c b/calendar/tests/ecal/test-ecal-get-ldap-attribute.c
index a1758e9..04ca522 100644
--- a/calendar/tests/ecal/test-ecal-get-ldap-attribute.c
+++ b/calendar/tests/ecal/test-ecal-get-ldap-attribute.c
@@ -18,7 +18,7 @@ main (gint argc, gchar **argv)
 	ecal_test_utils_cal_open (cal, FALSE);
 
 	attr = ecal_test_utils_cal_get_ldap_attribute (cal);
-	g_print ("LDAP attribute: '%s'\n", attr);
+	test_print ("LDAP attribute: '%s'\n", attr);
 
 	ecal_test_utils_cal_remove (cal);
 
diff --git a/calendar/tests/ecal/test-ecal-get-query.c b/calendar/tests/ecal/test-ecal-get-query.c
index 6b5c375..5984c7b 100644
--- a/calendar/tests/ecal/test-ecal-get-query.c
+++ b/calendar/tests/ecal/test-ecal-get-query.c
@@ -47,7 +47,7 @@ objects_added_cb (GObject *object, GList *objects, gpointer data)
         GList *l;
 
         for (l = objects; l; l = l->next)
-                g_print ("Object added %s\n", icalcomponent_get_uid (l->data));
+                test_print ("Object added %s\n", icalcomponent_get_uid (l->data));
 
 	subtest_passed (SUBTEST_OBJECTS_ADDED);
 }
@@ -58,7 +58,7 @@ objects_modified_cb (GObject *object, GList *objects, gpointer data)
         GList *l;
 
         for (l = objects; l; l = l->next)
-                g_print ("Object modified %s\n", icalcomponent_get_uid (l->data));
+                test_print ("Object modified %s\n", icalcomponent_get_uid (l->data));
 
 	subtest_passed (SUBTEST_OBJECTS_MODIFIED);
 }
@@ -71,7 +71,7 @@ objects_removed_cb (GObject *object, GList *objects, gpointer data)
         for (l = objects; l; l = l->next) {
 		ECalComponentId *id = l->data;
 
-                g_print ("Object removed: uid: %s, rid: %s\n", id->uid,
+                test_print ("Object removed: uid: %s, rid: %s\n", id->uid,
 				id->rid);
 	}
 
@@ -81,7 +81,7 @@ objects_removed_cb (GObject *object, GList *objects, gpointer data)
 static void
 view_done_cb (GObject *object, ECalendarStatus status, gpointer data)
 {
-        g_print ("View done\n");
+        test_print ("View done\n");
 
 	g_source_remove (complete_timeout_id);
 



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