From b598e7cb3fc5491d93debde743f5e67037dfb6f1 Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Tue, 8 Jan 2013 10:33:31 -0500 Subject: More traces --- tests/Makefile.am | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index a65f320..4d3be1c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -137,6 +137,8 @@ test_libappindicator_fallback_item_LDADD = \ test-libappindicator-fallback: test-libappindicator-fallback-watcher test-libappindicator-fallback-item Makefile.am @echo "#!/bin/bash" > $@ + @echo export DISPLAY= >> $@ + @echo killall at-spi2-registryd >> $@ @echo . $(srcdir)/run-xvfb.sh >> $@ @echo $(DBUS_RUNNER) --task ./test-libappindicator-fallback-watcher --task-name Watcher --ignore-return --task ./test-libappindicator-fallback-item --task-name Item >> $@ @chmod +x $@ @@ -152,6 +154,8 @@ HTML_REPORT = libappindicator-check-results.html libappindicator-tests: libappindicator-tests-gtester Makefile.am @echo "#!/bin/bash" > $@ + @echo export DISPLAY= >> $@ + @echo killall at-spi2-registryd >> $@ @echo . $(srcdir)/run-xvfb.sh >> $@ @echo export UBUNTU_MENUPROXY= >> $@ @echo $(DBUS_RUNNER) --task ./libappindicator-tests-gtester >> $@ @@ -170,6 +174,8 @@ DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.c test-libappindicator-dbus: test-libappindicator-dbus-client test-libappindicator-dbus-server Makefile.am @echo "#!/bin/bash" > test-libappindicator-dbus + @echo export DISPLAY= >> $@ + @echo killall at-spi2-registryd >> $@ @echo . $(srcdir)/run-xvfb.sh >> $@ @echo $(DBUS_RUNNER) --task ./test-libappindicator-dbus-client --task-name Client --task ./test-libappindicator-dbus-server --task-name Server --ignore-return >> test-libappindicator-dbus @chmod +x test-libappindicator-dbus @@ -179,6 +185,8 @@ XFAIL_TESTS = test-libappindicator-dbus test-libappindicator-status: test-libappindicator-status-client test-libappindicator-status-server Makefile.am @echo "#!/bin/bash" > test-libappindicator-status + @echo export DISPLAY= >> $@ + @echo killall at-spi2-registryd >> $@ @echo . $(srcdir)/run-xvfb.sh >> $@ @echo $(DBUS_RUNNER) --task ./test-libappindicator-status-client --task-name Client --task ./test-libappindicator-status-server --task-name Server --ignore-return >> test-libappindicator-status @chmod +x test-libappindicator-status -- cgit v1.2.3 From 616555a9509f3b1f313ea3056e30c48737eeb908 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Thu, 10 Jan 2013 17:18:55 -0500 Subject: some packaging fixes to make tests more resistant to timing issues and warnings from sub-libraries --- tests/test-libappindicator-fallback-item.c | 2 +- tests/test-libappindicator-fallback-watcher.c | 3 ++- tests/test-libappindicator.c | 28 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test-libappindicator-fallback-item.c b/tests/test-libappindicator-fallback-item.c index 418b779..c87ef8c 100644 --- a/tests/test-libappindicator-fallback-item.c +++ b/tests/test-libappindicator-fallback-item.c @@ -138,7 +138,7 @@ main (int argc, char ** argv) GtkWidget * menu = gtk_menu_new(); app_indicator_set_menu(APP_INDICATOR(item), GTK_MENU(menu)); - g_timeout_add_seconds(2, kill_func, NULL); + g_timeout_add_seconds(20, kill_func, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-libappindicator-fallback-watcher.c b/tests/test-libappindicator-fallback-watcher.c index 5494082..f337150 100644 --- a/tests/test-libappindicator-fallback-watcher.c +++ b/tests/test-libappindicator-fallback-watcher.c @@ -77,6 +77,7 @@ main (int argv, char ** argc) while (!has_owner && owner_count < 10000) { org_freedesktop_DBus_name_has_owner(bus_proxy, "org.test", &has_owner, NULL); owner_count++; + g_usleep(500000); } if (owner_count == 10000) { @@ -104,7 +105,7 @@ main (int argv, char ** argc) /* This is the final kill function. It really shouldn't happen unless we get an error. */ - g_timeout_add(2000, kill_func, NULL); + g_timeout_add_seconds(20, kill_func, NULL); g_debug("Entering Mainloop"); diff --git a/tests/test-libappindicator.c b/tests/test-libappindicator.c index 7afd3ba..0c69fde 100644 --- a/tests/test-libappindicator.c +++ b/tests/test-libappindicator.c @@ -28,6 +28,16 @@ with this program. If not, see . #include #include +static gboolean +allow_warnings (const gchar *log_domain, GLogLevelFlags log_level, + const gchar *message, gpointer user_data) +{ + // By default, gtest will fail a test on even a warning message. + // But since some of our sub-libraries are noisy (especially at-spi2), + // only fail on critical or worse. + return ((log_level & G_LOG_LEVEL_MASK) <= G_LOG_LEVEL_CRITICAL); +} + void test_libappindicator_prop_signals_status_helper (AppIndicator * ci, gchar * status, gboolean * signalactivated) { @@ -45,6 +55,8 @@ test_libappindicator_prop_signals_helper (AppIndicator * ci, gboolean * signalac void test_libappindicator_prop_signals (void) { + g_test_log_set_fatal_handler (allow_warnings, NULL); + AppIndicator * ci = app_indicator_new ("test-app-indicator", "indicator-messages", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); @@ -115,6 +127,8 @@ test_libappindicator_prop_signals (void) void test_libappindicator_init_set_props (void) { + g_test_log_set_fatal_handler (allow_warnings, NULL); + AppIndicator * ci = app_indicator_new ("my-id", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); @@ -139,6 +153,8 @@ test_libappindicator_init_set_props (void) void test_libappindicator_init_with_props (void) { + g_test_log_set_fatal_handler (allow_warnings, NULL); + AppIndicator * ci = app_indicator_new ("my-id", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); @@ -161,6 +177,8 @@ test_libappindicator_init_with_props (void) void test_libappindicator_init (void) { + g_test_log_set_fatal_handler (allow_warnings, NULL); + AppIndicator * ci = app_indicator_new ("my-id", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); g_assert(ci != NULL); g_object_unref(G_OBJECT(ci)); @@ -170,6 +188,8 @@ test_libappindicator_init (void) void test_libappindicator_set_label (void) { + g_test_log_set_fatal_handler (allow_warnings, NULL); + AppIndicator * ci = app_indicator_new ("my-id", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); @@ -232,6 +252,8 @@ test_libappindicator_set_label (void) void test_libappindicator_set_menu (void) { + g_test_log_set_fatal_handler (allow_warnings, NULL); + AppIndicator * ci = app_indicator_new ("my-id", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); @@ -301,6 +323,8 @@ label_signals_check (void) void test_libappindicator_label_signals (void) { + g_test_log_set_fatal_handler (allow_warnings, NULL); + gint label_signals_count = 0; AppIndicator * ci = app_indicator_new ("my-id", "my-name", @@ -352,6 +376,8 @@ test_libappindicator_label_signals (void) void test_libappindicator_desktop_menu (void) { + g_test_log_set_fatal_handler (allow_warnings, NULL); + AppIndicator * ci = app_indicator_new ("my-id-desktop-menu", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); @@ -388,6 +414,8 @@ test_libappindicator_desktop_menu (void) void test_libappindicator_desktop_menu_bad (void) { + g_test_log_set_fatal_handler (allow_warnings, NULL); + AppIndicator * ci = app_indicator_new ("my-id-desktop-menu-bad", "my-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); -- cgit v1.2.3 From c5aca6545eac6999a9c0a74ede4674366d712941 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Mon, 14 Jan 2013 10:46:51 -0500 Subject: increase another test timeout to make amd64 build --- tests/test-libappindicator-status-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test-libappindicator-status-client.c b/tests/test-libappindicator-status-client.c index 9e39ed8..811882b 100644 --- a/tests/test-libappindicator-status-client.c +++ b/tests/test-libappindicator-status-client.c @@ -137,7 +137,7 @@ main (gint argc, gchar * argv[]) dbus_bus_add_match(dbus_g_connection_get_connection(session_bus), "type='signal',interface='" NOTIFICATION_ITEM_DBUS_IFACE "',member='NewStatus'", NULL); watchdog_hit = TRUE; - g_timeout_add(1000, kill_func, NULL); + g_timeout_add_seconds(20, kill_func, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3 From 6a86412258be37bb971c41b8f0ebd0a19a1463d2 Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Wed, 16 Jan 2013 14:53:52 -0500 Subject: Remove deprecated calls to g_type_init() --- tests/test-libappindicator-dbus-client.c | 2 -- tests/test-libappindicator-fallback-watcher.c | 2 -- tests/test-libappindicator-status-client.c | 2 -- tests/test-simple-app.c | 2 -- 4 files changed, 8 deletions(-) (limited to 'tests') diff --git a/tests/test-libappindicator-dbus-client.c b/tests/test-libappindicator-dbus-client.c index 9a51792..18c6946 100644 --- a/tests/test-libappindicator-dbus-client.c +++ b/tests/test-libappindicator-dbus-client.c @@ -204,8 +204,6 @@ dbus_filter (DBusConnection * connection, DBusMessage * message, void * user_dat gint main (gint argc, gchar * argv[]) { - g_type_init(); - GError * error = NULL; DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); if (error != NULL) { diff --git a/tests/test-libappindicator-fallback-watcher.c b/tests/test-libappindicator-fallback-watcher.c index f337150..2648902 100644 --- a/tests/test-libappindicator-fallback-watcher.c +++ b/tests/test-libappindicator-fallback-watcher.c @@ -58,8 +58,6 @@ kill_func (gpointer userdata) int main (int argv, char ** argc) { - g_type_init(); - g_debug("Waiting to init."); diff --git a/tests/test-libappindicator-status-client.c b/tests/test-libappindicator-status-client.c index 811882b..50e9c08 100644 --- a/tests/test-libappindicator-status-client.c +++ b/tests/test-libappindicator-status-client.c @@ -109,8 +109,6 @@ kill_func (gpointer userdata) gint main (gint argc, gchar * argv[]) { - g_type_init(); - GError * error = NULL; DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); if (error != NULL) { diff --git a/tests/test-simple-app.c b/tests/test-simple-app.c index d60d9b9..843466d 100644 --- a/tests/test-simple-app.c +++ b/tests/test-simple-app.c @@ -31,8 +31,6 @@ static GMainLoop * mainloop = NULL; int main (int argc, char ** argv) { - g_type_init(); - DbusmenuServer * dms = dbusmenu_server_new("/menu"); DbusmenuMenuitem * dmi = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(dmi, "label", "Bob"); -- cgit v1.2.3 From fc8b73e958822e33c7dd8e3034bfdcc6addfe464 Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Wed, 23 Jan 2013 14:16:37 -0500 Subject: Increase dbus-test-runner timeout to 5 minutes to give tests enough time to start up and run on buildds, especially on slow architectures. --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 4d3be1c..3a1ecaf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -170,7 +170,7 @@ TESTS += libappindicator-tests DISTCLEANFILES += $(XML_REPORT) $(HTML_REPORT) libappindicator-tests-gtester -DBUS_RUNNER=dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf +DBUS_RUNNER=dbus-test-runner -m 300 --dbus-config /usr/share/dbus-test-runner/session.conf test-libappindicator-dbus: test-libappindicator-dbus-client test-libappindicator-dbus-server Makefile.am @echo "#!/bin/bash" > test-libappindicator-dbus -- cgit v1.2.3 From 345b7af04ab99882da94328308e6a65bc2df5b31 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 29 Jan 2013 11:57:42 -0600 Subject: flush the dbus connection before exiting test-libappindicator-status-server --- tests/test-libappindicator-status-client.c | 2 +- tests/test-libappindicator-status-server.c | 37 ++++++++++++++++++------------ 2 files changed, 23 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/test-libappindicator-status-client.c b/tests/test-libappindicator-status-client.c index 50e9c08..cd60e6c 100644 --- a/tests/test-libappindicator-status-client.c +++ b/tests/test-libappindicator-status-client.c @@ -116,7 +116,7 @@ main (gint argc, gchar * argv[]) return 1; } - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); + DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); guint nameret = 0; if (!org_freedesktop_DBus_request_name(bus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, 0, &nameret, &error)) { diff --git a/tests/test-libappindicator-status-server.c b/tests/test-libappindicator-status-server.c index 8cd5571..9674f61 100644 --- a/tests/test-libappindicator-status-server.c +++ b/tests/test-libappindicator-status-server.c @@ -22,34 +22,39 @@ with this program. If not, see . #include -#include -#include #include #include static GMainLoop * mainloop = NULL; static gboolean active = FALSE; static guint toggle_count = 0; +static GDBusConnection * connection = NULL; + +static gboolean +times_up (gpointer unused G_GNUC_UNUSED) +{ + g_dbus_connection_flush_sync (connection, NULL, NULL); + g_clear_object (&connection); + + g_main_loop_quit (mainloop); + return G_SOURCE_REMOVE; +} gboolean toggle (gpointer userdata) { - if (active) { - app_indicator_set_status (APP_INDICATOR(userdata), APP_INDICATOR_STATUS_ATTENTION); - active = FALSE; - } else { - app_indicator_set_status (APP_INDICATOR(userdata), APP_INDICATOR_STATUS_ACTIVE); - active = TRUE; - } - - toggle_count++; + const AppIndicatorStatus new_status = active ? APP_INDICATOR_STATUS_ATTENTION + : APP_INDICATOR_STATUS_ACTIVE; + app_indicator_set_status (APP_INDICATOR(userdata), new_status); + ++toggle_count; + active = !active; if (toggle_count == 100) { - g_main_loop_quit(mainloop); - return FALSE; + g_timeout_add (100, times_up, NULL); + return G_SOURCE_REMOVE; } - return TRUE; + return G_SOURCE_CONTINUE; } gint @@ -59,7 +64,8 @@ main (gint argc, gchar * argv[]) g_usleep(100000); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); + connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); + g_debug("DBus Name: %s", g_dbus_connection_get_unique_name (connection)); AppIndicator * ci = app_indicator_new ("my-id", "my-icon-name", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); app_indicator_set_attention_icon (ci, "my-attention-icon"); @@ -76,6 +82,7 @@ main (gint argc, gchar * argv[]) g_main_loop_run(mainloop); g_object_unref(G_OBJECT(ci)); + g_debug("Quiting"); return 0; -- cgit v1.2.3