Merge lp:~canonical-platform-qa/ubuntu-system-tests/set_unity8_mode_staged into lp:ubuntu-system-tests

Proposed by Brendan Donegan
Status: Work in progress
Proposed branch: lp:~canonical-platform-qa/ubuntu-system-tests/set_unity8_mode_staged
Merge into: lp:ubuntu-system-tests
Diff against target: 59 lines (+35/-0)
1 file modified
ubuntu_system_tests/systemtests.py (+35/-0)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-system-tests/set_unity8_mode_staged
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Richard Huddie (community) Needs Fixing
Review via email: mp+264020@code.launchpad.net

Commit message

Force unity8 usage-mode to Staged

Description of the change

The current version of unity8 in Vivid has the 'usage-mode' set to 'Automatic', meaning it tries to detect whether it's running on a phone or a desktop. Because Autopilot exposes a fake mouse it tricks unity8 into thinking it's running in 'Windowed' mode. Most Autopilot tests are just not ready to run like this so naturally fail. Until this is resolved in Autopilot (or Unity8) we need to workaround it by forcing the usage mode to 'Staged' (which was the default before). As a matter of courtesy we also reset the usage mode to what it was before the test run.

To post a comment you must log in.
Revision history for this message
Richard Huddie (rhuddie) wrote :

Comment below.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

This got fixed in the end so not required anymore

Unmerged revisions

145. By Brendan Donegan

Set unity8 usage-mode to Staged in the systemtests.py script

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_system_tests/systemtests.py'
2--- ubuntu_system_tests/systemtests.py 2015-05-27 15:55:44 +0000
3+++ ubuntu_system_tests/systemtests.py 2015-07-07 10:22:35 +0000
4@@ -18,6 +18,7 @@
5 # along with this program. If not, see <http://www.gnu.org/licenses/>.
6 #
7
8+import logging
9 import os
10 import subprocess
11
12@@ -36,7 +37,17 @@
13 config_stack = config.get_device_config_stack()
14
15 test_ids = ubuntu_system_tests.get_tests_ids_to_run(config_stack)
16+ # We need to force the usage mode of Unity8 to 'Staged' since
17+ # it will otherwise run in Windowed mode because Autopilot makes
18+ # it think there is a mouse present:
19+ # https://bugs.launchpad.net/ubuntu/+source/autopilot/+bug/1471598
20+ unity_usage_mode = subprocess.check_output(
21+ ['gsettings', 'get', 'com.canonical.Unity8', 'usage-mode'],
22+ universal_newlines=True
23+ ).strip()
24+ _set_unity8_usage_mode_staged(unity_usage_mode)
25 result = run_autopilot_tests(config_stack, artifacts_directory, *test_ids)
26+ _reset_unity8_usage_mode(unity_usage_mode)
27
28 if result is False:
29 exit(1)
30@@ -105,5 +116,29 @@
31 destination_file.write(results_file.read())
32
33
34+def _set_unity8_usage_mode_staged(unity_usage_mode):
35+ if unity_usage_mode != "'Staged'":
36+ try:
37+ subprocess.check_call(
38+ ['gsettings', 'set', 'com.canonical.Unity8',
39+ 'usage-mode', "'Staged'"]
40+ )
41+ except subprocess.CalledProcessError:
42+ logging.warning('Could not set Unity8 usage-mode to Staged')
43+
44+
45+def _reset_unity8_usage_mode(unity_usage_mode):
46+ try:
47+ subprocess.check_call(
48+ ['gsettings', 'get', 'com.canonical.Unity8',
49+ 'usage-mode', unity_usage_mode]
50+ )
51+ except subprocess.CalledProcessError:
52+ logging.warning(
53+ 'Could not reset Unity8 usage-mode to {}'.format(
54+ unity_usage_mode
55+ )
56+ )
57+
58 if __name__ == '__main__':
59 main()

Subscribers

People subscribed via source and target branches

to all changes: