Merge lp:~ted/ubuntu-app-launch/zg-reenable into lp:ubuntu-app-launch/14.04

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 90
Merged at revision: 85
Proposed branch: lp:~ted/ubuntu-app-launch/zg-reenable
Merge into: lp:ubuntu-app-launch/14.04
Prerequisite: lp:~ted/ubuntu-app-launch/mock-lib-tests
Diff against target: 203 lines (+90/-17)
7 files modified
CMakeLists.txt (+3/-3)
application-click.conf.in (+2/-5)
application-legacy.conf.in (+2/-5)
debian/control (+2/-1)
tests/CMakeLists.txt (+10/-0)
tests/zg-test.cc (+68/-0)
zg-report-app.c (+3/-3)
To merge this branch: bzr merge lp:~ted/ubuntu-app-launch/zg-reenable
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+194570@code.launchpad.net

Commit message

Reenable ZG and port to libzg-2.0

Description of the change

Switches back on ZG after we turned it off for the release, so that it's back for this one. Also upgrades to libzg-2 and adds a test for it.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

The code looks ok and the tests are a nice plus, just need to make Jenkins happy...

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
88. By Ted Gould

Updating mock lib branch

89. By Ted Gould

Put ZG in the wrong package

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
90. By Ted Gould

Avoid an error in the ZG headers

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-11-19 04:12:01 +0000
3+++ CMakeLists.txt 2013-11-19 04:12:01 +0000
4@@ -25,7 +25,7 @@
5
6 set(pkglibexecdir "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}")
7
8-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
9+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wno-error=unused-function")
10
11 enable_testing()
12
13@@ -41,7 +41,7 @@
14 pkg_check_modules(JSONGLIB REQUIRED json-glib-1.0)
15 include_directories(${JSONGLIB_INCLUDE_DIRS})
16
17-pkg_check_modules(ZEITGEIST REQUIRED zeitgeist-1.0)
18+pkg_check_modules(ZEITGEIST REQUIRED zeitgeist-2.0)
19 include_directories(${ZEITGEIST_INCLUDE_DIRS})
20
21 pkg_check_modules(LIBUPSTART REQUIRED libupstart libnih libnih-dbus dbus-1)
22@@ -157,7 +157,7 @@
23
24 add_executable(zg-report-app zg-report-app.c)
25 set_target_properties(zg-report-app PROPERTIES OUTPUT_NAME "zg-report-app")
26-target_link_libraries(zg-report-app ${ZEITGEIST_LIBRARIES})
27+target_link_libraries(zg-report-app ${ZEITGEIST_LIBRARIES} ${GOBJECT2_LIBRARIES} ${GLIB2_LIBRARIES})
28 install(TARGETS zg-report-app RUNTIME DESTINATION "${pkglibexecdir}")
29
30 #######################
31
32=== modified file 'application-click.conf.in'
33--- application-click.conf.in 2013-10-02 15:01:22 +0000
34+++ application-click.conf.in 2013-11-19 04:12:01 +0000
35@@ -26,8 +26,5 @@
36 # Remember, this is confined
37 exec @pkglibexecdir@/exec-line-exec
38
39-# Disabled for Phone 1.0 which doesn't yet have ZG installed on it,
40-# so we don't need to log the data.
41-#
42-# post-start exec @pkglibexecdir@/zg-report-app open
43-# post-stop exec @pkglibexecdir@/zg-report-app close
44+post-start exec @pkglibexecdir@/zg-report-app open
45+post-stop exec @pkglibexecdir@/zg-report-app close
46
47=== modified file 'application-legacy.conf.in'
48--- application-legacy.conf.in 2013-10-02 15:01:22 +0000
49+++ application-legacy.conf.in 2013-11-19 04:12:01 +0000
50@@ -26,8 +26,5 @@
51
52 exec @pkglibexecdir@/exec-line-exec
53
54-# Disabled for Phone 1.0 which doesn't yet have ZG installed on it,
55-# so we don't need to log the data.
56-#
57-# post-start exec @pkglibexecdir@/zg-report-app open
58-# post-stop exec @pkglibexecdir@/zg-report-app close
59+post-start exec @pkglibexecdir@/zg-report-app open
60+post-stop exec @pkglibexecdir@/zg-report-app close
61
62=== modified file 'debian/control'
63--- debian/control 2013-11-19 04:12:01 +0000
64+++ debian/control 2013-11-19 04:12:01 +0000
65@@ -15,7 +15,7 @@
66 libnih-dbus-dev,
67 libnih-dev,
68 libupstart-dev,
69- libzeitgeist-dev,
70+ libzeitgeist-2.0-dev,
71 python3-dbusmock,
72 Standards-Version: 3.9.4
73 Homepage: http://launchpad.net/upstart-app-launch
74@@ -30,6 +30,7 @@
75 ${misc:Depends},
76 click (>= 0.4.9),
77 click-apparmor,
78+ zeitgeist,
79 Description: Upstart Job for Launching Applications
80 Upstart Job file and associated utilities that is used to launch
81 applications in a standard and confined way.
82
83=== modified file 'tests/CMakeLists.txt'
84--- tests/CMakeLists.txt 2013-11-19 04:12:01 +0000
85+++ tests/CMakeLists.txt 2013-11-19 04:12:01 +0000
86@@ -43,3 +43,13 @@
87 add_test (NAME libual-test-pid COMMAND libual-test --gtest_filter=*ApplicationPid)
88 add_test (NAME libual-test-list COMMAND libual-test --gtest_filter=*ApplicationList)
89 add_test (NAME libual-test-observer COMMAND libual-test --gtest_filter=*StartStopObserver)
90+
91+# ZG Test
92+
93+add_definitions ( -DZG_EVENT_TOOL="${CMAKE_BINARY_DIR}/zg-report-app" )
94+
95+add_executable (zg-test
96+ zg-test.cc)
97+target_link_libraries (zg-test gtest ${GTEST_LIBS} ${DBUSTEST_LIBRARIES} ${GIO2_LIBRARIES})
98+add_test (zg-test zg-test)
99+
100
101=== added file 'tests/zg-test.cc'
102--- tests/zg-test.cc 1970-01-01 00:00:00 +0000
103+++ tests/zg-test.cc 2013-11-19 04:12:01 +0000
104@@ -0,0 +1,68 @@
105+/*
106+ * Copyright 2013 Canonical Ltd.
107+ *
108+ * This program is free software: you can redistribute it and/or modify it
109+ * under the terms of the GNU General Public License version 3, as published
110+ * by the Free Software Foundation.
111+ *
112+ * This program is distributed in the hope that it will be useful, but
113+ * WITHOUT ANY WARRANTY; without even the implied warranties of
114+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
115+ * PURPOSE. See the GNU General Public License for more details.
116+ *
117+ * You should have received a copy of the GNU General Public License along
118+ * with this program. If not, see <http://www.gnu.org/licenses/>.
119+ *
120+ * Authors:
121+ * Ted Gould <ted.gould@canonical.com>
122+ */
123+
124+#include <gtest/gtest.h>
125+#include <gio/gio.h>
126+#include <libdbustest/dbus-test.h>
127+
128+TEST(ZGEvent, OpenTest)
129+{
130+ DbusTestService * service = dbus_test_service_new(NULL);
131+
132+ DbusTestDbusMock * mock = dbus_test_dbus_mock_new("org.gnome.zeitgeist.Engine");
133+ DbusTestDbusMockObject * obj = dbus_test_dbus_mock_get_object(mock, "/org/gnome/zeitgeist/log/activity", "org.gnome.zeitgeist.Log", NULL);
134+
135+ dbus_test_dbus_mock_object_add_method(mock, obj,
136+ "InsertEvents",
137+ G_VARIANT_TYPE("a(asaasay)"),
138+ G_VARIANT_TYPE("au"),
139+ "ret = [ 0 ]",
140+ NULL);
141+
142+ dbus_test_service_add_task(service, DBUS_TEST_TASK(mock));
143+
144+ DbusTestProcess * zgevent = dbus_test_process_new(ZG_EVENT_TOOL);
145+ dbus_test_process_append_param(zgevent, "open");
146+ g_setenv("APP_ID", "foo", 1);
147+ dbus_test_task_set_wait_for(DBUS_TEST_TASK(zgevent), "org.gnome.zeitgeist.Engine");
148+ dbus_test_task_set_name(DBUS_TEST_TASK(zgevent), "ZGEvent");
149+
150+ dbus_test_service_add_task(service, DBUS_TEST_TASK(zgevent));
151+
152+ dbus_test_service_start_tasks(service);
153+
154+ /* Give it time to send the event and exit */
155+ g_usleep(100000);
156+ while (g_main_pending()) {
157+ g_main_iteration(TRUE);
158+ }
159+
160+ ASSERT_EQ(dbus_test_task_get_state(DBUS_TEST_TASK(zgevent)), DBUS_TEST_TASK_STATE_FINISHED);
161+ ASSERT_TRUE(dbus_test_task_passed(DBUS_TEST_TASK(zgevent)));
162+
163+ guint numcalls = 0;
164+ const DbusTestDbusMockCall * calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "InsertEvents", &numcalls, NULL);
165+
166+ ASSERT_NE(calls, nullptr);
167+ ASSERT_EQ(numcalls, 1);
168+
169+ g_object_unref(zgevent);
170+ g_object_unref(mock);
171+ g_object_unref(service);
172+}
173
174=== modified file 'zg-report-app.c'
175--- zg-report-app.c 2013-09-22 18:43:26 +0000
176+++ zg-report-app.c 2013-11-19 04:12:01 +0000
177@@ -23,7 +23,7 @@
178 static gboolean
179 watchdog_timeout (gpointer user_data)
180 {
181- g_error("Watchdog triggered, took to long to submit into Zeitgeist Database!");
182+ g_error("Watchdog triggered, took too long to submit into Zeitgeist Database!");
183 g_main_loop_quit((GMainLoop *)user_data);
184
185 return G_SOURCE_REMOVE;
186@@ -35,7 +35,7 @@
187 GError * error = NULL;
188 GArray * result = NULL;
189
190- result = zeitgeist_log_insert_events_finish(ZEITGEIST_LOG(obj), res, &error);
191+ result = zeitgeist_log_insert_event_finish(ZEITGEIST_LOG(obj), res, &error);
192
193 if (error != NULL) {
194 g_error("Unable to submit Zeitgeist Event: %s", error->message);
195@@ -83,7 +83,7 @@
196
197 GMainLoop * main_loop = g_main_loop_new(NULL, FALSE);
198
199- zeitgeist_log_insert_events(log, NULL, insert_complete, main_loop, event, NULL);
200+ zeitgeist_log_insert_event(log, event, NULL, insert_complete, main_loop);
201 g_timeout_add_seconds(4, watchdog_timeout, main_loop);
202
203 g_main_loop_run(main_loop);

Subscribers

People subscribed via source and target branches