Merge lp:~ted/ubuntu-app-launch/snappy-backend-list-only into lp:ubuntu-app-launch/16.10
- snappy-backend-list-only
- Merge into trunk.16.10
Status: | Merged |
---|---|
Approved by: | dobey |
Approved revision: | 253 |
Merged at revision: | 250 |
Proposed branch: | lp:~ted/ubuntu-app-launch/snappy-backend-list-only |
Merge into: | lp:ubuntu-app-launch/16.10 |
Prerequisite: | lp:~ted/ubuntu-app-launch/lp1579799-oom-adjust |
Diff against target: |
994 lines (+378/-97) 28 files modified
libubuntu-app-launch/CMakeLists.txt (+24/-2) libubuntu-app-launch/application-impl-click.cpp (+33/-8) libubuntu-app-launch/application-impl-legacy.cpp (+6/-0) libubuntu-app-launch/application-impl-libertine.cpp (+7/-10) libubuntu-app-launch/glib-thread.h (+13/-12) libubuntu-app-launch/registry-impl.cpp (+40/-5) libubuntu-app-launch/registry-impl.h (+3/-0) tests/CMakeLists.txt (+14/-9) tests/applications/foo.desktop (+1/-0) tests/applications/multiple.desktop (+1/-0) tests/applications/noxmir.desktop (+1/-0) tests/applications/single.desktop (+3/-0) tests/applications/xmir.desktop (+1/-0) tests/click-app-dir/.click/info/chatter.robert-ancell.manifest (+1/-1) tests/click-app-dir/application.desktop (+1/-1) tests/click-app-dir/noxmir.desktop (+1/-0) tests/click-app-dir/xmir.desktop (+1/-0) tests/eventually-fixture.h (+1/-1) tests/libertine-home/libertine-container/user-data/container-name/.local/share/applications/user-app.desktop (+1/-0) tests/libertine-home/libertine/ContainersConfig.json (+16/-0) tests/libual-cpp-test.cc (+19/-28) tests/libual-test.cc (+1/-1) tests/link-farm/com.test.good_application_1.2.4.desktop (+1/-0) tests/list-apps.cpp (+138/-0) tests/zg-test.cc (+1/-1) tools/CMakeLists.txt (+9/-0) tools/ubuntu-app-launch-appids.cpp (+39/-0) ual-tracepoint.h (+1/-18) |
To merge this branch: | bzr merge lp:~ted/ubuntu-app-launch/snappy-backend-list-only |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Approve | ||
unity-api-1-bot | continuous-integration | Approve | |
Charles Kerr (community) | Approve | ||
Review via email: mp+301963@code.launchpad.net |
Commit message
Fixes, tools and tests related to listing applications
Description of the change
Fixes, tools and tests related to listing applications
unity-api-1-bot (unity-api-1-bot) wrote : | # |
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:234
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:236
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Charles Kerr (charlesk) wrote : | # |
Comments inline
Ted Gould (ted) wrote : | # |
On Tue, 2016-08-23 at 17:50 +0000, Charles Kerr wrote:
> > + throw std::runtime_
> > field");
> This should dump the manifest contents same as diff line 313-314 does
> below
Yes, it should: r237
> > auto gapps = json_object_
> gapps is leaked here
Fixed r238
> > + /* Remove entries generated by the desktop hook in .local
> > */
> > + auto fileappid = g_desktop_
> > "x-Ubuntu-
> > + if (fileappid != nullptr)
> > + {
> > + g_free(fileappid);
> > + continue;
> > + }
> g_desktop_
Fixed r239
> > - for (int i = 0; containers[i] != nullptr; i++)
> > + for (int i = 0; containers.get()[i] != nullptr; i++)
> > {
> > - auto container = containers[i];
> > - auto apps = libertine_
> > + auto container = containers.
> > + auto apps =
> > std::shared_
> > ), g_strfreev);
> >
> > - for (int i = 0; apps[i] != nullptr; i++)
> > + for (int i = 0; apps.get()[i] != nullptr; i++)
> 'i' is shadowed from outer loop
If you think we can afford to use a whole 'nother variable. Rich people
programming! Fixed in r240
> > +template <typename T>
> > +auto stringlistFromK
> > const gchar* key, const std::string& exceptionText = {})
> > + -> T
> > +{
> > + GError* error = nullptr;
> > + auto keyval = g_key_file_
> > DESKTOP_GROUP, key, nullptr, nullptr, &error);
> > +
> > + if (error != nullptr)
> > + {
> > + auto perror = std::shared_
> > g_error_free);
> > + if (!exceptionText
> > + {
> > + throw std::runtime_
> > >message);
> > + }
> > +
> > + return T::from_raw({});
> Not exactly a bug, but strange that this function throws an exception
> sometimes but fails silently other times depending on the
> exceptionText input.
>
> This is the kind of thing that makes code hard to follow, is it
> really necessary here?
I see what you're saying, but I'm not quite sure how to fix it. We want
to throw exceptions for critical values that are missing. We don't want
to end up with an application object that doesn't really work for us.
Perhaps two different functions that call the same "core" to avoid too
much boiler plate? Not sure that's more readable in the end.
> > + ,
> > _keywords(
> > e, "Keywords"))
> (comment) it feels like overkill to walk through the keyfile for each
> of these in Desktop's constructor, especially since few clients will
> ever ask for all of these.
>
> It would be better if they were lazy-loaded on demand
+1, not for this MR though.
> > +#pragma once
> "#pragma once" should precede the #includes
Fixed r241
> > +/** Helper function for printing JSON nodes to debug output */
> > +std::string Registry:
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:245
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Charles Kerr (charlesk) : | # |
dobey (dobey) wrote : | # |
Some comments inline.
Ted Gould (ted) wrote : | # |
On Thu, 2016-08-25 at 14:21 +0000, Rodney Dawes wrote:
> > + auto containers =
> > std::shared_
> >
> Shouldn't this be gchar**?
No, effectively the shared_ptr<> adds the second *.
> > +/** Helper function for printing JSON objects to debug output */
> > +std::string Registry:
> > jsonobj)
> > +{
> > + auto node = json_node_alloc();
> > + json_node_
> > +
> > + auto snode = std::shared_
> json_node_unref is only available in 1.2, so either need to use _free
> instead, or guard all this with an #if, or get 1.2 backported.
>
> >
> > + return printJson(snode);
> > +}
> > +
> > +/** Helper function for printing JSON nodes to debug output */
> > +std::string Registry:
> > jsonnode)
> > +{
> > + std::string retval;
> > + auto gstr = json_to_
> json_to_string is only available in 1.2, so this will need to be
> guarded by an #if, or we'll need to try to get a newer json-glib
> backported, so this will compile on vivid.
Fixed r247
> === added file 'tests/link-
> > farm/com.
> > --- tests/link-
> > 1970-01-01 00:00:00 +0000
> > +++ tests/link-
> > 2016-08-24 20:25:49 +0000
> > @@ -0,0 +1 @@
> > +Needs to exist
> Why does this need to exist, and why isn't it a valid .desktop file,
> particularly for something called "com.test.
Because we only check its existence. It is normally a link created by
click, but we're simulating that with some simple files for the test
suite.
> > + void pause(guint time = 0)
> > + {
> > + if (time > 0)
> > + {
> > + GMainLoop* mainloop = g_main_
> > +
> > + g_timeout_add(time,
> > + [](gpointer pmainloop) -> gboolean {
> > + g_main_
> > op*>(pmainloop));
> > + return G_SOURCE_REMOVE;
> > + },
> > + mainloop);
> > +
> > + g_main_
> > +
> > + g_main_
> > + }
> > +
> > + while (g_main_pending())
> > + {
> > + g_main_
> > + }
> > + }
> Isn't this duplicated from the other eventually branch? Why?
> Shouldn't that be used here, instead of duplicating code?
Ah, yeah, it was written before that branch existed, but it should use
that now that it does exist.
Fixed r248
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:246
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:248
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:249
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:251
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Charles Kerr (charlesk) : | # |
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:252
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:253
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Charles Kerr (charlesk) wrote : | # |
> review: Approve (continuous-
<neo> whoa. </neo>
dobey (dobey) : | # |
Preview Diff
1 | === modified file 'libubuntu-app-launch/CMakeLists.txt' |
2 | --- libubuntu-app-launch/CMakeLists.txt 2016-08-07 03:34:52 +0000 |
3 | +++ libubuntu-app-launch/CMakeLists.txt 2016-09-06 16:14:02 +0000 |
4 | @@ -8,6 +8,11 @@ |
5 | |
6 | add_lttng_gen_tp(NAME ubuntu-app-launch-trace) |
7 | |
8 | +EXECUTE_PROCESS(COMMAND gcc -dumpversion OUTPUT_VARIABLE GCC_VERSION) |
9 | +if ("${GCC_VERSION}" VERSION_LESS "5.0") |
10 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=pedantic") |
11 | +endif() |
12 | + |
13 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") |
14 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wpedantic") |
15 | add_definitions ( -DOOM_HELPER="${pkglibexecdir}/oom-adjust-setuid-helper" -DDEMANGLER_PATH="${pkglibexecdir}/socket-demangler" ) |
16 | @@ -64,8 +69,25 @@ |
17 | |
18 | add_gdbus_codegen_with_namespace(LAUNCHER_GEN_SOURCES proxy-socket-demangler com.canonical.UbuntuAppLaunch. proxy ${CMAKE_SOURCE_DIR}/data/com.canonical.UbuntuAppLaunch.SocketDemangler.xml) |
19 | |
20 | - |
21 | -add_library(ubuntu-launcher SHARED ${LAUNCHER_SOURCES} ${LAUNCHER_GEN_SOURCES}) |
22 | +add_library(launcher-static ${LAUNCHER_SOURCES} ${LAUNCHER_CPP_SOURCES} ${LAUNCHER_GEN_SOURCES}) |
23 | + |
24 | +target_link_libraries(launcher-static |
25 | + ${GLIB2_LIBARIES} |
26 | + ${GOBJECT2_LIBRARIES} |
27 | + ${LIBUPSTART_LIBRARIES} |
28 | + ${GIO2_LIBRARIES} |
29 | + ${LTTNG_LIBRARIES} |
30 | + ${JSONGLIB_LIBRARIES} |
31 | + ${CLICK_LIBRARIES} |
32 | + ${ZEITGEIST_LIBRARIES} |
33 | + ${MIR_LIBRARIES} |
34 | + ${LIBERTINE_LIBRARIES} |
35 | + -lpthread |
36 | + helpers |
37 | + -Wl,--no-undefined |
38 | +) |
39 | + |
40 | +add_library(ubuntu-launcher SHARED ${LAUNCHER_SOURCES} ${LAUNCHER_CPP_SOURCES} ${LAUNCHER_GEN_SOURCES}) |
41 | |
42 | set_target_properties(ubuntu-launcher PROPERTIES |
43 | VERSION ${ABI_VERSION}.0.0 |
44 | |
45 | === modified file 'libubuntu-app-launch/application-impl-click.cpp' |
46 | --- libubuntu-app-launch/application-impl-click.cpp 2016-09-02 13:50:36 +0000 |
47 | +++ libubuntu-app-launch/application-impl-click.cpp 2016-09-06 16:14:02 +0000 |
48 | @@ -21,6 +21,8 @@ |
49 | #include "application-info-desktop.h" |
50 | #include "registry-impl.h" |
51 | |
52 | +#include <algorithm> |
53 | + |
54 | namespace ubuntu |
55 | { |
56 | namespace app_launch |
57 | @@ -31,6 +33,7 @@ |
58 | AppID::Version manifestVersion(const std::shared_ptr<JsonObject>& manifest); |
59 | std::list<AppID::AppName> manifestApps(const std::shared_ptr<JsonObject>& manifest); |
60 | std::shared_ptr<GKeyFile> manifestAppDesktop(const std::shared_ptr<JsonObject>& manifest, |
61 | + const std::string& package, |
62 | const std::string& app, |
63 | const std::string& clickDir); |
64 | |
65 | @@ -44,7 +47,7 @@ |
66 | , _appid(appid) |
67 | , _manifest(manifest) |
68 | , _clickDir(registry->impl->getClickDir(appid.package)) |
69 | - , _keyfile(manifestAppDesktop(manifest, appid.appname, _clickDir)) |
70 | + , _keyfile(manifestAppDesktop(manifest, appid.package, appid.appname, _clickDir)) |
71 | { |
72 | if (!_keyfile) |
73 | throw std::runtime_error{"No keyfile found for click application: " + (std::string)appid}; |
74 | @@ -62,11 +65,11 @@ |
75 | |
76 | AppID::Version manifestVersion(const std::shared_ptr<JsonObject>& manifest) |
77 | { |
78 | - const gchar* cstr; |
79 | + const gchar* cstr = nullptr; |
80 | if (!json_object_has_member(manifest.get(), "version") || |
81 | (cstr = json_object_get_string_member(manifest.get(), "version")) == nullptr) |
82 | { |
83 | - throw std::runtime_error("Unable to find version number in manifest"); |
84 | + throw std::runtime_error("Unable to find version number in manifest: " + Registry::Impl::printJson(manifest)); |
85 | } |
86 | |
87 | auto cppstr = AppID::Version::from_raw(cstr); |
88 | @@ -79,12 +82,14 @@ |
89 | if (!json_object_has_member(manifest.get(), "hooks") || |
90 | (hooks = json_object_get_object_member(manifest.get(), "hooks")) == nullptr) |
91 | { |
92 | - throw std::runtime_error("Manifest does not have a 'hooks' field"); |
93 | + throw std::runtime_error("Manifest does not have a 'hooks' field: " + Registry::Impl::printJson(manifest)); |
94 | } |
95 | |
96 | auto gapps = json_object_get_members(hooks); |
97 | if (gapps == nullptr) |
98 | + { |
99 | throw std::runtime_error("GLib JSON confusion, please talk to your library vendor"); |
100 | + } |
101 | |
102 | std::list<AppID::AppName> apps; |
103 | |
104 | @@ -105,26 +110,45 @@ |
105 | } |
106 | |
107 | std::shared_ptr<GKeyFile> manifestAppDesktop(const std::shared_ptr<JsonObject>& manifest, |
108 | + const std::string& package, |
109 | const std::string& app, |
110 | const std::string& clickDir) |
111 | { |
112 | + if (!manifest) |
113 | + { |
114 | + throw std::runtime_error("No manifest for package '" + package + "'"); |
115 | + } |
116 | + |
117 | JsonObject* hooks = nullptr; |
118 | if (!json_object_has_member(manifest.get(), "hooks") || |
119 | (hooks = json_object_get_object_member(manifest.get(), "hooks")) == nullptr) |
120 | { |
121 | - throw std::runtime_error("Manifest for application '" + app + "' does not have a 'hooks' field"); |
122 | + throw std::runtime_error("Manifest for application '" + app + "' does not have a 'hooks' field: " + |
123 | + Registry::Impl::printJson(manifest)); |
124 | + } |
125 | + |
126 | + auto gapps = json_object_get_members(hooks); |
127 | + if (gapps == nullptr) |
128 | + { |
129 | + throw std::runtime_error("GLib JSON confusion, please talk to your library vendor"); |
130 | + } |
131 | + else |
132 | + { |
133 | + g_list_free(gapps); |
134 | } |
135 | |
136 | JsonObject* hooklist = nullptr; |
137 | if (!json_object_has_member(hooks, app.c_str()) || |
138 | (hooklist = json_object_get_object_member(hooks, app.c_str())) == nullptr) |
139 | { |
140 | - throw std::runtime_error("Manifest does not have an application '" + app + "'"); |
141 | + throw std::runtime_error("Manifest for does not have an application '" + app + "': " + |
142 | + Registry::Impl::printJson(manifest)); |
143 | } |
144 | |
145 | auto desktoppath = json_object_get_string_member(hooklist, "desktop"); |
146 | if (desktoppath == nullptr) |
147 | - throw std::runtime_error("Manifest for application '" + app + "' does not have a 'desktop' hook"); |
148 | + throw std::runtime_error("Manifest for application '" + app + "' does not have a 'desktop' hook: " + |
149 | + Registry::Impl::printJson(manifest)); |
150 | |
151 | auto path = std::shared_ptr<gchar>(g_build_filename(clickDir.c_str(), desktoppath, nullptr), g_free); |
152 | |
153 | @@ -169,7 +193,8 @@ |
154 | } |
155 | catch (std::runtime_error& e) |
156 | { |
157 | - g_debug("%s", e.what()); |
158 | + g_debug("Unable to get information to build Click app on package '%s': %s", pkg.value().c_str(), |
159 | + e.what()); |
160 | } |
161 | } |
162 | } |
163 | |
164 | === modified file 'libubuntu-app-launch/application-impl-legacy.cpp' |
165 | --- libubuntu-app-launch/application-impl-legacy.cpp 2016-08-17 15:24:23 +0000 |
166 | +++ libubuntu-app-launch/application-impl-legacy.cpp 2016-09-06 16:14:02 +0000 |
167 | @@ -144,6 +144,12 @@ |
168 | continue; |
169 | } |
170 | |
171 | + /* Remove entries generated by the desktop hook in .local */ |
172 | + if (g_desktop_app_info_has_key(appinfo, "X-Ubuntu-Application-ID")) |
173 | + { |
174 | + continue; |
175 | + } |
176 | + |
177 | try |
178 | { |
179 | auto app = std::make_shared<Legacy>(AppID::AppName::from_raw(appname), registry); |
180 | |
181 | === modified file 'libubuntu-app-launch/application-impl-libertine.cpp' |
182 | --- libubuntu-app-launch/application-impl-libertine.cpp 2016-08-17 15:24:23 +0000 |
183 | +++ libubuntu-app-launch/application-impl-libertine.cpp 2016-09-06 16:14:02 +0000 |
184 | @@ -111,23 +111,20 @@ |
185 | { |
186 | std::list<std::shared_ptr<Application>> applist; |
187 | |
188 | - auto containers = libertine_list_containers(); |
189 | + auto containers = std::shared_ptr<gchar*>(libertine_list_containers(), g_strfreev); |
190 | |
191 | - for (int i = 0; containers[i] != nullptr; i++) |
192 | + for (int i = 0; containers.get()[i] != nullptr; i++) |
193 | { |
194 | - auto container = containers[i]; |
195 | - auto apps = libertine_list_apps_for_container(container); |
196 | + auto container = containers.get()[i]; |
197 | + auto apps = std::shared_ptr<gchar*>(libertine_list_apps_for_container(container), g_strfreev); |
198 | |
199 | - for (int i = 0; apps[i] != nullptr; i++) |
200 | + for (int j = 0; apps.get()[j] != nullptr; j++) |
201 | { |
202 | - auto sapp = std::make_shared<Libertine>(AppID::Package::from_raw(container), |
203 | - AppID::AppName::from_raw(apps[i]), registry); |
204 | + auto appid = AppID::parse(apps.get()[j]); |
205 | + auto sapp = std::make_shared<Libertine>(appid.package, appid.appname, registry); |
206 | applist.push_back(sapp); |
207 | } |
208 | - |
209 | - g_strfreev(apps); |
210 | } |
211 | - g_strfreev(containers); |
212 | |
213 | return applist; |
214 | } |
215 | |
216 | === modified file 'libubuntu-app-launch/glib-thread.h' |
217 | --- libubuntu-app-launch/glib-thread.h 2016-02-08 21:28:43 +0000 |
218 | +++ libubuntu-app-launch/glib-thread.h 2016-09-06 16:14:02 +0000 |
219 | @@ -17,8 +17,10 @@ |
220 | * Ted Gould <ted.gould@canonical.com> |
221 | */ |
222 | |
223 | +#pragma once |
224 | + |
225 | +#include <future> |
226 | #include <thread> |
227 | -#include <future> |
228 | |
229 | #include <gio/gio.h> |
230 | |
231 | @@ -33,14 +35,7 @@ |
232 | std::shared_ptr<GCancellable> _cancel; |
233 | |
234 | public: |
235 | - ContextThread(std::function<void()> beforeLoop = |
236 | - [] |
237 | - { |
238 | - }, |
239 | - std::function<void()> afterLoop = |
240 | - [] |
241 | - { |
242 | - }); |
243 | + ContextThread(std::function<void()> beforeLoop = [] {}, std::function<void()> afterLoop = [] {}); |
244 | ~ContextThread(); |
245 | |
246 | void quit(); |
247 | @@ -58,9 +53,15 @@ |
248 | } |
249 | |
250 | std::promise<T> promise; |
251 | - std::function<void()> magicFunc = [&promise, &work]() |
252 | - { |
253 | - promise.set_value(work()); |
254 | + std::function<void()> magicFunc = [&promise, &work]() { |
255 | + try |
256 | + { |
257 | + promise.set_value(work()); |
258 | + } |
259 | + catch (...) |
260 | + { |
261 | + promise.set_exception(std::current_exception()); |
262 | + } |
263 | }; |
264 | |
265 | executeOnThread(magicFunc); |
266 | |
267 | === modified file 'libubuntu-app-launch/registry-impl.cpp' |
268 | --- libubuntu-app-launch/registry-impl.cpp 2016-09-02 13:50:36 +0000 |
269 | +++ libubuntu-app-launch/registry-impl.cpp 2016-09-06 16:14:02 +0000 |
270 | @@ -87,6 +87,7 @@ |
271 | } |
272 | } |
273 | |
274 | + g_debug("Initialized Click DB"); |
275 | return true; |
276 | }); |
277 | |
278 | @@ -96,6 +97,43 @@ |
279 | } |
280 | } |
281 | |
282 | +#if JSON_CHECK_VERSION(1, 1, 2) |
283 | +/** Helper function for printing JSON objects to debug output */ |
284 | +std::string Registry::Impl::printJson(std::shared_ptr<JsonObject> jsonobj) |
285 | +{ |
286 | + auto node = json_node_alloc(); |
287 | + json_node_init_object(node, jsonobj.get()); |
288 | + |
289 | + auto snode = std::shared_ptr<JsonNode>(node, json_node_unref); |
290 | + return printJson(snode); |
291 | +} |
292 | + |
293 | +/** Helper function for printing JSON nodes to debug output */ |
294 | +std::string Registry::Impl::printJson(std::shared_ptr<JsonNode> jsonnode) |
295 | +{ |
296 | + std::string retval; |
297 | + auto gstr = json_to_string(jsonnode.get(), TRUE); |
298 | + |
299 | + if (gstr != nullptr) |
300 | + { |
301 | + retval = gstr; |
302 | + g_free(gstr); |
303 | + } |
304 | + |
305 | + return retval; |
306 | +} |
307 | +#else |
308 | +std::string Registry::Impl::printJson(std::shared_ptr<JsonObject> jsonobj) |
309 | +{ |
310 | + return "Your JSON-GLib is too old to print the JSON here, please talk to your vendor about upgrading"; |
311 | +} |
312 | + |
313 | +std::string Registry::Impl::printJson(std::shared_ptr<JsonNode> jsonnode) |
314 | +{ |
315 | + return "Your JSON-GLib is too old to print the JSON here, please talk to your vendor about upgrading"; |
316 | +} |
317 | +#endif |
318 | + |
319 | std::shared_ptr<JsonObject> Registry::Impl::getClickManifest(const std::string& package) |
320 | { |
321 | initClick(); |
322 | @@ -116,10 +154,7 @@ |
323 | |
324 | auto retval = std::shared_ptr<JsonObject>(json_node_dup_object(node), json_object_unref); |
325 | |
326 | -#if JSON_CHECK_VERSION(1, 1, 2) |
327 | - // Not available in json-glib 1.0, so must leak there. |
328 | - json_node_unref(node); |
329 | -#endif |
330 | + json_node_free(node); |
331 | |
332 | return retval; |
333 | }); |
334 | @@ -147,7 +182,7 @@ |
335 | std::list<AppID::Package> list; |
336 | for (GList* item = pkgs; item != NULL; item = g_list_next(item)) |
337 | { |
338 | - auto pkgobj = reinterpret_cast<char*>(item->data); |
339 | + auto pkgobj = reinterpret_cast<gchar*>(item->data); |
340 | if (pkgobj) |
341 | { |
342 | list.emplace_back(AppID::Package::from_raw(pkgobj)); |
343 | |
344 | === modified file 'libubuntu-app-launch/registry-impl.h' |
345 | --- libubuntu-app-launch/registry-impl.h 2016-09-02 14:09:10 +0000 |
346 | +++ libubuntu-app-launch/registry-impl.h 2016-09-06 16:14:02 +0000 |
347 | @@ -70,6 +70,9 @@ |
348 | std::list<std::string> upstartInstancesForJob(const std::string& job); |
349 | std::string upstartJobPath(const std::string& job); |
350 | |
351 | + static std::string printJson(std::shared_ptr<JsonObject> jsonobj); |
352 | + static std::string printJson(std::shared_ptr<JsonNode> jsonnode); |
353 | + |
354 | /* Signal Hints */ |
355 | /* NOTE: Static because we don't have registry instances in the C |
356 | code right now. We want these to not be static in the future */ |
357 | |
358 | === modified file 'tests/CMakeLists.txt' |
359 | --- tests/CMakeLists.txt 2016-08-07 03:34:52 +0000 |
360 | +++ tests/CMakeLists.txt 2016-09-06 16:14:02 +0000 |
361 | @@ -57,18 +57,19 @@ |
362 | add_test (NAME libual-test COMMAND libual-test) |
363 | add_test (NAME libual-cpp-test COMMAND libual-cpp-test) |
364 | |
365 | +# List Apps |
366 | + |
367 | +add_executable (list-apps |
368 | + list-apps.cpp) |
369 | +target_link_libraries (list-apps gtest ${GTEST_LIBS} launcher-static) |
370 | +add_test (NAME list-apps COMMAND ${CMAKE_CURRENT_BINARY_DIR}/list-apps) |
371 | + |
372 | # Application Info Desktop |
373 | |
374 | add_executable (application-info-desktop-test |
375 | - # test |
376 | application-info-desktop.cpp |
377 | - |
378 | - # sources |
379 | - ${CMAKE_SOURCE_DIR}/libubuntu-app-launch/application-info-desktop.cpp |
380 | - ${CMAKE_SOURCE_DIR}/libubuntu-app-launch/application-icon-finder.cpp |
381 | - ${CMAKE_SOURCE_DIR}/libubuntu-app-launch/glib-thread.cpp |
382 | - ${CMAKE_SOURCE_DIR}/libubuntu-app-launch/registry-impl.cpp) |
383 | -target_link_libraries (application-info-desktop-test gtest ${GTEST_LIBS} ubuntu-launcher) |
384 | +) |
385 | +target_link_libraries (application-info-desktop-test gtest ${GTEST_LIBS} launcher-static) |
386 | |
387 | add_test (NAME application-info-desktop-test COMMAND application-info-desktop-test) |
388 | |
389 | @@ -139,5 +140,9 @@ |
390 | # Formatted code |
391 | |
392 | add_custom_target(format-tests |
393 | - COMMAND clang-format -i -style=file libual-cpp-test.cc eventually-fixture.h zg-test.cc |
394 | + COMMAND clang-format -i -style=file |
395 | + libual-cpp-test.cc |
396 | + list-apps.cpp |
397 | + eventually-fixture.h |
398 | + zg-test.cc |
399 | ) |
400 | |
401 | === modified file 'tests/applications/foo.desktop' |
402 | --- tests/applications/foo.desktop 2013-09-24 03:01:51 +0000 |
403 | +++ tests/applications/foo.desktop 2016-09-06 16:14:02 +0000 |
404 | @@ -5,3 +5,4 @@ |
405 | NoDisplay=false |
406 | Hidden=false |
407 | Terminal=false |
408 | +Icon=foo.png |
409 | |
410 | === modified file 'tests/applications/multiple.desktop' |
411 | --- tests/applications/multiple.desktop 2013-12-12 03:08:11 +0000 |
412 | +++ tests/applications/multiple.desktop 2016-09-06 16:14:02 +0000 |
413 | @@ -5,4 +5,5 @@ |
414 | NoDisplay=false |
415 | Hidden=false |
416 | Terminal=false |
417 | +Icon=multiple.png |
418 | X-Ubuntu-Single-Instance=false |
419 | |
420 | === modified file 'tests/applications/noxmir.desktop' |
421 | --- tests/applications/noxmir.desktop 2015-07-01 21:59:17 +0000 |
422 | +++ tests/applications/noxmir.desktop 2016-09-06 16:14:02 +0000 |
423 | @@ -6,3 +6,4 @@ |
424 | Hidden=false |
425 | Terminal=false |
426 | X-Ubuntu-XMir-Enable=false |
427 | +Icon=no-xmir.png |
428 | |
429 | === modified file 'tests/applications/single.desktop' |
430 | --- tests/applications/single.desktop 2013-12-12 03:08:11 +0000 |
431 | +++ tests/applications/single.desktop 2016-09-06 16:14:02 +0000 |
432 | @@ -1,8 +1,11 @@ |
433 | [Desktop Entry] |
434 | Name=Single |
435 | Type=Application |
436 | +Version=1.0 |
437 | +Comment=A comment |
438 | Exec=single |
439 | NoDisplay=false |
440 | Hidden=false |
441 | Terminal=false |
442 | +Icon=single.png |
443 | X-Ubuntu-Single-Instance=true |
444 | |
445 | === modified file 'tests/applications/xmir.desktop' |
446 | --- tests/applications/xmir.desktop 2015-07-01 21:59:17 +0000 |
447 | +++ tests/applications/xmir.desktop 2016-09-06 16:14:02 +0000 |
448 | @@ -6,3 +6,4 @@ |
449 | Hidden=false |
450 | Terminal=false |
451 | X-Ubuntu-XMir-Enable=true |
452 | +Icon=xmir.png |
453 | |
454 | === modified file 'tests/click-app-dir/.click/info/chatter.robert-ancell.manifest' |
455 | --- tests/click-app-dir/.click/info/chatter.robert-ancell.manifest 2016-08-01 21:07:07 +0000 |
456 | +++ tests/click-app-dir/.click/info/chatter.robert-ancell.manifest 2016-09-06 16:14:02 +0000 |
457 | @@ -1,7 +1,7 @@ |
458 | { |
459 | "version": "2", |
460 | "hooks": { |
461 | - "application": { |
462 | + "chatter": { |
463 | "desktop": "chatter.desktop" |
464 | } |
465 | } |
466 | |
467 | === modified file 'tests/click-app-dir/application.desktop' |
468 | --- tests/click-app-dir/application.desktop 2016-01-20 22:11:08 +0000 |
469 | +++ tests/click-app-dir/application.desktop 2016-09-06 16:14:02 +0000 |
470 | @@ -3,4 +3,4 @@ |
471 | Name=Application |
472 | Type=Application |
473 | Exec=grep |
474 | -Icon=foo |
475 | +Icon=foo.png |
476 | |
477 | === modified file 'tests/click-app-dir/noxmir.desktop' |
478 | --- tests/click-app-dir/noxmir.desktop 2015-07-02 02:38:56 +0000 |
479 | +++ tests/click-app-dir/noxmir.desktop 2016-09-06 16:14:02 +0000 |
480 | @@ -6,3 +6,4 @@ |
481 | Hidden=false |
482 | Terminal=false |
483 | X-Ubuntu-XMir-Enable=false |
484 | +Icon=nomir.png |
485 | |
486 | === modified file 'tests/click-app-dir/xmir.desktop' |
487 | --- tests/click-app-dir/xmir.desktop 2015-07-02 02:38:56 +0000 |
488 | +++ tests/click-app-dir/xmir.desktop 2016-09-06 16:14:02 +0000 |
489 | @@ -6,3 +6,4 @@ |
490 | Hidden=false |
491 | Terminal=false |
492 | X-Ubuntu-XMir-Enable=true |
493 | +Icon=xfoo.png |
494 | |
495 | === modified file 'tests/eventually-fixture.h' |
496 | --- tests/eventually-fixture.h 2016-08-17 15:08:14 +0000 |
497 | +++ tests/eventually-fixture.h 2016-09-06 16:14:02 +0000 |
498 | @@ -26,7 +26,7 @@ |
499 | class EventuallyFixture : public ::testing::Test |
500 | { |
501 | protected: |
502 | - std::chrono::milliseconds _eventuallyTime = std::chrono::seconds{10}; |
503 | + std::chrono::milliseconds _eventuallyTime = std::chrono::minutes{1}; |
504 | |
505 | static gboolean timeout_cb(gpointer user_data) |
506 | { |
507 | |
508 | === added directory 'tests/libertine-home/libertine' |
509 | === modified file 'tests/libertine-home/libertine-container/user-data/container-name/.local/share/applications/user-app.desktop' |
510 | --- tests/libertine-home/libertine-container/user-data/container-name/.local/share/applications/user-app.desktop 2015-08-11 19:11:15 +0000 |
511 | +++ tests/libertine-home/libertine-container/user-data/container-name/.local/share/applications/user-app.desktop 2016-09-06 16:14:02 +0000 |
512 | @@ -2,3 +2,4 @@ |
513 | Name=User App |
514 | Type=Application |
515 | Exec=user-app |
516 | +Icon=user-app.png |
517 | |
518 | === added file 'tests/libertine-home/libertine/ContainersConfig.json' |
519 | --- tests/libertine-home/libertine/ContainersConfig.json 1970-01-01 00:00:00 +0000 |
520 | +++ tests/libertine-home/libertine/ContainersConfig.json 2016-09-06 16:14:02 +0000 |
521 | @@ -0,0 +1,16 @@ |
522 | + |
523 | +{ |
524 | + "containerList": [ |
525 | + { |
526 | + "distro": "xenial", |
527 | + "id": "container-name", |
528 | + "installStatus": "ready", |
529 | + "installedApps": [ |
530 | + ], |
531 | + "multiarch": "disabled", |
532 | + "name": "Container Name", |
533 | + "type": "lxc" |
534 | + } |
535 | + ], |
536 | + "defaultContainer": "container-name" |
537 | +} |
538 | |
539 | === modified file 'tests/libual-cpp-test.cc' |
540 | --- tests/libual-cpp-test.cc 2016-08-17 15:24:23 +0000 |
541 | +++ tests/libual-cpp-test.cc 2016-09-06 16:14:02 +0000 |
542 | @@ -18,14 +18,13 @@ |
543 | */ |
544 | |
545 | #include <algorithm> |
546 | +#include <fcntl.h> |
547 | #include <functional> |
548 | -#include <fcntl.h> |
549 | #include <future> |
550 | -#include <numeric> |
551 | -#include <thread> |
552 | #include <gio/gio.h> |
553 | #include <gtest/gtest.h> |
554 | #include <libdbustest/dbus-test.h> |
555 | +#include <numeric> |
556 | #include <thread> |
557 | #include <zeitgeist.h> |
558 | |
559 | @@ -248,7 +247,7 @@ |
560 | |
561 | g_object_unref(bus); |
562 | |
563 | - EXPECT_EVENTUALLY_EQ(nullptr, bus); |
564 | + ASSERT_EVENTUALLY_EQ(nullptr, bus); |
565 | } |
566 | |
567 | GVariant* find_env(GVariant* env_array, const gchar* var) |
568 | @@ -331,7 +330,7 @@ |
569 | guint len = 0; |
570 | const DbusTestDbusMockCall* calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL); |
571 | EXPECT_NE(nullptr, calls); |
572 | - EXPECT_EQ(1, len); |
573 | + ASSERT_EQ(1, len); |
574 | |
575 | EXPECT_STREQ("Start", calls->name); |
576 | EXPECT_EQ(2, g_variant_n_children(calls->params)); |
577 | @@ -357,7 +356,7 @@ |
578 | len = 0; |
579 | calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL); |
580 | EXPECT_NE(nullptr, calls); |
581 | - EXPECT_EQ(1, len); |
582 | + ASSERT_EQ(1, len); |
583 | |
584 | env = g_variant_get_child_value(calls->params, 0); |
585 | EXPECT_TRUE(check_env(env, "APP_ID", "com.test.multiple_first_1.2.3")); |
586 | @@ -381,7 +380,7 @@ |
587 | guint len = 0; |
588 | const DbusTestDbusMockCall* calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL); |
589 | EXPECT_NE(nullptr, calls); |
590 | - EXPECT_EQ(1, len); |
591 | + ASSERT_EQ(1, len); |
592 | |
593 | EXPECT_STREQ("Start", calls->name); |
594 | EXPECT_EQ(2, g_variant_n_children(calls->params)); |
595 | @@ -405,7 +404,7 @@ |
596 | auto app = ubuntu::app_launch::Application::create(appid, registry); |
597 | |
598 | ASSERT_TRUE(app->hasInstances()); |
599 | - EXPECT_EQ(1, app->instances().size()); |
600 | + ASSERT_EQ(1, app->instances().size()); |
601 | |
602 | app->instances()[0]->stop(); |
603 | |
604 | @@ -473,7 +472,7 @@ |
605 | ASSERT_TRUE(dbus_test_dbus_mock_object_clear_method_calls(cgmock, cgobject, NULL)); |
606 | EXPECT_TRUE(app->instances()[0]->hasPid(100)); |
607 | calls = dbus_test_dbus_mock_object_get_method_calls(cgmock, cgobject, "GetTasksRecursive", &len, NULL); |
608 | - EXPECT_EQ(1, len); |
609 | + ASSERT_EQ(1, len); |
610 | EXPECT_STREQ("GetTasksRecursive", calls->name); |
611 | EXPECT_TRUE(g_variant_equal( |
612 | calls->params, g_variant_new("(ss)", "freezer", "upstart/application-click-com.test.good_application_1.2.3"))); |
613 | @@ -482,7 +481,7 @@ |
614 | /* Click out of the set */ |
615 | EXPECT_FALSE(app->instances()[0]->hasPid(101)); |
616 | calls = dbus_test_dbus_mock_object_get_method_calls(cgmock, cgobject, "GetTasksRecursive", &len, NULL); |
617 | - EXPECT_EQ(1, len); |
618 | + ASSERT_EQ(1, len); |
619 | EXPECT_STREQ("GetTasksRecursive", calls->name); |
620 | EXPECT_TRUE(g_variant_equal( |
621 | calls->params, g_variant_new("(ss)", "freezer", "upstart/application-click-com.test.good_application_1.2.3"))); |
622 | @@ -496,7 +495,7 @@ |
623 | EXPECT_TRUE(singleapp->instances()[0]->hasPid(100)); |
624 | |
625 | calls = dbus_test_dbus_mock_object_get_method_calls(cgmock, cgobject, "GetTasksRecursive", &len, NULL); |
626 | - EXPECT_EQ(1, len); |
627 | + ASSERT_EQ(1, len); |
628 | EXPECT_STREQ("GetTasksRecursive", calls->name); |
629 | EXPECT_TRUE(g_variant_equal(calls->params, g_variant_new("(ss)", "freezer", "upstart/application-legacy-single-"))); |
630 | ASSERT_TRUE(dbus_test_dbus_mock_object_clear_method_calls(cgmock, cgobject, NULL)); |
631 | @@ -504,7 +503,7 @@ |
632 | /* Legacy Multi Instance */ |
633 | EXPECT_TRUE(multiapp->instances()[0]->hasPid(100)); |
634 | calls = dbus_test_dbus_mock_object_get_method_calls(cgmock, cgobject, "GetTasksRecursive", &len, NULL); |
635 | - EXPECT_EQ(1, len); |
636 | + ASSERT_EQ(1, len); |
637 | EXPECT_STREQ("GetTasksRecursive", calls->name); |
638 | EXPECT_TRUE(g_variant_equal(calls->params, |
639 | g_variant_new("(ss)", "freezer", "upstart/application-legacy-multiple-2342345"))); |
640 | @@ -591,14 +590,6 @@ |
641 | EXPECT_EQ("single", (std::string)apps.back()->appId()); |
642 | } |
643 | |
644 | - |
645 | -TEST_F(LibUAL, InstalledApplicationList) |
646 | -{ |
647 | - auto apps = ubuntu::app_launch::Registry::installedApps(registry); |
648 | - |
649 | - ASSERT_EQ(12, apps.size()); |
650 | -} |
651 | - |
652 | typedef struct |
653 | { |
654 | unsigned int count; |
655 | @@ -904,7 +895,7 @@ |
656 | guint len = 0; |
657 | const DbusTestDbusMockCall* calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL); |
658 | EXPECT_NE(nullptr, calls); |
659 | - EXPECT_EQ(1, len); |
660 | + ASSERT_EQ(1, len); |
661 | |
662 | EXPECT_STREQ("Start", calls->name); |
663 | EXPECT_EQ(2, g_variant_n_children(calls->params)); |
664 | @@ -929,7 +920,7 @@ |
665 | len = 0; |
666 | calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL); |
667 | EXPECT_NE(nullptr, calls); |
668 | - EXPECT_EQ(1, len); |
669 | + ASSERT_EQ(1, len); |
670 | |
671 | EXPECT_STREQ("Start", calls->name); |
672 | EXPECT_EQ(2, g_variant_n_children(calls->params)); |
673 | @@ -1023,7 +1014,7 @@ |
674 | guint len = 0; |
675 | auto calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL); |
676 | EXPECT_NE(nullptr, calls); |
677 | - EXPECT_EQ(1, len); |
678 | + ASSERT_EQ(1, len); |
679 | |
680 | EXPECT_STREQ("Start", calls->name); |
681 | EXPECT_EQ(2, g_variant_n_children(calls->params)); |
682 | @@ -1049,7 +1040,7 @@ |
683 | len = 0; |
684 | calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL); |
685 | EXPECT_NE(nullptr, calls); |
686 | - EXPECT_EQ(1, len); |
687 | + ASSERT_EQ(1, len); |
688 | |
689 | env = g_variant_get_child_value(calls->params, 0); |
690 | EXPECT_TRUE(check_env(env, "APP_ID", "com.test.multiple_first_1.2.3")); |
691 | @@ -1094,7 +1085,7 @@ |
692 | guint len = 0; |
693 | auto calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Stop", &len, NULL); |
694 | EXPECT_NE(nullptr, calls); |
695 | - EXPECT_EQ(1, len); |
696 | + ASSERT_EQ(1, len); |
697 | |
698 | EXPECT_STREQ("Stop", calls->name); |
699 | EXPECT_EQ(2, g_variant_n_children(calls->params)); |
700 | @@ -1651,7 +1642,7 @@ |
701 | guint len = 0; |
702 | const DbusTestDbusMockCall* calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL); |
703 | EXPECT_NE(nullptr, calls); |
704 | - EXPECT_EQ(1, len); |
705 | + ASSERT_EQ(1, len); |
706 | |
707 | EXPECT_STREQ("Start", calls->name); |
708 | EXPECT_EQ(2, g_variant_n_children(calls->params)); |
709 | @@ -1735,7 +1726,7 @@ |
710 | guint len = 0; |
711 | const DbusTestDbusMockCall* calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "SetEnv", &len, NULL); |
712 | ASSERT_NE(nullptr, calls); |
713 | - EXPECT_EQ(1, len); |
714 | + ASSERT_EQ(1, len); |
715 | |
716 | gchar* appexecstr = g_strdup_printf("APP_EXEC=%s", exec); |
717 | GVariant* appexecenv = g_variant_get_child_value(calls[0].params, 1); |
718 | @@ -1751,7 +1742,7 @@ |
719 | |
720 | calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "SetEnv", &len, NULL); |
721 | ASSERT_NE(nullptr, calls); |
722 | - EXPECT_EQ(1, len); |
723 | + ASSERT_EQ(1, len); |
724 | |
725 | gchar* demangleexecstr = g_strdup_printf("APP_EXEC=%s %s", SOCKET_DEMANGLER_INSTALL, exec); |
726 | appexecenv = g_variant_get_child_value(calls[0].params, 1); |
727 | |
728 | === modified file 'tests/libual-test.cc' |
729 | --- tests/libual-test.cc 2016-08-25 14:20:38 +0000 |
730 | +++ tests/libual-test.cc 2016-09-06 16:14:02 +0000 |
731 | @@ -302,7 +302,7 @@ |
732 | |
733 | g_object_unref(bus); |
734 | |
735 | - EXPECT_EVENTUALLY_EQ(nullptr, bus); |
736 | + ASSERT_EVENTUALLY_EQ(nullptr, bus); |
737 | } |
738 | |
739 | GVariant * find_env (GVariant * env_array, const gchar * var) { |
740 | |
741 | === added file 'tests/link-farm/com.test.good_application_1.2.4.desktop' |
742 | --- tests/link-farm/com.test.good_application_1.2.4.desktop 1970-01-01 00:00:00 +0000 |
743 | +++ tests/link-farm/com.test.good_application_1.2.4.desktop 2016-09-06 16:14:02 +0000 |
744 | @@ -0,0 +1,1 @@ |
745 | +Needs to exist |
746 | |
747 | === added file 'tests/list-apps.cpp' |
748 | --- tests/list-apps.cpp 1970-01-01 00:00:00 +0000 |
749 | +++ tests/list-apps.cpp 2016-09-06 16:14:02 +0000 |
750 | @@ -0,0 +1,138 @@ |
751 | +/* |
752 | + * Copyright © 2016 Canonical Ltd. |
753 | + * |
754 | + * This program is free software: you can redistribute it and/or modify it |
755 | + * under the terms of the GNU General Public License version 3, as published |
756 | + * by the Free Software Foundation. |
757 | + * |
758 | + * This program is distributed in the hope that it will be useful, but |
759 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
760 | + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
761 | + * PURPOSE. See the GNU General Public License for more details. |
762 | + * |
763 | + * You should have received a copy of the GNU General Public License along |
764 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
765 | + * |
766 | + * Authors: |
767 | + * Ted Gould <ted.gould@canonical.com> |
768 | + */ |
769 | + |
770 | +#include <gio/gio.h> |
771 | +#include <glib/gstdio.h> |
772 | +#include <gtest/gtest.h> |
773 | + |
774 | +#include "eventually-fixture.h" |
775 | + |
776 | +#include "application-impl-click.h" |
777 | +#include "application-impl-legacy.h" |
778 | +#include "application-impl-libertine.h" |
779 | +#include "application.h" |
780 | +#include "registry.h" |
781 | + |
782 | +class ListApps : public EventuallyFixture |
783 | +{ |
784 | +protected: |
785 | + GTestDBus* testbus = nullptr; |
786 | + GDBusConnection* bus = nullptr; |
787 | + |
788 | + virtual void SetUp() |
789 | + { |
790 | + /* Click DB test mode */ |
791 | + g_setenv("TEST_CLICK_DB", CMAKE_BINARY_DIR "/click-db-dir", TRUE); |
792 | + g_setenv("TEST_CLICK_USER", "test-user", TRUE); |
793 | + |
794 | + gchar* linkfarmpath = g_build_filename(CMAKE_SOURCE_DIR, "link-farm", nullptr); |
795 | + g_setenv("UBUNTU_APP_LAUNCH_LINK_FARM", linkfarmpath, TRUE); |
796 | + g_free(linkfarmpath); |
797 | + |
798 | + g_setenv("XDG_DATA_DIRS", CMAKE_SOURCE_DIR, TRUE); |
799 | + g_setenv("XDG_CACHE_HOME", CMAKE_SOURCE_DIR "/libertine-data", TRUE); |
800 | + g_setenv("XDG_DATA_HOME", CMAKE_SOURCE_DIR "/libertine-home", TRUE); |
801 | + |
802 | + testbus = g_test_dbus_new(G_TEST_DBUS_NONE); |
803 | + g_test_dbus_up(testbus); |
804 | + |
805 | + bus = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, nullptr); |
806 | + g_dbus_connection_set_exit_on_close(bus, FALSE); |
807 | + g_object_add_weak_pointer(G_OBJECT(bus), (gpointer*)&bus); |
808 | + } |
809 | + |
810 | + virtual void TearDown() |
811 | + { |
812 | + g_object_unref(bus); |
813 | + |
814 | + g_test_dbus_down(testbus); |
815 | + g_clear_object(&testbus); |
816 | + |
817 | + ASSERT_EVENTUALLY_EQ(nullptr, bus); |
818 | + } |
819 | + |
820 | + bool findApp(const std::list<std::shared_ptr<ubuntu::app_launch::Application>>& apps, const std::string& appid) |
821 | + { |
822 | + auto appId = ubuntu::app_launch::AppID::parse(appid); |
823 | + |
824 | + for (auto app : apps) |
825 | + { |
826 | + if (app->appId() == appId) |
827 | + { |
828 | + return true; |
829 | + } |
830 | + } |
831 | + |
832 | + return false; |
833 | + } |
834 | +}; |
835 | + |
836 | +TEST_F(ListApps, ListClick) |
837 | +{ |
838 | + auto registry = std::make_shared<ubuntu::app_launch::Registry>(); |
839 | + auto apps = ubuntu::app_launch::app_impls::Click::list(registry); |
840 | + |
841 | + EXPECT_EQ(11, apps.size()); |
842 | + |
843 | + EXPECT_TRUE(findApp(apps, "chatter.robert-ancell_chatter_2")); |
844 | + EXPECT_TRUE(findApp(apps, "com.test.bad-version_application_4.5.6")); |
845 | + EXPECT_TRUE(findApp(apps, "com.test.good_application_1.2.3")); |
846 | + EXPECT_TRUE(findApp(apps, "com.test.mir_mir_1")); |
847 | + EXPECT_TRUE(findApp(apps, "com.test.mir_nomir_1")); |
848 | + EXPECT_TRUE(findApp(apps, "com.test.multiple_first_1.2.3")); |
849 | + EXPECT_TRUE(findApp(apps, "com.test.multiple_second_1.2.3")); |
850 | + EXPECT_TRUE(findApp(apps, "com.test.multiple_third_1.2.3")); |
851 | + EXPECT_TRUE(findApp(apps, "com.test.multiple_fourth_1.2.3")); |
852 | + EXPECT_TRUE(findApp(apps, "com.test.multiple_fifth_1.2.3")); |
853 | + EXPECT_TRUE(findApp(apps, "com.test.no-app_no-application_1.2.3")); |
854 | + |
855 | + EXPECT_FALSE(findApp(apps, "com.test.no-hooks_application_1.2.3")); |
856 | + EXPECT_FALSE(findApp(apps, "com.test.no-json_application_1.2.3")); |
857 | + EXPECT_FALSE(findApp(apps, "com.test.no-object_application_1.2.3")); |
858 | + EXPECT_FALSE(findApp(apps, "com.test.no-version_application_1.2.3")); |
859 | +} |
860 | + |
861 | +TEST_F(ListApps, ListLegacy) |
862 | +{ |
863 | + auto registry = std::make_shared<ubuntu::app_launch::Registry>(); |
864 | + auto apps = ubuntu::app_launch::app_impls::Legacy::list(registry); |
865 | + |
866 | + EXPECT_EQ(1, apps.size()); |
867 | +} |
868 | + |
869 | +TEST_F(ListApps, ListLibertine) |
870 | +{ |
871 | + auto registry = std::make_shared<ubuntu::app_launch::Registry>(); |
872 | + auto apps = ubuntu::app_launch::app_impls::Libertine::list(registry); |
873 | + |
874 | + EXPECT_EQ(2, apps.size()); |
875 | + |
876 | + EXPECT_TRUE(findApp(apps, "container-name_test_0.0")); |
877 | + EXPECT_TRUE(findApp(apps, "container-name_user-app_0.0")); |
878 | +} |
879 | + |
880 | +TEST_F(ListApps, ListAll) |
881 | +{ |
882 | + auto registry = std::make_shared<ubuntu::app_launch::Registry>(); |
883 | + |
884 | + /* Get all the apps */ |
885 | + auto apps = ubuntu::app_launch::Registry::installedApps(registry); |
886 | + |
887 | + EXPECT_EQ(14, apps.size()); |
888 | +} |
889 | |
890 | === modified file 'tests/zg-test.cc' |
891 | --- tests/zg-test.cc 2016-08-17 04:24:26 +0000 |
892 | +++ tests/zg-test.cc 2016-09-06 16:14:02 +0000 |
893 | @@ -36,7 +36,7 @@ |
894 | { |
895 | g_object_unref(bus); |
896 | |
897 | - EXPECT_EVENTUALLY_EQ(nullptr, bus); |
898 | + ASSERT_EVENTUALLY_EQ(nullptr, bus); |
899 | } |
900 | |
901 | void grabBus() |
902 | |
903 | === modified file 'tools/CMakeLists.txt' |
904 | --- tools/CMakeLists.txt 2016-04-29 21:40:43 +0000 |
905 | +++ tools/CMakeLists.txt 2016-09-06 16:14:02 +0000 |
906 | @@ -26,6 +26,15 @@ |
907 | target_link_libraries(ubuntu-app-info ubuntu-launcher) |
908 | install(TARGETS ubuntu-app-info RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}") |
909 | |
910 | +########################### |
911 | +# ubuntu-app-launch-appids |
912 | +########################### |
913 | + |
914 | +add_executable(ubuntu-app-launch-appids ubuntu-app-launch-appids.cpp) |
915 | +set_target_properties(ubuntu-app-launch-appids PROPERTIES OUTPUT_NAME "ubuntu-app-launch-appids") |
916 | +target_link_libraries(ubuntu-app-launch-appids ubuntu-launcher) |
917 | +install(TARGETS ubuntu-app-launch-appids RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}") |
918 | + |
919 | ######################## |
920 | # ubuntu-app-launch |
921 | ######################## |
922 | |
923 | === added file 'tools/ubuntu-app-launch-appids.cpp' |
924 | --- tools/ubuntu-app-launch-appids.cpp 1970-01-01 00:00:00 +0000 |
925 | +++ tools/ubuntu-app-launch-appids.cpp 2016-09-06 16:14:02 +0000 |
926 | @@ -0,0 +1,39 @@ |
927 | +/* |
928 | + * Copyright 2016 Canonical Ltd. |
929 | + * |
930 | + * This program is free software: you can redistribute it and/or modify it |
931 | + * under the terms of the GNU General Public License version 3, as published |
932 | + * by the Free Software Foundation. |
933 | + * |
934 | + * This program is distributed in the hope that it will be useful, but |
935 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
936 | + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
937 | + * PURPOSE. See the GNU General Public License for more details. |
938 | + * |
939 | + * You should have received a copy of the GNU General Public License along |
940 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
941 | + * |
942 | + * Authors: |
943 | + * Ted Gould <ted.gould@canonical.com> |
944 | + */ |
945 | + |
946 | +#include "libubuntu-app-launch/registry.h" |
947 | +#include <iostream> |
948 | + |
949 | +int main(int argc, char* argv[]) |
950 | +{ |
951 | + if (argc != 1) |
952 | + { |
953 | + std::cerr << "Usage: " << argv[0] << std::endl; |
954 | + exit(EXIT_FAILURE); |
955 | + } |
956 | + |
957 | + auto registry = std::make_shared<ubuntu::app_launch::Registry>(); |
958 | + |
959 | + for (auto app : ubuntu::app_launch::Registry::installedApps(registry)) |
960 | + { |
961 | + std::cout << std::string(app->appId()) << std::endl; |
962 | + } |
963 | + |
964 | + return EXIT_SUCCESS; |
965 | +} |
966 | |
967 | === modified file 'ual-tracepoint.h' |
968 | --- ual-tracepoint.h 2014-08-11 17:18:53 +0000 |
969 | +++ ual-tracepoint.h 2016-09-06 16:14:02 +0000 |
970 | @@ -20,23 +20,6 @@ |
971 | #ifndef UAL_TRACEPOINT_H__ |
972 | #define UAL_TRACEPOINT_H__ 1 |
973 | |
974 | -#include <glib.h> |
975 | - |
976 | -extern int _ual_tracepoints_env_checked; |
977 | -extern int _ual_tracepoints_enabled; |
978 | - |
979 | -/* Little macro that makes it so we can easily turn off all the tracepoints |
980 | - if they're not needed. Also cleans up the code a bit by removing some common |
981 | - elements */ |
982 | - |
983 | -#define ual_tracepoint(point, ...) \ |
984 | - if (G_UNLIKELY(!_ual_tracepoints_env_checked)) { \ |
985 | - _ual_tracepoints_enabled = getenv("UBUNTU_APP_LAUNCH_LTTNG_ENABLED") != NULL; \ |
986 | - _ual_tracepoints_env_checked = 1; \ |
987 | - } \ |
988 | - if (G_UNLIKELY(_ual_tracepoints_enabled)) { \ |
989 | - tracepoint(ubuntu_app_launch, point, __VA_ARGS__); \ |
990 | - } |
991 | - |
992 | +#define ual_tracepoint(point, ...) tracepoint(ubuntu_app_launch, point, __VA_ARGS__) |
993 | |
994 | #endif /* UAL_TRACEPOINT_H__ */ |
FAILED: Continuous integration, rev:233 /jenkins. canonical. com/unity- api-1/job/ lp-ubuntu- app-launch- ci/23/ /jenkins. canonical. com/unity- api-1/job/ build/284/ console /jenkins. canonical. com/unity- api-1/job/ build-0- fetch/290 /jenkins. canonical. com/unity- api-1/job/ build-1- sourcepkg/ release= vivid+overlay/ 224 /jenkins. canonical. com/unity- api-1/job/ build-1- sourcepkg/ release= xenial+ overlay/ 224 /jenkins. canonical. com/unity- api-1/job/ build-1- sourcepkg/ release= yakkety/ 224 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 153/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 153/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 153/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 153/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 153/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 153/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 153/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 153/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= yakkety/ 153/console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/unity- api-1/job/ lp-ubuntu- app-launch- ci/23/rebuild
https:/