Merge lp:~thomas-voss/location-service/add-documentation-and-tooling into lp:location-service/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
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

Awesome, thanks for compiling these together; great to have the references in tree, and nice to have the automated style checkers

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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-09-18 23:06:08 +0000
+++ CMakeLists.txt 2015-10-20 12:02:23 +0000
@@ -54,6 +54,20 @@
54 SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-local-typedefs")54 SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-local-typedefs")
55endif (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS)55endif (DISABLE_ERROR_ON_LOCAL_TYPEDEFS_WARNINGS)
5656
57#
58# Code style fixer. We rely on clang-format to adjust the formatting of source code.
59#
60find_program(CLANG_FORMAT_COMMAND NAMES clang-format-3.6 clang-format-3.5)
61if (NOT CLANG_FORMAT_COMMAND)
62 message(WARNING "Cannot find clang-format >= clang-format-3.5: formatcode target will not be available")
63endif()
64
65if (CLANG_FORMAT_COMMAND)
66 file(GLOB_RECURSE UBUNTU_LOCATION_SERVICE_INTERFACE_HEADER_FILES ${CMAKE_SOURCE_DIR}/include/*.h)
67 file(GLOB_RECURSE UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_FILES ${CMAKE_SOURCE_DIR}/src/*.h ${CMAKE_SOURCE_DIR}/src/*.cpp)
68 add_custom_target(formatcode ${CLANG_FORMAT_COMMAND} -i ${UBUNTU_LOCATION_SERVICE_INTERFACE_HEADER_FILES} ${UBUNTU_LOCATION_SERVICE_IMPLEMENTATION_FILES} SOURCES _clang-format)
69endif()
70
57include_directories(71include_directories(
58 ${Boost_INCLUDE_DIRS}72 ${Boost_INCLUDE_DIRS}
59 ${DBUS_INCLUDE_DIRS}73 ${DBUS_INCLUDE_DIRS}
6074
=== added file '_clang-format'
--- _clang-format 1970-01-01 00:00:00 +0000
+++ _clang-format 2015-10-20 12:02:23 +0000
@@ -0,0 +1,56 @@
1---
2Language: Cpp
3AccessModifierOffset: -4
4ConstructorInitializerIndentWidth: 4
5AlignEscapedNewlinesLeft: false
6AlignTrailingComments: true
7AllowAllParametersOfDeclarationOnNextLine: true
8AllowShortBlocksOnASingleLine: false
9AllowShortIfStatementsOnASingleLine: false
10AllowShortLoopsOnASingleLine: false
11AllowShortFunctionsOnASingleLine: All
12AlwaysBreakTemplateDeclarations: false
13AlwaysBreakBeforeMultilineStrings: false
14BreakBeforeBinaryOperators: false
15BreakBeforeTernaryOperators: true
16BreakConstructorInitializersBeforeComma: false
17BinPackParameters: true
18ColumnLimit: 0
19ConstructorInitializerAllOnOneLineOrOnePerLine: false
20DerivePointerAlignment: false
21ExperimentalAutoDetectBinPacking: false
22IndentCaseLabels: false
23IndentWrappedFunctionNames: false
24IndentFunctionDeclarationAfterType: false
25MaxEmptyLinesToKeep: 1
26KeepEmptyLinesAtTheStartOfBlocks: true
27NamespaceIndentation: None
28ObjCSpaceAfterProperty: false
29ObjCSpaceBeforeProtocolList: true
30PenaltyBreakBeforeFirstCallParameter: 19
31PenaltyBreakComment: 300
32PenaltyBreakString: 1000
33PenaltyBreakFirstLessLess: 120
34PenaltyExcessCharacter: 1000000
35PenaltyReturnTypeOnItsOwnLine: 60
36PointerAlignment: Left
37SpacesBeforeTrailingComments: 1
38Cpp11BracedListStyle: true
39Standard: Cpp11
40IndentWidth: 4
41TabWidth: 8
42UseTab: Never
43BreakBeforeBraces: Allman
44SpacesInParentheses: false
45SpacesInAngles: false
46SpaceInEmptyParentheses: false
47SpacesInCStyleCastParentheses: false
48SpacesInContainerLiterals: true
49SpaceBeforeAssignmentOperators: true
50ContinuationIndentWidth: 4
51CommentPragmas: '^ IWYU pragma:'
52ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
53SpaceBeforeParens: ControlStatements
54DisableFormat: false
55...
56
057
=== added file 'astyle-config'
--- astyle-config 1970-01-01 00:00:00 +0000
+++ astyle-config 2015-10-20 12:02:23 +0000
@@ -0,0 +1,43 @@
1# Options for formatting code with astyle.
2#
3# This helps to make code match the style guide.
4#
5# Use like this:
6#
7# astyle --options=astyle-config mfile.h myfile.cpp
8#
9# Occasionally, astyle does something silly (particularly with lambdas), so it's
10# still necessary to scan the changes for things that are wrong.
11# But, for most files, it does a good job.
12#
13# Please consider using this before checking code in for review. Code reviews shouldn't
14# have to deal with layout issues, they are just a distraction. It's better to be able
15# to focus on semantics in a code review, with style issues out of the way.
16
17--formatted
18--style=allman
19--min-conditional-indent=2
20--indent-switches
21--max-instatement-indent=120
22--pad-header
23--align-pointer=type
24--align-reference=type
25--convert-tabs
26--close-templates
27--max-code-length=120
28
29# --pad-oper
30#
31# Commented out for now. It changes
32#
33# for (int i=0; i<10; ++i)
34# to
35# for (int i = 0; i < 10; ++i)
36#
37# Unfortunately, it also messes with rvalue references:
38#
39# ResourcePtr& operator=(ResourcePtr&& r);
40#
41# becomes:
42#
43# ResourcePtr& operator=(ResourcePtr && r);
044
=== modified file 'doc/Doxyfile.in'
--- doc/Doxyfile.in 2014-05-19 09:55:25 +0000
+++ doc/Doxyfile.in 2015-10-20 12:02:23 +0000
@@ -748,7 +748,7 @@
748# directories that contain image that are included in the documentation (see748# directories that contain image that are included in the documentation (see
749# the \image command).749# the \image command).
750750
751IMAGE_PATH =751IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@/images
752752
753# The INPUT_FILTER tag can be used to specify a program that doxygen should753# The INPUT_FILTER tag can be used to specify a program that doxygen should
754# invoke to filter for each input file. Doxygen will invoke the filter program754# invoke to filter for each input file. Doxygen will invoke the filter program
@@ -1463,7 +1463,7 @@
1463# generate an XML file that captures the structure of1463# generate an XML file that captures the structure of
1464# the code including all documentation.1464# the code including all documentation.
14651465
1466GENERATE_XML = NO1466GENERATE_XML = YES
14671467
1468# The XML_OUTPUT tag is used to specify where the XML pages will be put.1468# The XML_OUTPUT tag is used to specify where the XML pages will be put.
1469# If a relative path is entered the value of OUTPUT_DIRECTORY will be1469# If a relative path is entered the value of OUTPUT_DIRECTORY will be
14701470
=== added file 'doc/daemon_and_cli.md'
--- doc/daemon_and_cli.md 1970-01-01 00:00:00 +0000
+++ doc/daemon_and_cli.md 2015-10-20 12:02:23 +0000
@@ -0,0 +1,55 @@
1# Service Daemon and CLI
2
3The location service offers a daemon executable and a corresponding
4command-line interface for interacting with it. The daemon does not
5necessarily require root privileges, but might so depending on your
6configuration.
7
8Run the following command to receive an overview of the arguments to
9the daemon:
10
11 ubuntu-location-serviced --help
12
13An example invocation of the daemon, configuring a GPS provider that
14relies on the Android HAL to talk to the chipset, exposing the service
15on the system DBus instance:
16
17 ubuntu-location-serviced --bus system --provider gps::Provider
18
19The cli allows for querying properties of a running service instance, e.g.:
20
21 ubuntu-location-serviced-cli --bus system --get --property is_online
22
23## Configuring an Out-Of-Process Provider
24
25If you want to run a provider out of process, the daemon executable
26allows you to do so by instantiating a so-called remote provider. The
27following invocation of the service tries to connect to the provider
28instance described by the given unique DBus name and path.
29
30 ubuntu-location-serviced \
31 --bus system \
32 --provider remote::Provider \
33 --remote::Provider::bus=system \
34 --remote::Provider::name=com.ubuntu.location.provider.Gps \
35 --remote::Provider::path=/
36
37Please note that the service allows for decorating provider names to
38uniquely identify per provider configuration options and to allow for
39loading more than one provider of a certain kind. The following
40configuration configures two remote providers, one relying on GPS
41(decorated with @gps) and another one relying on network-based
42positioning (decorated with @network):
43
44 ubuntu-location-serviced \
45 --bus system \
46 --provider remote::Provider@gps \
47 --remote::Provider@gps::bus=system \
48 --remote::Provider@gps::name=com.ubuntu.location.provider.Gps \
49 --remote::Provider@gps::path=/ \
50 --provider remote::Provider@network \
51 --remote::Provider@network::bus=system \
52 --remote::Provider@network::name=com.ubuntu.location.provider.Network \
53 --remote::Provider@network::path=/
54
55
056
=== added file 'doc/debugging.md'
--- doc/debugging.md 1970-01-01 00:00:00 +0000
+++ doc/debugging.md 2015-10-20 12:02:23 +0000
@@ -0,0 +1,92 @@
1# Debugging
2
3Location not working? Here's how to debug.
4
5## Layers
6
7Test in OSMTouch (QML app using Qt API) before testing in webapps or
8webbrowser app. Different results? File a bug where it doesn't
9work. Same result of no location? Next step.
10
11## Check that stack works with dummy provider
12
13Edit /etc/init/ubuntu-location-provider.override to start
14location-serviced with just the dummy provider; this should
15work. Doesn't work? File a bug against location-service. Works? Reset
16config to defaults and try the next thing.
17
18## Hardware GPS breaking all of location-service
19
20GPS provider is built-in into location-service and might break all of
21it if it goes south (working on splitting it out); try enabling only
22the HERE provider on the location-serviced command-line and see if
23that works. Works? File a bug against location-service. Doesn't work?
24Move on.
25
26## HERE test
27
28To test whether the low-level HERE stack gets a location, put
29http://people.canonical.com/~lool/espoo-cli on your phone (will be
30included along HERE bits in the future) and run with:
31
32 chmod a+x espoo-cli
33 GLOG_logtostderr=1 GLOG_v=100 LD_LIBRARY_PATH=/custom/vendor/here/location-provider/lib/arm-linux-gnueabihf ./espoo-cli 5
34
35NB: 5 is the number of location updates after which the tool exits;
36updates should come in at approx 15s interval. Output looks like:
37
38 I1101 21:30:01.285964 4403 cli.cpp:117] Requested number of updates is 2
39 I1101 21:30:01.299002 4403 cli.cpp:133] Starting location updates
40 I1101 21:30:01.301888 4403 cli.cpp:141] Starting GLib main loop
41 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
42 I1101 21:30:11.306061 4403 cli.cpp:170] Remaining updates: 1
43 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
44 I1101 21:30:26.738348 4403 cli.cpp:148] Stopping location updates
45
46Low-level HERE stack works but location-serviced with just HERE
47provider doesn't work? File a bug against espoo projet (HERE) and/or
48location-service. Low-level HERE stack doesn't work? Move on
49
50## location-service and espoo-service debug
51
52Collect some debug data by editing /etc/init/ubuntu-espoo-service.conf
53and /etc/init/ubuntu-location-service.override and changing the start
54sequence to add some env vars:
55
56 export GLOG_v=200
57 export GLOG_logtostderr=1
58
59before the exec. Reboot, and start some app. You should have some log
60files under /var/log/upstart/ubuntu-espoo-service.log and
61/var/log/upstart/ubuntu-location-service.log to attach to a bug
62report; e.g. a working espoo log looks like this:
63
64 WARNING: Logging before InitGoogleLogging() is written to STDERR
65 I1105 16:30:10.221474 1620 provider.cpp:568] StartPositionUpdates
66 I1105 16:30:10.224901 1620 provider.cpp:122] Successfully started position updates.
67 I1105 16:30:10.228739 1620 provider.cpp:596] StartVelocityUpdates
68 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)
69
70No position there? check connectivity API works by running:
71
72 cd /tmp
73 wget http://people.ubuntu.com/~lool/connectivity
74 GLOG_v=200 GLOG_logtostderr=1 ./connectivity
75
76you should see something like:
77
78 I1105 16:47:26.431466 11140 cached_radio_cell.cpp:160] (mcc: 123, mnc: 2, lac: 1234, id: 123456, asu: 1)
79 I1105 16:47:26.533818 11140 connectivity.cpp:47] Is wifi enabled: true
80 I1105 16:47:26.533963 11140 connectivity.cpp:48] Is wifi hw enabled: true
81 I1105 16:47:26.534010 11140 connectivity.cpp:49] Is wwan enabled: true
82 I1105 16:47:26.534050 11140 connectivity.cpp:50] Is wwan hw enabled: true
83 I1105 16:47:26.534442 11140 connectivity.cpp:122] umts(mcc: 123, mnc: 2, lac: 1234, id: 123456, asu: 1)
84 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)
85 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)
86
87Also, please attach output of /usr/share/ofono/scripts/list-modems > list-modems-output.txt
88Please note that the command might take ~1 minute to complete.
89
90TODO: document dbus-monitor / d-feet capturing of client / system traffic with snooping config.
91
92
093
=== added file 'doc/hacking.md'
--- doc/hacking.md 1970-01-01 00:00:00 +0000
+++ doc/hacking.md 2015-10-20 12:02:23 +0000
@@ -0,0 +1,146 @@
1# Hacking
2
3
4## Building the code
5
6By default, the code is built in release mode. To build a debug version, use
7
8 $ mkdir builddebug
9 $ cd builddebug
10 $ cmake -DCMAKE_BUILD_TYPE=debug ..
11 $ make
12
13For a release version, use -DCMAKE_BUILD_TYPE=release
14
15## Running the tests
16
17 $ make
18 $ make test
19
20Note that "make test" alone is dangerous because it does not rebuild
21any tests if either the library or the test files themselves need
22rebuilding. It's not possible to fix this with cmake because cmake cannot
23add build dependencies to built-in targets. To make sure that everything
24is up-to-date, run "make" before running "make test"!
25
26## Coverage
27
28To build with the flags for coverage testing enabled and get coverage:
29
30 $ mkdir buildcoverage
31 $ cd buildcoverage
32 $ cmake -DCMAKE_BUILD_TYPE=coverage
33 $ make
34 $ make test
35 $ make coverage
36
37Unfortunately, it is not possible to get 100% coverage for some files,
38mainly due to gcc's generation of two destructors for dynamic and non-
39dynamic instances. For abstract base classes and for classes that
40prevent stack and static allocation, this causes one of the destructors
41to be reported as uncovered.
42
43There are also issues with some functions in header files that are
44incorrectly reported as uncovered due to inlining, as well as
45the impossibility of covering defensive assert(false) statements,
46such as an assert in the default branch of a switch, where the
47switch is meant to handle all possible cases explicitly.
48
49If you run a binary and get lots of warnings about a "merge mismatch for summaries",
50this is caused by having made changes to the source that add or remove code
51that was previously run, so the new coverage output cannot sensibly be merged
52into the old coverage output. You can get rid of this problem by running
53
54 $ make clean-coverage
55
56This deletes all the .gcda files, allowing the merge to (sometimes) succeed again.
57If this doesn't work either, the only remedy is to do a clean build.
58
59If lcov complains about unrecognized lines involving '=====',
60you can patch geninfo and gcovr as explained here:
61
62https://bugs.launchpad.net/gcovr/+bug/1086695/comments/2
63
64## Code style
65
66We use a format tool that fixes a whole lot of issues
67regarding code style. The formatting changes made by
68the tool are generally sensible (even though they may not be your
69personal preference in all cases). If there is a case where the formatting
70really messes things up, consider re-arranging the code to avoid the problem.
71The convenience of running the entire code base through the pretty-printer
72far outweighs any minor glitches with pretty printing, and it means that
73we get consistent code style for free, rather than endlessly having to
74watch out for formatting issues during code reviews.
75
76As of clang-format-3.7, you can use
77
78 // clang-format off
79 void unformatted_code ;
80 // clang-format on
81
82to suppress formatting for a section of code.
83
84To format specific files:
85
86 ${CMAKE_BINARY_DIR}/tools/formatcode x.cpp x.h
87
88If no arguments are provided, formatcode reads stdin and writes
89stdout, so you can easily pipe code into the tool from within an
90editor. For example, to reformat the entire file in vi (assuming
91${CMAKE_BINARY_DIR}/tools is in your PATH):
92
93 1G!Gformatcode
94
95To re-format all source and header files in the tree:
96
97 $ make formatcode
98
99## Thread and address sanitizer
100
101Set SANITIZER to "thread" or "address" to build with the
102corresponding sanitizer enabled.
103
104## Updating symbols file
105
106To easily spot new/removed/changed symbols in the library, the debian
107package maintains a .symbols file that lists all exported symbols
108present in the library .so. If you add new public symbols to the library,
109it's necessary to refresh the symbols file, otherwise the package will
110fail to build. The easiest way to do that is using bzr-builddeb:
111
112 $ bzr bd -- -us -uc -j8 # Don't sign source package or changes file, 8 compiles in parallel
113 $ # this will exit with an error if symbols file isn't up-to-date
114 $ cd ../build-area/location-service-[version]
115 $ ./obj-[arch]/tools/symbol_diff
116
117This creates a diff of the symbols in /tmp/symbols.diff.
118(The demangled symbols from the debian build are in ./new_symbols.)
119
120Review any changes in /tmp/symbols.diff. If they are OK:
121
122 $ cd -
123 $ patch -p0 < /tmp/symbols.diff
124
125## ABI compliance test
126
127To use this, install abi-compliance-checker package from the archives.
128
129You can use abi-compliance-checker to test whether a particular build
130is ABI compatible with another build. The tool does some source-level
131analysis in addition to checking library symbols, so it catches things
132that are potentially dangerous, but won't be picked up by just looking
133at the symbol table.
134
135Assume you have built devel in src/devel, and you have a later build
136in src/mybranch and want to check that mybranch is still compatible.
137To run the compliance test:
138
139 $ cd src
140 $ abi-compliance-checker -lib libunity-scopes.so -old devel/build/test/abi-compliance/abi.xml -new mybranch/build/test/abi-compliance/abi.xml
141
142The script will take about two minutes to run. Now point your browser at
143
144 src/compat_reports/libunity-scopes.so/[version]_to_[version]/compat_report.html
145
146The report provides a nicely layed-out page with all the details.
0147
=== added directory 'doc/images'
=== added file 'doc/images/LocationServiceHighLevel.png'
1Binary files doc/images/LocationServiceHighLevel.png 1970-01-01 00:00:00 +0000 and doc/images/LocationServiceHighLevel.png 2015-10-20 12:02:23 +0000 differ148Binary 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
=== added file 'doc/intro.md'
--- doc/intro.md 1970-01-01 00:00:00 +0000
+++ doc/intro.md 2015-10-20 12:02:23 +0000
@@ -0,0 +1,67 @@
1# Introduction {#mainpage}
2
3Ubuntu's location service is a central hub for multiplexing access to
4positioning subsystems available via hard- and software. It provides a
5client API offering positioning capabilities to applications and other
6system components, abstracting away the details of individual
7positioning solutions.
8
9## Vocabulary
10
11To make the remainder of this documentation as easily understandable
12as possible, we start over with introducing some vocabulary:
13
14- Engine:
15 Responsible for handling input from multiple positioning
16 subsystems and maintaining the state of the overall system. Think
17 about it like the heart of the system.
18
19- Provider:
20 A positioning subsystem that feeds into the positioning
21 engine. Common examples are a GPS provider or a network-based
22 positioning provider.
23
24- Service:
25 The point of entry for applications and services that would
26 like to receive position data.
27
28- Session:
29 In order to receive position information, every application
30 or service has to create a session with the location Service.
31
32- Update: An update is a timestamped entity to a certain type of data.
33
34- [WGS84, http://en.wikipedia.org/wiki/World_Geodetic_System]: The coordinate system that is used throughout the entire location subsystem.
35
36## Architectural Overview
37
38The high-level architecture of the service is shown in the following diagram:
39
40![High-level architectural overview](images/LocationServiceHighLevel.png)
41
42In this diagram, the configuration of the engine refers to:
43
44 * The current state of any satellite-based positioning subsystems. Can either be off or on.
45 * 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.
46 * The overall state of the engine. Can either be off, on or active.
47
48The Service takes this configuration and exposes it to client
49applications. In addition, mainly for debugging purposes, the set of
50currently visible satellites (if any) is maintained and exposed to
51privileged client applications.
52
53## Privacy & Access Control
54
55Location information is highly privacy relevant. For this reason, the
56location service is deeply integrated with AppArmor and Ubuntu's
57overall trust infrastructure. Every incoming session request is
58validated and if in doubt, the user is asked to explicitly grant trust
59to the application requesting access to positioning
60information. Please see [@ref com::ubuntu::location::service::PermissionManager]
61for further details.
62
63In addition, the location service allows for selectively adjusting the
64accuracy and reporting setup of the location Engine to provide further
65fine-grained control over the exposed data to user. Within this setup,
66a user is able to entirely disable all positioning.
67
068
=== added file 'doc/manual_testing.md'
--- doc/manual_testing.md 1970-01-01 00:00:00 +0000
+++ doc/manual_testing.md 2015-10-20 12:02:23 +0000
@@ -0,0 +1,174 @@
1# Manual Testplan
2
3[TOC]
4
5While the automatic test suite of the location service is
6comprehensive and covers large parts of the functionality of the
7service itself, we still provide an additional level of acceptance
8testing covering the entire location stack/experience as a part of
9this document.
10
11## Dependents/Clients
12
13 - qtubuntu-sensors
14 - Qt/QML applications:
15 - Browser
16 - osmTouch
17
18## Test Plan
19
20This test plan is not supposed to be complete; use it to guide your
21manual testing so you don't miss big functional areas that are part of
22the component; also this should be used as guideline to inspire the
23exploratory testing which should be adapted smartly based on the real
24content of a MP.
25
26Please note that if you're testing the GPS provider, the location
27service relies on GPS hardware to obtain a location fix. For that, it
28might be required that you execute the manual steps listed before
29close to a window or ideally outside, with good satellite visibility
30conditions.
31
32__Note: It can take up to 15 minutes for the GPS device to get a lock, due to lack of assisted GPS__
33
34 - Install latest image on phone
35 - Install freshly built MPs that are needed for landing
36
37Depending on the default configuration of location-service on the
38image, you may skip parts of this test plan. E.g. if GPS hardware is
39disabled, skip this part. You can see which providers are enabled by
40looking at the list of providers on the location-serviced command-line
41(`ps fauxw | grep location-service`, then look at the `--provider`
42flags).
43
44### Dummy provider
45
46This tests forces location-service to use only the dummy provider;
47this providers a baseline test for the app to trust-store to
48location-service path.
49
50 - phablet-shell into the phone:
51 - `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`
52 - As phablet, start the trust store again (it stops when location-service is stopped) with: `start ubuntu-location-service-trust-stored`
53 - Ensure that all AP tests for the webbrowser pass as expected
54 - Point the browser to maps.google.com (alternatively: here.com, maps.bing.fr).
55 - Request centering the map on current position and observe if it works correctly (should show the Eiffel tower)
56 - Install osmTouch from the app store
57 - Launch osmTouch and check if it centers on the Eiffel tower.
58 - Install a maps webapp such as HERE or Google Maps webapp from the app store
59 - Launch maps webapp and check if it centers on the Eiffel tower.
60
61### GPS Test Plan
62
63This applies only if GPS provider is enabled.
64
65 - (If applicable: Remember to add the silo you are testing)
66 - `sudo apt-get install ubuntu-location-service-tests`
67 - 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:
68 - `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`
69 - If you '''don't''' want to send off crowdsourced information:
70 - `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`
71
72 - The test will output a lot of diagnostic information to the
73 terminal and will take ~30 minutes. If satellite visibility is
74 limited, it can take even longer. The test will automatically
75 report success or failure.
76
77### Preliminary AGPS Test Plan
78
79**Does not apply to Krillin**
80
81Please note that the Krillin GPS chipset driver and its integration
82within Ubuntu does not support vanilla AGPS (i.e., SUPL) right
83now. For that, this test case is irrelevant for Krillin and is likely
84to fail.
85
86This applied only if GPS provider and some other provider (giving
87_A_ssistance) are enabled.
88
89 - Add the silo.
90 - `sudo apt-get install ubuntu-location-service-tests`
91 - Obtain a (rough) location estimate for your current location on Google maps.
92 - Make sure to replace INSERT_ESTIMATE_HERE with the respective
93 values obtained from Google maps.
94 - If you want to send off crowdsourced information, i.e., information
95 about visible wifis and visible radio cells for the obtained
96 location fixes to Mozilla's location service and our own instance:
97 - `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`
98 - If you '''don't''' want to send off crowdsourced information:
99 - `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`
100
101 - The test will output a lot of diagnostic information to the
102 terminal and will take ~10 minutes or less. The test will
103 automatically report success or failure.
104
105### Espoo / HERE provider
106
107This applies only if the Espoo / HERE remote provider is enabled. This
108provider should be enabled by default and may either work standalone
109as the only provider or as an assistance for the GPS hardware to lock.
110
111 - Add the silo; special exception for lxc-android-config: see https://wiki.ubuntu.com/Touch/Testing/lxc-android-config
112 - If noted, deploy an updated custom tarball:
113 - Download the tarball under /tmp ('''NOT''' under /)
114 - Unpack there: `cd /tmp; sudo tar xvf custom-vendor-here-*.tar.xz`
115 - Remove older bits: `sudo rm -rf /custom/vendor/here/`
116 - Update custom bits: `sudo mv /tmp/system/custom/vendor/here /custom/vendor`
117 - Reboot
118 - After boot, check you have these three processes running on top of location-service:
119 - slpgwd
120 - posclientd
121 - ubuntu-espoo-service
122 - Make sure SIM is unlocked and attached to the network (has some reliable signal) and that WiFi is turned on.
123 - Install OSMTouch app
124 - Run OSMTouch app, hit the position button every other second until you get a blue circle showing your current location;
125
126# Connectivity API
127
128For integration of network-based positioning providers, the location
129service offers a connectivity API that provides access to wifi and
130cell measurements as well as information on the current overall
131connectivity status of the device. Please execute the following
132commands on a newly flashed device with a writable image:
133
134 - `sudo apt-get update && sudo apt-get build-dep location-service && sudo apt-get install libubuntu-location-service-dev ubuntu-location-service-examples`
135 - `mkdir /tmp/build && cd /tmp/build && cmake /usr/share/ubuntu-location-service/examples/standalone/connectivity/ && make`
136 - `GLOG_logtostderr=1 ./connectivity`
137
138Verify that the output looks similar to:
139
140 phablet@ubuntu-phablet:/tmp/build$ ./connectivity
141 Is wifi enabled: true
142 Is wifi hw enabled: true
143 Is wwan enabled: false
144 Is wwan hw enabled: true
145 umts(mcc: 262, mnc: 2, lac: 5313, id: 131948771, asu: 7)
146 (bssid: BC:F2:AF:AF:19:A2, ssid: devolo-bcf2afaf19a2, last seen: 1408955086, mode: Mode::infrastructure, frequency: 2462, strength: 72)
147 (bssid: 00:22:3F:35:43:58, ssid: JustAnotherWLAN, last seen: 1408955086, mode: Mode::infrastructure, frequency: 2412, strength: 24)
148 (bssid: 82:C7:A6:40:8C:4E, ssid: EasyBox-44D054, last seen: 1408955206, mode: Mode::infrastructure, frequency: 2417, strength: 17)
149 (bssid: 00:24:01:B8:32:8D, ssid: gra, last seen: 1408955086, mode: Mode::infrastructure, frequency: 2412, strength: 12)
150 (bssid: C0:25:06:3C:28:22, ssid: FRITZ!Box 6360 Cable, last seen: 1408954966, mode: Mode::infrastructure, frequency: 2412, strength: 17)
151 (bssid: 00:1C:4A:A5:B7:59, ssid: FRITZ!Box Fon WLAN 7170, last seen: 1408954966, mode: Mode::infrastructure, frequency: 2437, strength: 10)
152 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)
153 Last seen changed for wifi (bssid: 00:22:3F:35:43:58, ssid: JustAnotherWLAN, last seen: 1408955257, mode: Mode::infrastructure, frequency: 2412, strength: 24)
154 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)
155
156# Trust Store Integration
157
158Please note that we are assuming a freshly wiped system for testing
159here. If you cannot fulfill that pre-condition, please run `rm -rf
160/home/phablet/.local/share/UbuntuLocationService && sudo shutdown -r` prior to running the
161tests:
162
163## Unconfined
164
165 - Open the browser, go to maps.google.com
166 - Observe the in-browser dialog asking for granting access to location.
167
168## Confined Web-App
169
170 - Open the Nokia Here web app, observe the trust dialog appearing.
171
172## Confined Application
173
174 - Open osmtouch and observe the osmtouch surface sliding up, presenting you with a trust dialog.
0175
=== added file 'doc/tips_n_tricks.md'
--- doc/tips_n_tricks.md 1970-01-01 00:00:00 +0000
+++ doc/tips_n_tricks.md 2015-10-20 12:02:23 +0000
@@ -0,0 +1,21 @@
1# Tips'n'Tricks
2
3## Mark HERE license as accepted from cmdline
4
5 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>'
6
7## Force startup after ofono and NM are started
8
9This is a *workaround* to get connectivity API to collect; mount your
10system read-write and edit
11/etc/init/ubuntu-location-provider-here-slpgwd.conf:
12
13 sudo mount -o remount,rw /
14 sudo vi /etc/init/ubuntu-location-provider-here-slpgwd.conf
15
16change: `start on started dbus and (started ofono or started network-manager)`
17to: `start on started dbus and started ofono and started network-manager`
18
19 sudo mount -o remount,ro /
20 sync
21 sudo reboot
022
=== added directory 'tools'
=== added file 'tools/CMakeLists.txt'
--- tools/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tools/CMakeLists.txt 2015-10-20 12:02:23 +0000
@@ -0,0 +1,1 @@
1configure_file(symbol_diff.in symbol_diff)
02
=== added file 'tools/symbol_diff.in'
--- tools/symbol_diff.in 1970-01-01 00:00:00 +0000
+++ tools/symbol_diff.in 2015-10-20 12:02:23 +0000
@@ -0,0 +1,70 @@
1#! /usr/bin/env python3
2
3#
4# Copyright (C) 2014 Canonical Ltd
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU Lesser General Public License version 3 as
8# published by the Free Software Foundation.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU Lesser General Public License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17#
18# Authored by: Michi Henning <michi.henning@canonical.com>
19#
20
21import re
22import subprocess
23
24OLD_FILE = './debian/libubuntu-location-service@UBUNTU_LOCATION_SERVICE_VERSION_MAJOR@.symbols'
25NEW_FILE = './debian/libubuntu-location-service@UBUNTU_LOCATION_SERVICE_VERSION_MAJOR@/DEBIAN/symbols'
26
27def run():
28 old_regex = re.compile(r'^ (\(.*\))"(.*)" (.*)$')
29
30 old_syms = {} # Dictionary containing symbol -> ( tag, version )
31 with open(OLD_FILE, encoding='utf=8') as file:
32 file.readline() # Skip first line, which is the library name and version
33 for line in file:
34 mo = old_regex.match(line)
35 if mo:
36 old_syms[mo.group(2)] = ( mo.group(1), mo.group(3) )
37 else:
38 raise Exception('Invalid input line in ' + OLD_FILE + ': ' + line)
39
40 new_regex = re.compile(r'^ (.*) .+$')
41
42 # Run the new symbols file through "c++filt | sort | uniq". We need
43 # the sort | uniq because, otherwise, we end up with duplicate demangled symbols.
44 with open(NEW_FILE) as infile, open('new_symbols', 'w') as outfile:
45 p = subprocess.Popen(['c++filt | sort | uniq'], shell=True, stdin=infile, stdout=subprocess.PIPE)
46
47 # For each symbol, if it is in the old dictionary, output the tags from the original
48 # symbol file, followed by the symbol and version. Otherwise, use "(c++)" as the tag
49 # and add " 0replaceme", so the new symbol will be accepted.
50 line = p.stdout.readline().decode('utf-8')
51 outfile.write(line) # Write library name and version
52 for line in p.stdout:
53 mo = new_regex.match(line.decode('utf-8'))
54 if (mo):
55 sym = mo.group(1)
56 try:
57 tag, version = old_syms[sym]
58 except KeyError:
59 tag = '(c++)'
60 version = '0replaceme'
61 outfile.write(' {}"{}" {}\n'.format(tag, sym, version))
62 else:
63 raise Exception('Cannot parse demangled line: ' + line)
64
65 # Write the diff into /tmp/symbols.diff
66 with open('/tmp/symbols.diff', 'w') as outfile:
67 subprocess.call(['diff', '-u', OLD_FILE, 'new_symbols'], stdout=outfile)
68
69if __name__ == '__main__':
70 run()

Subscribers

People subscribed via source and target branches