Merge lp:~thomas-voss/location-service/add-documentation-and-tooling into lp:location-service/15.04
- add-documentation-and-tooling
- Merge into 15.04
Proposed by
Thomas Voß
Status: | Merged |
---|---|
Approved by: | Alberto Mardegan |
Approved revision: | 172 |
Merged at revision: | 196 |
Proposed branch: | lp:~thomas-voss/location-service/add-documentation-and-tooling |
Merge into: | lp:location-service/15.04 |
Diff against target: |
825 lines (+741/-2) 12 files modified
CMakeLists.txt (+14/-0) _clang-format (+56/-0) astyle-config (+43/-0) doc/Doxyfile.in (+2/-2) doc/daemon_and_cli.md (+55/-0) doc/debugging.md (+92/-0) doc/hacking.md (+146/-0) doc/intro.md (+67/-0) doc/manual_testing.md (+174/-0) doc/tips_n_tricks.md (+21/-0) tools/CMakeLists.txt (+1/-0) tools/symbol_diff.in (+70/-0) |
To merge this branch: | bzr merge lp:~thomas-voss/location-service/add-documentation-and-tooling |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alberto Mardegan (community) | Approve | ||
Loïc Minier | Pending | ||
Review via email: mp+275006@code.launchpad.net |
This proposal supersedes a proposal from 2015-02-02.
Commit message
Add documentation for debugging, hacking and debugging the location service.
Pull manual testing instructions over from the wiki.
Add tools for formatting the source.
Description of the change
Add documentation for debugging, hacking and debugging the location service.
Pull manual testing instructions over from the wiki.
Add tools for formatting the source.
To post a comment you must log in.
Revision history for this message
Loïc Minier (lool) wrote : Posted in a previous version of this proposal | # |
review:
Approve
Revision history for this message
Alberto Mardegan (mardy) wrote : | # |
Looks good (and very instructive!) to me. I wrote a few inline comments, but nothing that should stop this from being merged.
review:
Approve
- 172. By Thomas Voß
-
Address reviewer comments.
Revision history for this message
Alberto Mardegan (mardy) wrote : | # |
The indentation of the commands appears still wrong in the diff (due to TABs being used in other lines), but I'm fine with it. :-)
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 2014-09-18 23:06:08 +0000 |
3 | +++ CMakeLists.txt 2015-10-20 12:02:23 +0000 |
4 | @@ -54,6 +54,20 @@ |
5 | SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-local-typedefs") |
6 | endif (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS) |
7 | |
8 | +# |
9 | +# Code style fixer. We rely on clang-format to adjust the formatting of source code. |
10 | +# |
11 | +find_program(CLANG_FORMAT_COMMAND NAMES clang-format-3.6 clang-format-3.5) |
12 | +if (NOT CLANG_FORMAT_COMMAND) |
13 | + message(WARNING "Cannot find clang-format >= clang-format-3.5: formatcode target will not be available") |
14 | +endif() |
15 | + |
16 | +if (CLANG_FORMAT_COMMAND) |
17 | + file(GLOB_RECURSE UBUNTU_LOCATION_SERVICE_INTERFACE_HEADER_FILES ${CMAKE_SOURCE_DIR}/include/*.h) |
18 | + file(GLOB_RECURSE UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_FILES ${CMAKE_SOURCE_DIR}/src/*.h ${CMAKE_SOURCE_DIR}/src/*.cpp) |
19 | + add_custom_target(formatcode ${CLANG_FORMAT_COMMAND} -i ${UBUNTU_LOCATION_SERVICE_INTERFACE_HEADER_FILES} ${UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_FILES} SOURCES _clang-format) |
20 | +endif() |
21 | + |
22 | include_directories( |
23 | ${Boost_INCLUDE_DIRS} |
24 | ${DBUS_INCLUDE_DIRS} |
25 | |
26 | === added file '_clang-format' |
27 | --- _clang-format 1970-01-01 00:00:00 +0000 |
28 | +++ _clang-format 2015-10-20 12:02:23 +0000 |
29 | @@ -0,0 +1,56 @@ |
30 | +--- |
31 | +Language: Cpp |
32 | +AccessModifierOffset: -4 |
33 | +ConstructorInitializerIndentWidth: 4 |
34 | +AlignEscapedNewlinesLeft: false |
35 | +AlignTrailingComments: true |
36 | +AllowAllParametersOfDeclarationOnNextLine: true |
37 | +AllowShortBlocksOnASingleLine: false |
38 | +AllowShortIfStatementsOnASingleLine: false |
39 | +AllowShortLoopsOnASingleLine: false |
40 | +AllowShortFunctionsOnASingleLine: All |
41 | +AlwaysBreakTemplateDeclarations: false |
42 | +AlwaysBreakBeforeMultilineStrings: false |
43 | +BreakBeforeBinaryOperators: false |
44 | +BreakBeforeTernaryOperators: true |
45 | +BreakConstructorInitializersBeforeComma: false |
46 | +BinPackParameters: true |
47 | +ColumnLimit: 0 |
48 | +ConstructorInitializerAllOnOneLineOrOnePerLine: false |
49 | +DerivePointerAlignment: false |
50 | +ExperimentalAutoDetectBinPacking: false |
51 | +IndentCaseLabels: false |
52 | +IndentWrappedFunctionNames: false |
53 | +IndentFunctionDeclarationAfterType: false |
54 | +MaxEmptyLinesToKeep: 1 |
55 | +KeepEmptyLinesAtTheStartOfBlocks: true |
56 | +NamespaceIndentation: None |
57 | +ObjCSpaceAfterProperty: false |
58 | +ObjCSpaceBeforeProtocolList: true |
59 | +PenaltyBreakBeforeFirstCallParameter: 19 |
60 | +PenaltyBreakComment: 300 |
61 | +PenaltyBreakString: 1000 |
62 | +PenaltyBreakFirstLessLess: 120 |
63 | +PenaltyExcessCharacter: 1000000 |
64 | +PenaltyReturnTypeOnItsOwnLine: 60 |
65 | +PointerAlignment: Left |
66 | +SpacesBeforeTrailingComments: 1 |
67 | +Cpp11BracedListStyle: true |
68 | +Standard: Cpp11 |
69 | +IndentWidth: 4 |
70 | +TabWidth: 8 |
71 | +UseTab: Never |
72 | +BreakBeforeBraces: Allman |
73 | +SpacesInParentheses: false |
74 | +SpacesInAngles: false |
75 | +SpaceInEmptyParentheses: false |
76 | +SpacesInCStyleCastParentheses: false |
77 | +SpacesInContainerLiterals: true |
78 | +SpaceBeforeAssignmentOperators: true |
79 | +ContinuationIndentWidth: 4 |
80 | +CommentPragmas: '^ IWYU pragma:' |
81 | +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] |
82 | +SpaceBeforeParens: ControlStatements |
83 | +DisableFormat: false |
84 | +... |
85 | + |
86 | |
87 | === added file 'astyle-config' |
88 | --- astyle-config 1970-01-01 00:00:00 +0000 |
89 | +++ astyle-config 2015-10-20 12:02:23 +0000 |
90 | @@ -0,0 +1,43 @@ |
91 | +# Options for formatting code with astyle. |
92 | +# |
93 | +# This helps to make code match the style guide. |
94 | +# |
95 | +# Use like this: |
96 | +# |
97 | +# astyle --options=astyle-config mfile.h myfile.cpp |
98 | +# |
99 | +# Occasionally, astyle does something silly (particularly with lambdas), so it's |
100 | +# still necessary to scan the changes for things that are wrong. |
101 | +# But, for most files, it does a good job. |
102 | +# |
103 | +# Please consider using this before checking code in for review. Code reviews shouldn't |
104 | +# have to deal with layout issues, they are just a distraction. It's better to be able |
105 | +# to focus on semantics in a code review, with style issues out of the way. |
106 | + |
107 | +--formatted |
108 | +--style=allman |
109 | +--min-conditional-indent=2 |
110 | +--indent-switches |
111 | +--max-instatement-indent=120 |
112 | +--pad-header |
113 | +--align-pointer=type |
114 | +--align-reference=type |
115 | +--convert-tabs |
116 | +--close-templates |
117 | +--max-code-length=120 |
118 | + |
119 | +# --pad-oper |
120 | +# |
121 | +# Commented out for now. It changes |
122 | +# |
123 | +# for (int i=0; i<10; ++i) |
124 | +# to |
125 | +# for (int i = 0; i < 10; ++i) |
126 | +# |
127 | +# Unfortunately, it also messes with rvalue references: |
128 | +# |
129 | +# ResourcePtr& operator=(ResourcePtr&& r); |
130 | +# |
131 | +# becomes: |
132 | +# |
133 | +# ResourcePtr& operator=(ResourcePtr && r); |
134 | |
135 | === modified file 'doc/Doxyfile.in' |
136 | --- doc/Doxyfile.in 2014-05-19 09:55:25 +0000 |
137 | +++ doc/Doxyfile.in 2015-10-20 12:02:23 +0000 |
138 | @@ -748,7 +748,7 @@ |
139 | # directories that contain image that are included in the documentation (see |
140 | # the \image command). |
141 | |
142 | -IMAGE_PATH = |
143 | +IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images |
144 | |
145 | # The INPUT_FILTER tag can be used to specify a program that doxygen should |
146 | # invoke to filter for each input file. Doxygen will invoke the filter program |
147 | @@ -1463,7 +1463,7 @@ |
148 | # generate an XML file that captures the structure of |
149 | # the code including all documentation. |
150 | |
151 | -GENERATE_XML = NO |
152 | +GENERATE_XML = YES |
153 | |
154 | # The XML_OUTPUT tag is used to specify where the XML pages will be put. |
155 | # If a relative path is entered the value of OUTPUT_DIRECTORY will be |
156 | |
157 | === added file 'doc/daemon_and_cli.md' |
158 | --- doc/daemon_and_cli.md 1970-01-01 00:00:00 +0000 |
159 | +++ doc/daemon_and_cli.md 2015-10-20 12:02:23 +0000 |
160 | @@ -0,0 +1,55 @@ |
161 | +# Service Daemon and CLI |
162 | + |
163 | +The location service offers a daemon executable and a corresponding |
164 | +command-line interface for interacting with it. The daemon does not |
165 | +necessarily require root privileges, but might so depending on your |
166 | +configuration. |
167 | + |
168 | +Run the following command to receive an overview of the arguments to |
169 | +the daemon: |
170 | + |
171 | + ubuntu-location-serviced --help |
172 | + |
173 | +An example invocation of the daemon, configuring a GPS provider that |
174 | +relies on the Android HAL to talk to the chipset, exposing the service |
175 | +on the system DBus instance: |
176 | + |
177 | + ubuntu-location-serviced --bus system --provider gps::Provider |
178 | + |
179 | +The cli allows for querying properties of a running service instance, e.g.: |
180 | + |
181 | + ubuntu-location-serviced-cli --bus system --get --property is_online |
182 | + |
183 | +## Configuring an Out-Of-Process Provider |
184 | + |
185 | +If you want to run a provider out of process, the daemon executable |
186 | +allows you to do so by instantiating a so-called remote provider. The |
187 | +following invocation of the service tries to connect to the provider |
188 | +instance described by the given unique DBus name and path. |
189 | + |
190 | + ubuntu-location-serviced \ |
191 | + --bus system \ |
192 | + --provider remote::Provider \ |
193 | + --remote::Provider::bus=system \ |
194 | + --remote::Provider::name=com.ubuntu.location.provider.Gps \ |
195 | + --remote::Provider::path=/ |
196 | + |
197 | +Please note that the service allows for decorating provider names to |
198 | +uniquely identify per provider configuration options and to allow for |
199 | +loading more than one provider of a certain kind. The following |
200 | +configuration configures two remote providers, one relying on GPS |
201 | +(decorated with @gps) and another one relying on network-based |
202 | +positioning (decorated with @network): |
203 | + |
204 | + ubuntu-location-serviced \ |
205 | + --bus system \ |
206 | + --provider remote::Provider@gps \ |
207 | + --remote::Provider@gps::bus=system \ |
208 | + --remote::Provider@gps::name=com.ubuntu.location.provider.Gps \ |
209 | + --remote::Provider@gps::path=/ \ |
210 | + --provider remote::Provider@network \ |
211 | + --remote::Provider@network::bus=system \ |
212 | + --remote::Provider@network::name=com.ubuntu.location.provider.Network \ |
213 | + --remote::Provider@network::path=/ |
214 | + |
215 | + |
216 | |
217 | === added file 'doc/debugging.md' |
218 | --- doc/debugging.md 1970-01-01 00:00:00 +0000 |
219 | +++ doc/debugging.md 2015-10-20 12:02:23 +0000 |
220 | @@ -0,0 +1,92 @@ |
221 | +# Debugging |
222 | + |
223 | +Location not working? Here's how to debug. |
224 | + |
225 | +## Layers |
226 | + |
227 | +Test in OSMTouch (QML app using Qt API) before testing in webapps or |
228 | +webbrowser app. Different results? File a bug where it doesn't |
229 | +work. Same result of no location? Next step. |
230 | + |
231 | +## Check that stack works with dummy provider |
232 | + |
233 | +Edit /etc/init/ubuntu-location-provider.override to start |
234 | +location-serviced with just the dummy provider; this should |
235 | +work. Doesn't work? File a bug against location-service. Works? Reset |
236 | +config to defaults and try the next thing. |
237 | + |
238 | +## Hardware GPS breaking all of location-service |
239 | + |
240 | +GPS provider is built-in into location-service and might break all of |
241 | +it if it goes south (working on splitting it out); try enabling only |
242 | +the HERE provider on the location-serviced command-line and see if |
243 | +that works. Works? File a bug against location-service. Doesn't work? |
244 | +Move on. |
245 | + |
246 | +## HERE test |
247 | + |
248 | +To test whether the low-level HERE stack gets a location, put |
249 | +http://people.canonical.com/~lool/espoo-cli on your phone (will be |
250 | +included along HERE bits in the future) and run with: |
251 | + |
252 | + chmod a+x espoo-cli |
253 | + GLOG_logtostderr=1 GLOG_v=100 LD_LIBRARY_PATH=/custom/vendor/here/location-provider/lib/arm-linux-gnueabihf ./espoo-cli 5 |
254 | + |
255 | +NB: 5 is the number of location updates after which the tool exits; |
256 | +updates should come in at approx 15s interval. Output looks like: |
257 | + |
258 | + I1101 21:30:01.285964 4403 cli.cpp:117] Requested number of updates is 2 |
259 | + I1101 21:30:01.299002 4403 cli.cpp:133] Starting location updates |
260 | + I1101 21:30:01.301888 4403 cli.cpp:141] Starting GLib main loop |
261 | + I1101 21:30:11.304612 4403 cli.cpp:158] Location: tstamp=1414891811 lat=xyz long=foo hor. acc.=2569 alt=nan vert. acc.=nan tech=cell |
262 | + I1101 21:30:11.306061 4403 cli.cpp:170] Remaining updates: 1 |
263 | + I1101 21:30:26.736821 4403 cli.cpp:158] Location: tstamp=1414891826 lat=xyz long=foo hor. acc.=2824 alt=nan vert. acc.=nan tech=cell |
264 | + I1101 21:30:26.738348 4403 cli.cpp:148] Stopping location updates |
265 | + |
266 | +Low-level HERE stack works but location-serviced with just HERE |
267 | +provider doesn't work? File a bug against espoo projet (HERE) and/or |
268 | +location-service. Low-level HERE stack doesn't work? Move on |
269 | + |
270 | +## location-service and espoo-service debug |
271 | + |
272 | +Collect some debug data by editing /etc/init/ubuntu-espoo-service.conf |
273 | +and /etc/init/ubuntu-location-service.override and changing the start |
274 | +sequence to add some env vars: |
275 | + |
276 | + export GLOG_v=200 |
277 | + export GLOG_logtostderr=1 |
278 | + |
279 | +before the exec. Reboot, and start some app. You should have some log |
280 | +files under /var/log/upstart/ubuntu-espoo-service.log and |
281 | +/var/log/upstart/ubuntu-location-service.log to attach to a bug |
282 | +report; e.g. a working espoo log looks like this: |
283 | + |
284 | + WARNING: Logging before InitGoogleLogging() is written to STDERR |
285 | + I1105 16:30:10.221474 1620 provider.cpp:568] StartPositionUpdates |
286 | + I1105 16:30:10.224901 1620 provider.cpp:122] Successfully started position updates. |
287 | + I1105 16:30:10.228739 1620 provider.cpp:596] StartVelocityUpdates |
288 | + I1105 16:30:13.046851 1621 provider.cpp:83] Received location: Position(lat: Coordinate(12.34 deg), lon: Coordinate(12.34 deg), alt: Coordinate(nan m), hor.acc.: 1430 m, ver.acc.: nan m) |
289 | + |
290 | +No position there? check connectivity API works by running: |
291 | + |
292 | + cd /tmp |
293 | + wget http://people.ubuntu.com/~lool/connectivity |
294 | + GLOG_v=200 GLOG_logtostderr=1 ./connectivity |
295 | + |
296 | +you should see something like: |
297 | + |
298 | + I1105 16:47:26.431466 11140 cached_radio_cell.cpp:160] (mcc: 123, mnc: 2, lac: 1234, id: 123456, asu: 1) |
299 | + I1105 16:47:26.533818 11140 connectivity.cpp:47] Is wifi enabled: true |
300 | + I1105 16:47:26.533963 11140 connectivity.cpp:48] Is wifi hw enabled: true |
301 | + I1105 16:47:26.534010 11140 connectivity.cpp:49] Is wwan enabled: true |
302 | + I1105 16:47:26.534050 11140 connectivity.cpp:50] Is wwan hw enabled: true |
303 | + I1105 16:47:26.534442 11140 connectivity.cpp:122] umts(mcc: 123, mnc: 2, lac: 1234, id: 123456, asu: 1) |
304 | + I1105 16:47:26.534633 11140 connectivity.cpp:155] (bssid: 12:12:12:12:12:12, ssid: xyz, last seen: 1415224046, mode: Mode::infrastructure, frequency: 2442, strength: 63) |
305 | + I1105 16:47:26.534828 11140 connectivity.cpp:155] (bssid: 12:12:12:12:12:12, ssid: boing, last seen: 1415224046, mode: Mode::infrastructure, frequency: 2467, strength: 57) |
306 | + |
307 | +Also, please attach output of /usr/share/ofono/scripts/list-modems > list-modems-output.txt |
308 | +Please note that the command might take ~1 minute to complete. |
309 | + |
310 | +TODO: document dbus-monitor / d-feet capturing of client / system traffic with snooping config. |
311 | + |
312 | + |
313 | |
314 | === added file 'doc/hacking.md' |
315 | --- doc/hacking.md 1970-01-01 00:00:00 +0000 |
316 | +++ doc/hacking.md 2015-10-20 12:02:23 +0000 |
317 | @@ -0,0 +1,146 @@ |
318 | +# Hacking |
319 | + |
320 | + |
321 | +## Building the code |
322 | + |
323 | +By default, the code is built in release mode. To build a debug version, use |
324 | + |
325 | + $ mkdir builddebug |
326 | + $ cd builddebug |
327 | + $ cmake -DCMAKE_BUILD_TYPE=debug .. |
328 | + $ make |
329 | + |
330 | +For a release version, use -DCMAKE_BUILD_TYPE=release |
331 | + |
332 | +## Running the tests |
333 | + |
334 | + $ make |
335 | + $ make test |
336 | + |
337 | +Note that "make test" alone is dangerous because it does not rebuild |
338 | +any tests if either the library or the test files themselves need |
339 | +rebuilding. It's not possible to fix this with cmake because cmake cannot |
340 | +add build dependencies to built-in targets. To make sure that everything |
341 | +is up-to-date, run "make" before running "make test"! |
342 | + |
343 | +## Coverage |
344 | + |
345 | +To build with the flags for coverage testing enabled and get coverage: |
346 | + |
347 | + $ mkdir buildcoverage |
348 | + $ cd buildcoverage |
349 | + $ cmake -DCMAKE_BUILD_TYPE=coverage |
350 | + $ make |
351 | + $ make test |
352 | + $ make coverage |
353 | + |
354 | +Unfortunately, it is not possible to get 100% coverage for some files, |
355 | +mainly due to gcc's generation of two destructors for dynamic and non- |
356 | +dynamic instances. For abstract base classes and for classes that |
357 | +prevent stack and static allocation, this causes one of the destructors |
358 | +to be reported as uncovered. |
359 | + |
360 | +There are also issues with some functions in header files that are |
361 | +incorrectly reported as uncovered due to inlining, as well as |
362 | +the impossibility of covering defensive assert(false) statements, |
363 | +such as an assert in the default branch of a switch, where the |
364 | +switch is meant to handle all possible cases explicitly. |
365 | + |
366 | +If you run a binary and get lots of warnings about a "merge mismatch for summaries", |
367 | +this is caused by having made changes to the source that add or remove code |
368 | +that was previously run, so the new coverage output cannot sensibly be merged |
369 | +into the old coverage output. You can get rid of this problem by running |
370 | + |
371 | + $ make clean-coverage |
372 | + |
373 | +This deletes all the .gcda files, allowing the merge to (sometimes) succeed again. |
374 | +If this doesn't work either, the only remedy is to do a clean build. |
375 | + |
376 | +If lcov complains about unrecognized lines involving '=====', |
377 | +you can patch geninfo and gcovr as explained here: |
378 | + |
379 | +https://bugs.launchpad.net/gcovr/+bug/1086695/comments/2 |
380 | + |
381 | +## Code style |
382 | + |
383 | +We use a format tool that fixes a whole lot of issues |
384 | +regarding code style. The formatting changes made by |
385 | +the tool are generally sensible (even though they may not be your |
386 | +personal preference in all cases). If there is a case where the formatting |
387 | +really messes things up, consider re-arranging the code to avoid the problem. |
388 | +The convenience of running the entire code base through the pretty-printer |
389 | +far outweighs any minor glitches with pretty printing, and it means that |
390 | +we get consistent code style for free, rather than endlessly having to |
391 | +watch out for formatting issues during code reviews. |
392 | + |
393 | +As of clang-format-3.7, you can use |
394 | + |
395 | + // clang-format off |
396 | + void unformatted_code ; |
397 | + // clang-format on |
398 | + |
399 | +to suppress formatting for a section of code. |
400 | + |
401 | +To format specific files: |
402 | + |
403 | + ${CMAKE_BINARY_DIR}/tools/formatcode x.cpp x.h |
404 | + |
405 | +If no arguments are provided, formatcode reads stdin and writes |
406 | +stdout, so you can easily pipe code into the tool from within an |
407 | +editor. For example, to reformat the entire file in vi (assuming |
408 | +${CMAKE_BINARY_DIR}/tools is in your PATH): |
409 | + |
410 | + 1G!Gformatcode |
411 | + |
412 | +To re-format all source and header files in the tree: |
413 | + |
414 | + $ make formatcode |
415 | + |
416 | +## Thread and address sanitizer |
417 | + |
418 | +Set SANITIZER to "thread" or "address" to build with the |
419 | +corresponding sanitizer enabled. |
420 | + |
421 | +## Updating symbols file |
422 | + |
423 | +To easily spot new/removed/changed symbols in the library, the debian |
424 | +package maintains a .symbols file that lists all exported symbols |
425 | +present in the library .so. If you add new public symbols to the library, |
426 | +it's necessary to refresh the symbols file, otherwise the package will |
427 | +fail to build. The easiest way to do that is using bzr-builddeb: |
428 | + |
429 | + $ bzr bd -- -us -uc -j8 # Don't sign source package or changes file, 8 compiles in parallel |
430 | + $ # this will exit with an error if symbols file isn't up-to-date |
431 | + $ cd ../build-area/location-service-[version] |
432 | + $ ./obj-[arch]/tools/symbol_diff |
433 | + |
434 | +This creates a diff of the symbols in /tmp/symbols.diff. |
435 | +(The demangled symbols from the debian build are in ./new_symbols.) |
436 | + |
437 | +Review any changes in /tmp/symbols.diff. If they are OK: |
438 | + |
439 | + $ cd - |
440 | + $ patch -p0 < /tmp/symbols.diff |
441 | + |
442 | +## ABI compliance test |
443 | + |
444 | +To use this, install abi-compliance-checker package from the archives. |
445 | + |
446 | +You can use abi-compliance-checker to test whether a particular build |
447 | +is ABI compatible with another build. The tool does some source-level |
448 | +analysis in addition to checking library symbols, so it catches things |
449 | +that are potentially dangerous, but won't be picked up by just looking |
450 | +at the symbol table. |
451 | + |
452 | +Assume you have built devel in src/devel, and you have a later build |
453 | +in src/mybranch and want to check that mybranch is still compatible. |
454 | +To run the compliance test: |
455 | + |
456 | + $ cd src |
457 | + $ abi-compliance-checker -lib libunity-scopes.so -old devel/build/test/abi-compliance/abi.xml -new mybranch/build/test/abi-compliance/abi.xml |
458 | + |
459 | +The script will take about two minutes to run. Now point your browser at |
460 | + |
461 | + src/compat_reports/libunity-scopes.so/[version]_to_[version]/compat_report.html |
462 | + |
463 | +The report provides a nicely layed-out page with all the details. |
464 | |
465 | === added directory 'doc/images' |
466 | === added file 'doc/images/LocationServiceHighLevel.png' |
467 | Binary files doc/images/LocationServiceHighLevel.png 1970-01-01 00:00:00 +0000 and doc/images/LocationServiceHighLevel.png 2015-10-20 12:02:23 +0000 differ |
468 | === added file 'doc/intro.md' |
469 | --- doc/intro.md 1970-01-01 00:00:00 +0000 |
470 | +++ doc/intro.md 2015-10-20 12:02:23 +0000 |
471 | @@ -0,0 +1,67 @@ |
472 | +# Introduction {#mainpage} |
473 | + |
474 | +Ubuntu's location service is a central hub for multiplexing access to |
475 | +positioning subsystems available via hard- and software. It provides a |
476 | +client API offering positioning capabilities to applications and other |
477 | +system components, abstracting away the details of individual |
478 | +positioning solutions. |
479 | + |
480 | +## Vocabulary |
481 | + |
482 | +To make the remainder of this documentation as easily understandable |
483 | +as possible, we start over with introducing some vocabulary: |
484 | + |
485 | +- Engine: |
486 | + Responsible for handling input from multiple positioning |
487 | + subsystems and maintaining the state of the overall system. Think |
488 | + about it like the heart of the system. |
489 | + |
490 | +- Provider: |
491 | + A positioning subsystem that feeds into the positioning |
492 | + engine. Common examples are a GPS provider or a network-based |
493 | + positioning provider. |
494 | + |
495 | +- Service: |
496 | + The point of entry for applications and services that would |
497 | + like to receive position data. |
498 | + |
499 | +- Session: |
500 | + In order to receive position information, every application |
501 | + or service has to create a session with the location Service. |
502 | + |
503 | +- Update: An update is a timestamped entity to a certain type of data. |
504 | + |
505 | +- [WGS84, http://en.wikipedia.org/wiki/World_Geodetic_System]: The coordinate system that is used throughout the entire location subsystem. |
506 | + |
507 | +## Architectural Overview |
508 | + |
509 | +The high-level architecture of the service is shown in the following diagram: |
510 | + |
511 | +![High-level architectural overview](images/LocationServiceHighLevel.png) |
512 | + |
513 | +In this diagram, the configuration of the engine refers to: |
514 | + |
515 | + * The current state of any satellite-based positioning subsystems. Can either be off or on. |
516 | + * The current state of reporting facilities responsible for harvesting wifi and cell id measurements together with location information and sending them off to remote services. Can either be off or on. |
517 | + * The overall state of the engine. Can either be off, on or active. |
518 | + |
519 | +The Service takes this configuration and exposes it to client |
520 | +applications. In addition, mainly for debugging purposes, the set of |
521 | +currently visible satellites (if any) is maintained and exposed to |
522 | +privileged client applications. |
523 | + |
524 | +## Privacy & Access Control |
525 | + |
526 | +Location information is highly privacy relevant. For this reason, the |
527 | +location service is deeply integrated with AppArmor and Ubuntu's |
528 | +overall trust infrastructure. Every incoming session request is |
529 | +validated and if in doubt, the user is asked to explicitly grant trust |
530 | +to the application requesting access to positioning |
531 | +information. Please see [@ref com::ubuntu::location::service::PermissionManager] |
532 | +for further details. |
533 | + |
534 | +In addition, the location service allows for selectively adjusting the |
535 | +accuracy and reporting setup of the location Engine to provide further |
536 | +fine-grained control over the exposed data to user. Within this setup, |
537 | +a user is able to entirely disable all positioning. |
538 | + |
539 | |
540 | === added file 'doc/manual_testing.md' |
541 | --- doc/manual_testing.md 1970-01-01 00:00:00 +0000 |
542 | +++ doc/manual_testing.md 2015-10-20 12:02:23 +0000 |
543 | @@ -0,0 +1,174 @@ |
544 | +# Manual Testplan |
545 | + |
546 | +[TOC] |
547 | + |
548 | +While the automatic test suite of the location service is |
549 | +comprehensive and covers large parts of the functionality of the |
550 | +service itself, we still provide an additional level of acceptance |
551 | +testing covering the entire location stack/experience as a part of |
552 | +this document. |
553 | + |
554 | +## Dependents/Clients |
555 | + |
556 | + - qtubuntu-sensors |
557 | + - Qt/QML applications: |
558 | + - Browser |
559 | + - osmTouch |
560 | + |
561 | +## Test Plan |
562 | + |
563 | +This test plan is not supposed to be complete; use it to guide your |
564 | +manual testing so you don't miss big functional areas that are part of |
565 | +the component; also this should be used as guideline to inspire the |
566 | +exploratory testing which should be adapted smartly based on the real |
567 | +content of a MP. |
568 | + |
569 | +Please note that if you're testing the GPS provider, the location |
570 | +service relies on GPS hardware to obtain a location fix. For that, it |
571 | +might be required that you execute the manual steps listed before |
572 | +close to a window or ideally outside, with good satellite visibility |
573 | +conditions. |
574 | + |
575 | +__Note: It can take up to 15 minutes for the GPS device to get a lock, due to lack of assisted GPS__ |
576 | + |
577 | + - Install latest image on phone |
578 | + - Install freshly built MPs that are needed for landing |
579 | + |
580 | +Depending on the default configuration of location-service on the |
581 | +image, you may skip parts of this test plan. E.g. if GPS hardware is |
582 | +disabled, skip this part. You can see which providers are enabled by |
583 | +looking at the list of providers on the location-serviced command-line |
584 | +(`ps fauxw | grep location-service`, then look at the `--provider` |
585 | +flags). |
586 | + |
587 | +### Dummy provider |
588 | + |
589 | +This tests forces location-service to use only the dummy provider; |
590 | +this providers a baseline test for the app to trust-store to |
591 | +location-service path. |
592 | + |
593 | + - phablet-shell into the phone: |
594 | + - `sudo service ubuntu-location-service stop && sudo /usr/bin/ubuntu-location-serviced --bus system --provider dummy::Provider --dummy::Provider::ReferenceLocationLat=48.857503 --dummy::Provider::ReferenceLocationLon=2.295072` |
595 | + - As phablet, start the trust store again (it stops when location-service is stopped) with: `start ubuntu-location-service-trust-stored` |
596 | + - Ensure that all AP tests for the webbrowser pass as expected |
597 | + - Point the browser to maps.google.com (alternatively: here.com, maps.bing.fr). |
598 | + - Request centering the map on current position and observe if it works correctly (should show the Eiffel tower) |
599 | + - Install osmTouch from the app store |
600 | + - Launch osmTouch and check if it centers on the Eiffel tower. |
601 | + - Install a maps webapp such as HERE or Google Maps webapp from the app store |
602 | + - Launch maps webapp and check if it centers on the Eiffel tower. |
603 | + |
604 | +### GPS Test Plan |
605 | + |
606 | +This applies only if GPS provider is enabled. |
607 | + |
608 | + - (If applicable: Remember to add the silo you are testing) |
609 | + - `sudo apt-get install ubuntu-location-service-tests` |
610 | + - If you want to send off crowdsourced information, i.e., information about visible wifis and visible radio cells for the obtained location fixes to Mozilla's location service and our own instance: |
611 | + - `sudo GLOG_v=40 GLOG_logtostderr=1 GPS_TEST_ENABLE_HARVESTING_DURING_TESTS=1 /usr/bin/uls-tests/gps_provider_test --gtest_filter=*.time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware` |
612 | + - If you '''don't''' want to send off crowdsourced information: |
613 | + - `sudo GLOG_v=40 GLOG_logtostderr=1 /usr/bin/uls-tests/gps_provider_test --gtest_filter=*.time_to_first_fix_cold_start_without_supl_benchmark_requires_hardware` |
614 | + |
615 | + - The test will output a lot of diagnostic information to the |
616 | + terminal and will take ~30 minutes. If satellite visibility is |
617 | + limited, it can take even longer. The test will automatically |
618 | + report success or failure. |
619 | + |
620 | +### Preliminary AGPS Test Plan |
621 | + |
622 | +**Does not apply to Krillin** |
623 | + |
624 | +Please note that the Krillin GPS chipset driver and its integration |
625 | +within Ubuntu does not support vanilla AGPS (i.e., SUPL) right |
626 | +now. For that, this test case is irrelevant for Krillin and is likely |
627 | +to fail. |
628 | + |
629 | +This applied only if GPS provider and some other provider (giving |
630 | +_A_ssistance) are enabled. |
631 | + |
632 | + - Add the silo. |
633 | + - `sudo apt-get install ubuntu-location-service-tests` |
634 | + - Obtain a (rough) location estimate for your current location on Google maps. |
635 | + - Make sure to replace INSERT_ESTIMATE_HERE with the respective |
636 | + values obtained from Google maps. |
637 | + - If you want to send off crowdsourced information, i.e., information |
638 | + about visible wifis and visible radio cells for the obtained |
639 | + location fixes to Mozilla's location service and our own instance: |
640 | + - `sudo GLOG_v=40 GLOG_logtostderr=1 GPS_TEST_ENABLE_HARVESTING_DURING_TESTS=1 GPS_TEST_REF_LAT=INSERT_ESTIMATE_HERE GPS_TEST_REF_LON=INSERT_ESTIMATE_HERE /usr/bin/uls-tests/gps_provider_test --gtest_filter=*.time_to_first_fix_cold_start_with_supl_benchmark_requires_hardware` |
641 | + - If you '''don't''' want to send off crowdsourced information: |
642 | + - `sudo GLOG_v=40 GLOG_logtostderr=1 GPS_TEST_REF_LAT=INSERT_ESTIMATE_HERE GPS_TEST_REF_LON=INSERT_ESTIMATE_HERE /usr/bin/uls-tests/gps_provider_test --gtest_filter=*.time_to_first_fix_cold_start_with_supl_benchmark_requires_hardware` |
643 | + |
644 | + - The test will output a lot of diagnostic information to the |
645 | + terminal and will take ~10 minutes or less. The test will |
646 | + automatically report success or failure. |
647 | + |
648 | +### Espoo / HERE provider |
649 | + |
650 | +This applies only if the Espoo / HERE remote provider is enabled. This |
651 | +provider should be enabled by default and may either work standalone |
652 | +as the only provider or as an assistance for the GPS hardware to lock. |
653 | + |
654 | + - Add the silo; special exception for lxc-android-config: see https://wiki.ubuntu.com/Touch/Testing/lxc-android-config |
655 | + - If noted, deploy an updated custom tarball: |
656 | + - Download the tarball under /tmp ('''NOT''' under /) |
657 | + - Unpack there: `cd /tmp; sudo tar xvf custom-vendor-here-*.tar.xz` |
658 | + - Remove older bits: `sudo rm -rf /custom/vendor/here/` |
659 | + - Update custom bits: `sudo mv /tmp/system/custom/vendor/here /custom/vendor` |
660 | + - Reboot |
661 | + - After boot, check you have these three processes running on top of location-service: |
662 | + - slpgwd |
663 | + - posclientd |
664 | + - ubuntu-espoo-service |
665 | + - Make sure SIM is unlocked and attached to the network (has some reliable signal) and that WiFi is turned on. |
666 | + - Install OSMTouch app |
667 | + - Run OSMTouch app, hit the position button every other second until you get a blue circle showing your current location; |
668 | + |
669 | +# Connectivity API |
670 | + |
671 | +For integration of network-based positioning providers, the location |
672 | +service offers a connectivity API that provides access to wifi and |
673 | +cell measurements as well as information on the current overall |
674 | +connectivity status of the device. Please execute the following |
675 | +commands on a newly flashed device with a writable image: |
676 | + |
677 | + - `sudo apt-get update && sudo apt-get build-dep location-service && sudo apt-get install libubuntu-location-service-dev ubuntu-location-service-examples` |
678 | + - `mkdir /tmp/build && cd /tmp/build && cmake /usr/share/ubuntu-location-service/examples/standalone/connectivity/ && make` |
679 | + - `GLOG_logtostderr=1 ./connectivity` |
680 | + |
681 | +Verify that the output looks similar to: |
682 | + |
683 | + phablet@ubuntu-phablet:/tmp/build$ ./connectivity |
684 | + Is wifi enabled: true |
685 | + Is wifi hw enabled: true |
686 | + Is wwan enabled: false |
687 | + Is wwan hw enabled: true |
688 | + umts(mcc: 262, mnc: 2, lac: 5313, id: 131948771, asu: 7) |
689 | + (bssid: BC:F2:AF:AF:19:A2, ssid: devolo-bcf2afaf19a2, last seen: 1408955086, mode: Mode::infrastructure, frequency: 2462, strength: 72) |
690 | + (bssid: 00:22:3F:35:43:58, ssid: JustAnotherWLAN, last seen: 1408955086, mode: Mode::infrastructure, frequency: 2412, strength: 24) |
691 | + (bssid: 82:C7:A6:40:8C:4E, ssid: EasyBox-44D054, last seen: 1408955206, mode: Mode::infrastructure, frequency: 2417, strength: 17) |
692 | + (bssid: 00:24:01:B8:32:8D, ssid: gra, last seen: 1408955086, mode: Mode::infrastructure, frequency: 2412, strength: 12) |
693 | + (bssid: C0:25:06:3C:28:22, ssid: FRITZ!Box 6360 Cable, last seen: 1408954966, mode: Mode::infrastructure, frequency: 2412, strength: 17) |
694 | + (bssid: 00:1C:4A:A5:B7:59, ssid: FRITZ!Box Fon WLAN 7170, last seen: 1408954966, mode: Mode::infrastructure, frequency: 2437, strength: 10) |
695 | + Last seen changed for wifi (bssid: BC:F2:AF:AF:19:A2, ssid: devolo-bcf2afaf19a2, last seen: 1408955257, mode: Mode::infrastructure, frequency: 2462, strength: 72) |
696 | + Last seen changed for wifi (bssid: 00:22:3F:35:43:58, ssid: JustAnotherWLAN, last seen: 1408955257, mode: Mode::infrastructure, frequency: 2412, strength: 24) |
697 | + Signal strength changed for wifi: (bssid: BC:F2:AF:AF:19:A2, ssid: devolo-bcf2afaf19a2, last seen: 1408955257, mode: Mode::infrastructure, frequency: 2462, strength: 73) |
698 | + |
699 | +# Trust Store Integration |
700 | + |
701 | +Please note that we are assuming a freshly wiped system for testing |
702 | +here. If you cannot fulfill that pre-condition, please run `rm -rf |
703 | +/home/phablet/.local/share/UbuntuLocationService && sudo shutdown -r` prior to running the |
704 | +tests: |
705 | + |
706 | +## Unconfined |
707 | + |
708 | + - Open the browser, go to maps.google.com |
709 | + - Observe the in-browser dialog asking for granting access to location. |
710 | + |
711 | +## Confined Web-App |
712 | + |
713 | + - Open the Nokia Here web app, observe the trust dialog appearing. |
714 | + |
715 | +## Confined Application |
716 | + |
717 | + - Open osmtouch and observe the osmtouch surface sliding up, presenting you with a trust dialog. |
718 | |
719 | === added file 'doc/tips_n_tricks.md' |
720 | --- doc/tips_n_tricks.md 1970-01-01 00:00:00 +0000 |
721 | +++ doc/tips_n_tricks.md 2015-10-20 12:02:23 +0000 |
722 | @@ -0,0 +1,21 @@ |
723 | +# Tips'n'Tricks |
724 | + |
725 | +## Mark HERE license as accepted from cmdline |
726 | + |
727 | + sudo LC_ALL=C gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User32011 --method org.freedesktop.DBus.Properties.Set com.ubuntu.location.providers.here.AccountsService LicenseAccepted '<true>' |
728 | + |
729 | +## Force startup after ofono and NM are started |
730 | + |
731 | +This is a *workaround* to get connectivity API to collect; mount your |
732 | +system read-write and edit |
733 | +/etc/init/ubuntu-location-provider-here-slpgwd.conf: |
734 | + |
735 | + sudo mount -o remount,rw / |
736 | + sudo vi /etc/init/ubuntu-location-provider-here-slpgwd.conf |
737 | + |
738 | +change: `start on started dbus and (started ofono or started network-manager)` |
739 | +to: `start on started dbus and started ofono and started network-manager` |
740 | + |
741 | + sudo mount -o remount,ro / |
742 | + sync |
743 | + sudo reboot |
744 | |
745 | === added directory 'tools' |
746 | === added file 'tools/CMakeLists.txt' |
747 | --- tools/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
748 | +++ tools/CMakeLists.txt 2015-10-20 12:02:23 +0000 |
749 | @@ -0,0 +1,1 @@ |
750 | +configure_file(symbol_diff.in symbol_diff) |
751 | |
752 | === added file 'tools/symbol_diff.in' |
753 | --- tools/symbol_diff.in 1970-01-01 00:00:00 +0000 |
754 | +++ tools/symbol_diff.in 2015-10-20 12:02:23 +0000 |
755 | @@ -0,0 +1,70 @@ |
756 | +#! /usr/bin/env python3 |
757 | + |
758 | +# |
759 | +# Copyright (C) 2014 Canonical Ltd |
760 | +# |
761 | +# This program is free software: you can redistribute it and/or modify |
762 | +# it under the terms of the GNU Lesser General Public License version 3 as |
763 | +# published by the Free Software Foundation. |
764 | +# |
765 | +# This program is distributed in the hope that it will be useful, |
766 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
767 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
768 | +# GNU Lesser General Public License for more details. |
769 | +# |
770 | +# You should have received a copy of the GNU Lesser General Public License |
771 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
772 | +# |
773 | +# Authored by: Michi Henning <michi.henning@canonical.com> |
774 | +# |
775 | + |
776 | +import re |
777 | +import subprocess |
778 | + |
779 | +OLD_FILE = './debian/libubuntu-location-service@UBUNTU_LOCATION_SERVICE_VERSION_MAJOR@.symbols' |
780 | +NEW_FILE = './debian/libubuntu-location-service@UBUNTU_LOCATION_SERVICE_VERSION_MAJOR@/DEBIAN/symbols' |
781 | + |
782 | +def run(): |
783 | + old_regex = re.compile(r'^ (\(.*\))"(.*)" (.*)$') |
784 | + |
785 | + old_syms = {} # Dictionary containing symbol -> ( tag, version ) |
786 | + with open(OLD_FILE, encoding='utf=8') as file: |
787 | + file.readline() # Skip first line, which is the library name and version |
788 | + for line in file: |
789 | + mo = old_regex.match(line) |
790 | + if mo: |
791 | + old_syms[mo.group(2)] = ( mo.group(1), mo.group(3) ) |
792 | + else: |
793 | + raise Exception('Invalid input line in ' + OLD_FILE + ': ' + line) |
794 | + |
795 | + new_regex = re.compile(r'^ (.*) .+$') |
796 | + |
797 | + # Run the new symbols file through "c++filt | sort | uniq". We need |
798 | + # the sort | uniq because, otherwise, we end up with duplicate demangled symbols. |
799 | + with open(NEW_FILE) as infile, open('new_symbols', 'w') as outfile: |
800 | + p = subprocess.Popen(['c++filt | sort | uniq'], shell=True, stdin=infile, stdout=subprocess.PIPE) |
801 | + |
802 | + # For each symbol, if it is in the old dictionary, output the tags from the original |
803 | + # symbol file, followed by the symbol and version. Otherwise, use "(c++)" as the tag |
804 | + # and add " 0replaceme", so the new symbol will be accepted. |
805 | + line = p.stdout.readline().decode('utf-8') |
806 | + outfile.write(line) # Write library name and version |
807 | + for line in p.stdout: |
808 | + mo = new_regex.match(line.decode('utf-8')) |
809 | + if (mo): |
810 | + sym = mo.group(1) |
811 | + try: |
812 | + tag, version = old_syms[sym] |
813 | + except KeyError: |
814 | + tag = '(c++)' |
815 | + version = '0replaceme' |
816 | + outfile.write(' {}"{}" {}\n'.format(tag, sym, version)) |
817 | + else: |
818 | + raise Exception('Cannot parse demangled line: ' + line) |
819 | + |
820 | + # Write the diff into /tmp/symbols.diff |
821 | + with open('/tmp/symbols.diff', 'w') as outfile: |
822 | + subprocess.call(['diff', '-u', OLD_FILE, 'new_symbols'], stdout=outfile) |
823 | + |
824 | +if __name__ == '__main__': |
825 | + run() |
Awesome, thanks for compiling these together; great to have the references in tree, and nice to have the automated style checkers