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 --- debian/rules | 1 + tests/test-libappindicator-fallback-item.c | 2 +- tests/test-libappindicator-fallback-watcher.c | 3 ++- tests/test-libappindicator.c | 28 +++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 4637722..8512858 100755 --- a/debian/rules +++ b/debian/rules @@ -20,6 +20,7 @@ CFLAGS += -fPIC # Note: No cli here so that the pbuilder stuff works clean: dh_clean + dh_autoreconf_clean override_dh_autoreconf: NOCONFIGURE=1 dh_autoreconf ./autogen.sh 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(-) 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