From 01130c5baedfd8547c984a14423a613282e71d42 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:39:44 -0500 Subject: Start a multi watch test --- tests/Makefile.am | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index 13fef2d..04a6ed3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -303,6 +303,18 @@ service-version-tester: service-version-manager service-version-bad-service serv TESTS += service-version-tester DISTCLEANFILES += service-version-tester service-version-bad.service service-version-good.service +############################# +# Service Versions +############################# + +service-version-multiwatch-tester: service-version-manager service-version-good-service session.conf service-version-good.service Makefile.am + @echo "#!/bin/sh" > $@ + @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-manager --task-name Manager1 --task ./service-version-manager --task-name Manager2 >> $@ + @chmod +x $@ + +TESTS += service-version-multiwatch-tester +DISTCLEANFILES += service-version-multiwatch-tester + ############################# # Service Manager Shutdown ############################# -- cgit v1.2.3 From 6786532d0efae7037c1b5d4f970359c6410d2cd7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:42:20 -0500 Subject: Making a new manager --- tests/Makefile.am | 18 +++++++++-- tests/service-version-multiwatch-manager.c | 52 ++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 tests/service-version-multiwatch-manager.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 04a6ed3..35e07f4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -307,9 +307,23 @@ DISTCLEANFILES += service-version-tester service-version-bad.service service-ver # Service Versions ############################# -service-version-multiwatch-tester: service-version-manager service-version-good-service session.conf service-version-good.service Makefile.am +check_PROGRAMS += service-version-multiwatch-manager + +service_version_manager_SOURCES = \ + service-version-values.h \ + service-version-multiwatch-manager.c + +service_version_multiwatch_manager_CFLAGS = \ + -Wall -Werror \ + $(LIBINDICATOR_CFLAGS) -I$(top_srcdir) + +service_version_multiwatch_manager_LDADD = \ + $(LIBINDICATOR_LIBS) \ + $(top_builddir)/libindicator/.libs/libindicator.a + +service-version-multiwatch-tester: service-version-multiwatch-manager service-version-good-service session.conf service-version-good.service Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-manager --task-name Manager1 --task ./service-version-manager --task-name Manager2 >> $@ + @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester diff --git a/tests/service-version-multiwatch-manager.c b/tests/service-version-multiwatch-manager.c new file mode 100644 index 0000000..7293d43 --- /dev/null +++ b/tests/service-version-multiwatch-manager.c @@ -0,0 +1,52 @@ + +#include +#include "libindicator/indicator-service-manager.h" +#include "service-version-values.h" + +static GMainLoop * mainloop = NULL; +static gboolean passed = FALSE; + +gboolean +timeout (gpointer data) +{ + g_debug("Timeout."); + passed = FALSE; + g_main_loop_quit(mainloop); + return FALSE; +} + +void +connection_good (IndicatorServiceManager * sm, gboolean connected, gpointer user_data) +{ + if (!connected) return; + g_debug("Connection From Service."); + passed = TRUE; + g_main_loop_quit(mainloop); + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); + g_print("Manager: DBUS_SESSION_BUS_ADDRESS = %s\n", g_getenv("DBUS_SESSION_BUS_ADDRESS")); + + IndicatorServiceManager * goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); + g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL); + + g_timeout_add_seconds(1, timeout, NULL); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + g_object_unref(goodis); + + g_debug("Quiting"); + if (passed) { + g_debug("Passed"); + return 0; + } + g_debug("Failed"); + return 1; +} -- cgit v1.2.3 From 054704d88d207c21c95823e6a8f1d1e4a884eece Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:42:46 -0500 Subject: Ignoring the new builds. --- .bzrignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bzrignore b/.bzrignore index 38d60ed..f48ec1e 100644 --- a/.bzrignore +++ b/.bzrignore @@ -152,3 +152,5 @@ tests/test-desktop-shortcuts tests/test-desktop-shortcuts-tester tests/test-desktop-shortcuts-touch-test libindicator/libindicator_la-indicator-image-helper.lo +tests/service-version-multiwatch-manager +tests/service-version-multiwatch-tester -- cgit v1.2.3 From 5731c1e07e2c2ca4d192213b3128bc5b7a3339b8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:45:18 -0500 Subject: Starting the service ourselves. --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 35e07f4..7690f10 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -323,7 +323,7 @@ service_version_multiwatch_manager_LDADD = \ service-version-multiwatch-tester: service-version-multiwatch-manager service-version-good-service session.conf service-version-good.service Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ + @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-good-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester -- cgit v1.2.3 From 56dd41e5fcadc452ad1c5b0892e3cd0b5fa3da2f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:50:25 -0500 Subject: Delaying the watchers to ensure that we don't dbus activate, and removing the session.conf to even allow for that. --- tests/Makefile.am | 4 ++-- tests/service-version-multiwatch-manager.c | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 7690f10..12d6dc3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -321,9 +321,9 @@ service_version_multiwatch_manager_LDADD = \ $(LIBINDICATOR_LIBS) \ $(top_builddir)/libindicator/.libs/libindicator.a -service-version-multiwatch-tester: service-version-multiwatch-manager service-version-good-service session.conf service-version-good.service Makefile.am +service-version-multiwatch-tester: service-version-multiwatch-manager service-version-good-service Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --dbus-config $(builddir)/session.conf --task ./service-version-good-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ + @echo dbus-test-runner --task ./service-version-good-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester diff --git a/tests/service-version-multiwatch-manager.c b/tests/service-version-multiwatch-manager.c index 7293d43..2edbd73 100644 --- a/tests/service-version-multiwatch-manager.c +++ b/tests/service-version-multiwatch-manager.c @@ -5,6 +5,7 @@ static GMainLoop * mainloop = NULL; static gboolean passed = FALSE; +static IndicatorServiceManager * goodis = NULL; gboolean timeout (gpointer data) @@ -25,6 +26,17 @@ connection_good (IndicatorServiceManager * sm, gboolean connected, gpointer user return; } +gboolean +delay_start (gpointer data) +{ + goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); + g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL); + + g_timeout_add_seconds(1, timeout, NULL); + + return FALSE; +} + int main (int argc, char ** argv) { @@ -32,10 +44,7 @@ main (int argc, char ** argv) g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); g_print("Manager: DBUS_SESSION_BUS_ADDRESS = %s\n", g_getenv("DBUS_SESSION_BUS_ADDRESS")); - IndicatorServiceManager * goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); - g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL); - - g_timeout_add_seconds(1, timeout, NULL); + g_timeout_add(500, delay_start, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3 From 7c7b497e39c3a00b898a3d854a284de06e5fd081 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:52:28 -0500 Subject: Okay, we need our own service too. Bah. --- .bzrignore | 1 + tests/Makefile.am | 18 ++++++++++-- tests/service-version-multiwatch-service.c | 47 ++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 tests/service-version-multiwatch-service.c diff --git a/.bzrignore b/.bzrignore index f48ec1e..cef9d4e 100644 --- a/.bzrignore +++ b/.bzrignore @@ -154,3 +154,4 @@ tests/test-desktop-shortcuts-touch-test libindicator/libindicator_la-indicator-image-helper.lo tests/service-version-multiwatch-manager tests/service-version-multiwatch-tester +tests/service-version-multiwatch-service diff --git a/tests/Makefile.am b/tests/Makefile.am index 12d6dc3..6a7fb42 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -321,9 +321,23 @@ service_version_multiwatch_manager_LDADD = \ $(LIBINDICATOR_LIBS) \ $(top_builddir)/libindicator/.libs/libindicator.a -service-version-multiwatch-tester: service-version-multiwatch-manager service-version-good-service Makefile.am +check_PROGRAMS += service-version-multiwatch-service + +service_version_multiwatch_service_SOURCES = \ + service-version-values.h \ + service-version-multiwatch-service.c + +service_version_multiwatch_service_CFLAGS = \ + -Wall -Werror \ + $(LIBINDICATOR_CFLAGS) -I$(top_srcdir) + +service_version_multiwatch_service_LDADD = \ + $(LIBINDICATOR_LIBS) \ + $(top_builddir)/libindicator/.libs/libindicator.a + +service-version-multiwatch-tester: service-version-multiwatch-manager service-version-multiwatch-service Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --task ./service-version-good-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ + @echo dbus-test-runner --task ./service-version-multiwatch-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester diff --git a/tests/service-version-multiwatch-service.c b/tests/service-version-multiwatch-service.c new file mode 100644 index 0000000..bcfe46d --- /dev/null +++ b/tests/service-version-multiwatch-service.c @@ -0,0 +1,47 @@ + +#include +#include "libindicator/indicator-service.h" +#include "service-version-values.h" + +static GMainLoop * mainloop = NULL; +static gboolean passed = FALSE; + +gboolean +timeout (gpointer data) +{ + passed = FALSE; + g_debug("Timeout with no shutdown."); + g_main_loop_quit(mainloop); + return FALSE; +} + +void +shutdown (void) +{ + g_debug("Shutdown"); + passed = TRUE; + g_main_loop_quit(mainloop); + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + + IndicatorService * is = indicator_service_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); + g_signal_connect(G_OBJECT(is), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, shutdown, NULL); + + g_timeout_add_seconds(1, timeout, NULL); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + g_debug("Quiting"); + if (passed) { + g_debug("Passed"); + return 0; + } + g_debug("Failed"); + return 1; +} -- cgit v1.2.3 From 990a881daae02537ecc76272471bc012ca17773a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:53:48 -0500 Subject: Longer timeout --- tests/service-version-multiwatch-service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/service-version-multiwatch-service.c b/tests/service-version-multiwatch-service.c index bcfe46d..ac92b36 100644 --- a/tests/service-version-multiwatch-service.c +++ b/tests/service-version-multiwatch-service.c @@ -32,7 +32,7 @@ main (int argc, char ** argv) IndicatorService * is = indicator_service_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); g_signal_connect(G_OBJECT(is), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, shutdown, NULL); - g_timeout_add_seconds(1, timeout, NULL); + g_timeout_add_seconds(2, timeout, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3 From dceee48da02357fcb92e45f030711a6e734a0f73 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:55:59 -0500 Subject: Up to 5 watchers. --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 6a7fb42..852a963 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -337,7 +337,7 @@ service_version_multiwatch_service_LDADD = \ service-version-multiwatch-tester: service-version-multiwatch-manager service-version-multiwatch-service Makefile.am @echo "#!/bin/sh" > $@ - @echo dbus-test-runner --task ./service-version-multiwatch-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 >> $@ + @echo dbus-test-runner --task ./service-version-multiwatch-service --task-name Service --task ./service-version-multiwatch-manager --task-name Manager1 --task ./service-version-multiwatch-manager --task-name Manager2 --task ./service-version-multiwatch-manager --task-name Manager3 --task ./service-version-multiwatch-manager --task-name Manager4 --task ./service-version-multiwatch-manager --task-name Manager5 >> $@ @chmod +x $@ TESTS += service-version-multiwatch-tester -- cgit v1.2.3 From b43f81d0ece9bb9c150ccbeba793f385bef6ce3b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 10:58:17 -0500 Subject: A couple debug messages to make the test easier to read the output from. --- tests/service-version-multiwatch-manager.c | 2 ++ tests/service-version-multiwatch-service.c | 1 + 2 files changed, 3 insertions(+) diff --git a/tests/service-version-multiwatch-manager.c b/tests/service-version-multiwatch-manager.c index 2edbd73..771426f 100644 --- a/tests/service-version-multiwatch-manager.c +++ b/tests/service-version-multiwatch-manager.c @@ -29,6 +29,8 @@ connection_good (IndicatorServiceManager * sm, gboolean connected, gpointer user gboolean delay_start (gpointer data) { + g_debug("Starting Manager"); + goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL); diff --git a/tests/service-version-multiwatch-service.c b/tests/service-version-multiwatch-service.c index ac92b36..9920306 100644 --- a/tests/service-version-multiwatch-service.c +++ b/tests/service-version-multiwatch-service.c @@ -28,6 +28,7 @@ int main (int argc, char ** argv) { g_type_init(); + g_debug("Service starting"); IndicatorService * is = indicator_service_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD); g_signal_connect(G_OBJECT(is), INDICATOR_SERVICE_SIGNAL_SHUTDOWN, shutdown, NULL); -- cgit v1.2.3