Merge lp:~canonical-platform-qa/ubuntu-system-tests/install_silo into lp:ubuntu-system-tests
- install_silo
- Merge into trunk
Status: | Work in progress |
---|---|
Proposed branch: | lp:~canonical-platform-qa/ubuntu-system-tests/install_silo |
Merge into: | lp:ubuntu-system-tests |
Prerequisite: | lp:~canonical-platform-qa/ubuntu-system-tests/install_permanent_dependencies |
Diff against target: |
563 lines (+286/-48) 4 files modified
README.rst (+13/-0) ubuntu_system_tests/command_line.py (+108/-39) ubuntu_system_tests/selftests/test_command_line.py (+36/-9) ubuntu_system_tests/silo.py (+129/-0) |
To merge this branch: | bzr merge lp:~canonical-platform-qa/ubuntu-system-tests/install_silo |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
platform-qa-bot | continuous-integration | Needs Fixing | |
Richard Huddie (community) | Needs Fixing | ||
PS Jenkins bot | continuous-integration | Approve | |
prod-platform-qa | continuous-integration | Pending | |
Sergio Cazzolato | Pending | ||
Review via email: mp+279067@code.launchpad.net |
Commit message
Install a silo as part of the device setup. The tests will be executed after the silo and all the dependencies are installed.
The process will install all the silo dependencies/
When the tests to be run are not passed as parameter, the test execution is not going to be done allowing to just install the silo and/or the test dependencies.
Example used to install the silo 21 before run the tests:
./run-system-tests -i -u -s 21 ubuntu_
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
- 279. By Sergio Cazzolato
-
Adding doc to the README.rst
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:279
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 280. By Sergio Cazzolato
-
Updating selftests and adding few more
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:280
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 281. By Sergio Cazzolato
-
Merge with dependency
- 282. By Sergio Cazzolato
-
Merge with dependency
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:282
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Richard Huddie (rhuddie) wrote : | # |
Seems to be working well. The silo packages were installed successfully to correct versions and tests ran. Also running without specifying test ids worked for preparing the device.
I did hit some out of disk space errors when running different commands in sequence, but not sure we can do much about that without installing onto /userdata.
Some minor comments below.
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:282
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
platform-qa-bot (platform-qa-bot) wrote : | # |
FAILED: Continuous integration, rev:282
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
None: https:/
Click here to trigger a rebuild:
https:/
Unmerged revisions
- 282. By Sergio Cazzolato
-
Merge with dependency
- 281. By Sergio Cazzolato
-
Merge with dependency
- 280. By Sergio Cazzolato
-
Updating selftests and adding few more
- 279. By Sergio Cazzolato
-
Adding doc to the README.rst
- 278. By Sergio Cazzolato
-
Restructuring the code and making possible to execute the run command without tests to run
- 277. By Sergio Cazzolato
-
Minor changes on names
- 276. By Sergio Cazzolato
-
Initial commit install silo
Preview Diff
1 | === modified file 'README.rst' |
2 | --- README.rst 2015-12-03 20:21:27 +0000 |
3 | +++ README.rst 2015-12-03 20:21:27 +0000 |
4 | @@ -262,6 +262,19 @@ |
5 | |
6 | $ run-system-tests --install-deps package1.module1 |
7 | |
8 | + |
9 | +Install a silo before tests execution |
10 | +------------------------------------- |
11 | + |
12 | +It is possible to install a silo before execute the tests in the device. |
13 | +The silo is installed first, then the dependencies are installed in / or /tmp |
14 | +and then the tests are executed. |
15 | +It can be enabled by using --silo or -s and the silo number from command line: |
16 | + |
17 | +:: |
18 | + |
19 | + $ run-system-tests --silo 32 package1.module1 |
20 | + |
21 | Specify the list of tests to run |
22 | -------------------------------- |
23 | |
24 | |
25 | === modified file 'ubuntu_system_tests/command_line.py' |
26 | --- ubuntu_system_tests/command_line.py 2015-12-03 20:21:27 +0000 |
27 | +++ ubuntu_system_tests/command_line.py 2015-12-03 20:21:27 +0000 |
28 | @@ -32,6 +32,7 @@ |
29 | from ubuntu_system_tests import ( |
30 | config, |
31 | results, |
32 | + silo as silo_cmd, |
33 | ssh, |
34 | testdesc |
35 | ) |
36 | @@ -48,7 +49,8 @@ |
37 | args = _parse_arguments(argv) |
38 | return run_system_tests(args.config, args.suites, |
39 | args.update_apt, args.network_ready, |
40 | - args.touch_visualization, args.install_deps) |
41 | + args.touch_visualization, args.install_deps, |
42 | + args.silo) |
43 | |
44 | |
45 | def _parse_arguments(argv=None): |
46 | @@ -72,13 +74,18 @@ |
47 | ' the /tmp directory', |
48 | default=False) |
49 | parser.add_argument( |
50 | + '--silo', '-s', action='store', type=int, |
51 | + help='The silo number to be installed before run the tests in the ' |
52 | + 'device', |
53 | + default=False) |
54 | + parser.add_argument( |
55 | 'suites', nargs='*', help='The list of test suites to run.') |
56 | return parser.parse_args(args=argv) |
57 | |
58 | |
59 | def run_system_tests(conf_name, tests_to_run, update_apt=False, |
60 | network_ready=False, touch_visualization=False, |
61 | - install_deps=False): |
62 | + install_deps=False, silo=None): |
63 | """Run system tests in a device connected via USB and report the results. |
64 | :param conf_name: The name of the configuration file that will be used |
65 | for the system tests. |
66 | @@ -90,6 +97,7 @@ |
67 | :param install_deps: Install the test dependencies permanently in the |
68 | device instead of in the /tmp directory |
69 | :param touch_visualization: Enable visualization of touch points on screen |
70 | + :param silo: The silo number so install before run the tests |
71 | :returns: 0 when successful, other value when failed. |
72 | |
73 | """ |
74 | @@ -100,7 +108,7 @@ |
75 | |
76 | enable_autopilot_introspection(config_stack) |
77 | return_code = run_autopkg_test(config_stack, update_apt, network_ready, |
78 | - install_deps) |
79 | + install_deps, silo) |
80 | |
81 | if return_code <= 6: |
82 | # Return codes higher than 6 mean that there was a problem with adt or |
83 | @@ -190,45 +198,63 @@ |
84 | return command |
85 | |
86 | |
87 | -def run_autopkg_test(config_stack, update_apt, network_ready, install_deps): |
88 | - """ Run the autopkgtest in the revice for the tests selected |
89 | +def run_autopkg_test(config_stack, update_apt, network_ready, install_deps, |
90 | + silo): |
91 | + """ Run the autopkgtest in the revice for the tests selected, when tests |
92 | + are not selected, just the silo and dependencies installation part is done |
93 | :param config_stack: The config objects |
94 | :param update_apt: True if the packages hasve to be updated |
95 | :param network_ready: True if the network set in the config has to be |
96 | configured in the device |
97 | :param install_deps: True if the tests dependencies have to be installed |
98 | permanently in the device instead of install those in the tmp dir |
99 | + :param silo: The silo number so install before run the tests |
100 | :return: the autopkgtest execution exit code |
101 | """ |
102 | - extra_depends = _get_extra_dependencies( |
103 | - config_stack.get('tests_to_run', '').split() |
104 | - ) |
105 | + tests_to_run = config_stack.get('tests_to_run', '') |
106 | + extra_depends = _get_extra_dependencies(tests_to_run.split()) |
107 | + |
108 | + install_res = 0 |
109 | add_ppa = True |
110 | - if install_deps: |
111 | + if install_deps or silo: |
112 | adt_run_cmd = _build_adt_run_test_command( |
113 | config_stack, |
114 | extra_depends=extra_depends, |
115 | update_apt=update_apt, |
116 | network_ready=network_ready, |
117 | add_ppa=add_ppa, |
118 | - install_deps=install_deps) |
119 | - subprocess.call(adt_run_cmd) |
120 | + install_deps=install_deps, |
121 | + silo=silo) |
122 | + install_res = subprocess.call(adt_run_cmd) |
123 | |
124 | clean_output_directory(config_stack) |
125 | + reboot_device(config_stack) |
126 | add_ppa = False |
127 | update_apt = False |
128 | install_deps = False |
129 | - |
130 | - logger.info('Install dependencies command finished') |
131 | - |
132 | - adt_run_cmd = _build_adt_run_test_command( |
133 | - config_stack, |
134 | - extra_depends=extra_depends, |
135 | - update_apt=update_apt, |
136 | - network_ready=network_ready, |
137 | - add_ppa=add_ppa, |
138 | - install_deps=install_deps) |
139 | - return subprocess.call(adt_run_cmd) |
140 | + silo = None |
141 | + logger.info('Install silo and dependencies command finished') |
142 | + |
143 | + if tests_to_run: |
144 | + adt_run_cmd = _build_adt_run_test_command( |
145 | + config_stack, |
146 | + extra_depends=extra_depends, |
147 | + update_apt=update_apt, |
148 | + network_ready=network_ready, |
149 | + add_ppa=add_ppa, |
150 | + install_deps=install_deps, |
151 | + silo=silo) |
152 | + return subprocess.call(adt_run_cmd) |
153 | + else: |
154 | + logger.info('Tests execution skiped - No tests selected to be run') |
155 | + return install_res |
156 | + |
157 | + |
158 | +def reboot_device(config_stack): |
159 | + """ Reboot the selected device """ |
160 | + logger.info('Rebooting device') |
161 | + subprocess.call('adb reboot {}'.format(config_stack.get('device_serial')), |
162 | + shell=True) |
163 | |
164 | |
165 | def _get_extra_dependencies(tests_to_run): |
166 | @@ -352,35 +378,68 @@ |
167 | return run_cmd |
168 | |
169 | |
170 | +def _build_adt_run_setup_commands(config_stack, extra_depends=None, |
171 | + update_apt=False, network_ready=False, |
172 | + add_ppa=True, install_deps=False, silo=None): |
173 | + |
174 | + setup_cmd = [] |
175 | + |
176 | + setup_cmd.extend(_get_network_setup_command(config_stack, network_ready)) |
177 | + setup_cmd.extend(_get_update_apt_command(update_apt)) |
178 | + |
179 | + setup_cmd.extend(_get_silo_command(silo)) |
180 | + setup_cmd.extend(_get_add_ppa_command(add_ppa)) |
181 | + |
182 | + if install_deps: |
183 | + setup_cmd.extend(_get_install_setup_command()) |
184 | + |
185 | + if silo or install_deps: |
186 | + setup_cmd.extend(_get_remove_writable_command()) |
187 | + setup_cmd.extend(_get_exit_command()) |
188 | + else: |
189 | + setup_cmd.extend(_get_fs_ro_command()) |
190 | + |
191 | + return setup_cmd |
192 | + |
193 | + |
194 | def _build_adt_run_test_command(config_stack, extra_depends=None, |
195 | update_apt=False, network_ready=False, |
196 | - add_ppa=True, install_deps=False): |
197 | + add_ppa=True, install_deps=False, silo=None): |
198 | |
199 | device_password = config_stack.get('device_password') |
200 | run_cmd = _build_basic_adt_run_test_command(config_stack, extra_depends) |
201 | |
202 | + run_cmd.extend(_build_adt_run_setup_commands(config_stack, extra_depends, |
203 | + update_apt, network_ready, |
204 | + add_ppa, install_deps, silo)) |
205 | ssh_cmd = ( |
206 | ['ssh', '-s', 'adb', '--', '-p', device_password] + |
207 | _get_serial_argument(config_stack) |
208 | ) |
209 | |
210 | - run_cmd.extend(_get_network_setup_command(config_stack, network_ready)) |
211 | - run_cmd.extend(_get_update_apt_command(update_apt)) |
212 | - |
213 | + return run_cmd + ['---'] + ssh_cmd |
214 | + |
215 | + |
216 | +def _get_add_ppa_command(add_ppa): |
217 | + """ Retrieve setup commmand to add the ppa and testability """ |
218 | + setup_cmd = [] |
219 | if add_ppa: |
220 | - run_cmd.extend(_get_fs_rw_command()) |
221 | - run_cmd.extend(_get_ppa_and_testability_setup_command()) |
222 | - |
223 | - if install_deps: |
224 | - run_cmd.extend(_get_install_setup_command()) |
225 | - else: |
226 | - run_cmd.extend(_get_fs_ro_command()) |
227 | - |
228 | - return run_cmd + ['---'] + ssh_cmd |
229 | + setup_cmd.extend(_get_fs_rw_command()) |
230 | + setup_cmd.extend(_get_ppa_and_testability_setup_command()) |
231 | + return setup_cmd |
232 | + |
233 | + |
234 | +def _get_silo_command(silo): |
235 | + """ Retrieve setup commmand to install the silo """ |
236 | + setup_cmd = [] |
237 | + if silo: |
238 | + setup_cmd.extend(_get_fs_rw_command()) |
239 | + setup_cmd.extend(silo_cmd.get_install_silo_command(silo)) |
240 | + return setup_cmd |
241 | |
242 | |
243 | def _get_update_apt_command(update_apt): |
244 | - """Return command to update apt.""" |
245 | + """Return setup command to update apt.""" |
246 | if update_apt: |
247 | return ['--setup-commands', 'ro-apt-update'] |
248 | return [] |
249 | @@ -399,10 +458,12 @@ |
250 | |
251 | |
252 | def _get_fs_rw_command(): |
253 | + """ Retrieve setup commmand to set the device as rw """ |
254 | return ['--setup-commands', 'mount -o remount,rw /'] |
255 | |
256 | |
257 | def _get_fs_ro_command(): |
258 | + """ Retrieve setup commmand to set the device as ro """ |
259 | return ['--setup-commands', 'sync; sleep 2; mount -o remount,ro /'] |
260 | |
261 | |
262 | @@ -432,6 +493,14 @@ |
263 | ] |
264 | |
265 | |
266 | +def _get_remove_writable_command(): |
267 | + return ['--setup-commands', 'rm -f /userdata/.writable_image'] |
268 | + |
269 | + |
270 | +def _get_exit_command(): |
271 | + return ['--setup-commands', 'echo "Finishing setup commands" && exit 1'] |
272 | + |
273 | + |
274 | def _get_install_setup_command(): |
275 | """ Get a list with all the dependencies from the tests/control file and |
276 | when the apt-get install does not install any package, the device is set |
277 | @@ -445,12 +514,12 @@ |
278 | for dep in dependencies: |
279 | install_command += ' {}'.format(dep.split()[0]) |
280 | |
281 | - return ['--setup-commands', clean_command, |
282 | + return ['--setup-commands', 'echo "INSTALLING DEPENDENCIES"', |
283 | + '--setup-commands', clean_command, |
284 | '--setup-commands', install_command, |
285 | '--setup-commands', 'sleep 5', |
286 | '--setup-commands', clean_command, |
287 | - '--setup-commands', 'rm -f /userdata/.writable_image', |
288 | - '--setup-commands', 'reboot'] |
289 | + '--setup-commands', 'echo "DEPENDENCIES INSTALLED"'] |
290 | |
291 | |
292 | def generate_user_report(config_stack): |
293 | |
294 | === modified file 'ubuntu_system_tests/selftests/test_command_line.py' |
295 | --- ubuntu_system_tests/selftests/test_command_line.py 2015-12-03 20:21:27 +0000 |
296 | +++ ubuntu_system_tests/selftests/test_command_line.py 2015-12-03 20:21:27 +0000 |
297 | @@ -282,17 +282,25 @@ |
298 | # The nmcli network setup command is passed as --setup-command option |
299 | # to adt-run. Verify that it should not run as separate command. |
300 | ('without network setup', { |
301 | + 'tests_to_run': ['test1'], |
302 | 'keyword_arguments': {'update_apt': False, |
303 | 'network_ready': True}, |
304 | 'expected_commands': ['phablet-config', |
305 | 'adt-run'], |
306 | }), |
307 | ('with network setup', { |
308 | + 'tests_to_run': ['test1'], |
309 | 'keyword_arguments': {'update_apt': False, |
310 | 'network_ready': False}, |
311 | 'expected_commands': ['phablet-config', |
312 | 'adt-run'], |
313 | }), |
314 | + ('with no tests to run', { |
315 | + 'tests_to_run': [], |
316 | + 'keyword_arguments': {'update_apt': False, |
317 | + 'network_ready': False}, |
318 | + 'expected_commands': ['phablet-config'], |
319 | + }) |
320 | ] |
321 | |
322 | def setUp(self): |
323 | @@ -316,7 +324,7 @@ |
324 | enter.wait = mock.Mock(return_value=0) |
325 | |
326 | conf_name = os.path.basename(self.config_stack.store.path) |
327 | - command_line.run_system_tests(conf_name, [], |
328 | + command_line.run_system_tests(conf_name, self.tests_to_run, |
329 | **self.keyword_arguments) |
330 | |
331 | # The first call doesn't run any command. |
332 | @@ -337,6 +345,8 @@ |
333 | DONT_INSTALL_DEPS = False |
334 | VISUALIZATION_ON = True |
335 | VISUALIZATION_OFF = False |
336 | + DO_INSTALL_SILO = 4 |
337 | + DONT_INSTALL_SILO = False |
338 | |
339 | scenarios = [ |
340 | ('no arguments', { |
341 | @@ -347,7 +357,8 @@ |
342 | DONT_APT_UPDATE, |
343 | NETWORK_NOT_ALREADY_SETUP, |
344 | VISUALIZATION_OFF, |
345 | - DONT_INSTALL_DEPS) |
346 | + DONT_INSTALL_DEPS, |
347 | + DONT_INSTALL_SILO) |
348 | }), |
349 | ('alternative config', { |
350 | 'command_line_arguments': ['--config=alternative.conf'], |
351 | @@ -357,7 +368,8 @@ |
352 | DONT_APT_UPDATE, |
353 | NETWORK_NOT_ALREADY_SETUP, |
354 | VISUALIZATION_OFF, |
355 | - DONT_INSTALL_DEPS) |
356 | + DONT_INSTALL_DEPS, |
357 | + DONT_INSTALL_SILO) |
358 | }), |
359 | ('with apt-get update', { |
360 | 'command_line_arguments': ['--update-apt'], |
361 | @@ -367,7 +379,8 @@ |
362 | DO_APT_UPDATE, |
363 | NETWORK_NOT_ALREADY_SETUP, |
364 | VISUALIZATION_OFF, |
365 | - DONT_INSTALL_DEPS) |
366 | + DONT_INSTALL_DEPS, |
367 | + DONT_INSTALL_SILO) |
368 | }), |
369 | ('one test suite', { |
370 | 'command_line_arguments': ['test_suite'], |
371 | @@ -377,7 +390,8 @@ |
372 | DONT_APT_UPDATE, |
373 | NETWORK_NOT_ALREADY_SETUP, |
374 | VISUALIZATION_OFF, |
375 | - DONT_INSTALL_DEPS) |
376 | + DONT_INSTALL_DEPS, |
377 | + DONT_INSTALL_SILO) |
378 | }), |
379 | ('multiple test suites', { |
380 | 'command_line_arguments': [ |
381 | @@ -387,7 +401,8 @@ |
382 | DEFAULT_CONFIG_FILE, |
383 | ['test_suite1', 'test_suite2', 'test_suite3'], |
384 | DONT_APT_UPDATE, NETWORK_NOT_ALREADY_SETUP, VISUALIZATION_OFF, |
385 | - DONT_INSTALL_DEPS) |
386 | + DONT_INSTALL_DEPS, |
387 | + DONT_INSTALL_SILO) |
388 | }), |
389 | ('with network already setup', { |
390 | 'command_line_arguments': ['--network-ready'], |
391 | @@ -395,7 +410,8 @@ |
392 | DEFAULT_CONFIG_FILE, [], DONT_APT_UPDATE, |
393 | NETWORK_ALREADY_SETUP, |
394 | VISUALIZATION_OFF, |
395 | - DONT_INSTALL_DEPS) |
396 | + DONT_INSTALL_DEPS, |
397 | + DONT_INSTALL_SILO) |
398 | }), |
399 | ('with touch visualisation enabled', { |
400 | 'command_line_arguments': ['--touch-visualization'], |
401 | @@ -403,7 +419,8 @@ |
402 | DEFAULT_CONFIG_FILE, [], DONT_APT_UPDATE, |
403 | NETWORK_NOT_ALREADY_SETUP, |
404 | VISUALIZATION_ON, |
405 | - DONT_INSTALL_DEPS) |
406 | + DONT_INSTALL_DEPS, |
407 | + DONT_INSTALL_SILO) |
408 | }), |
409 | ('with install dependencies enabled', { |
410 | 'command_line_arguments': ['--install-deps'], |
411 | @@ -411,7 +428,17 @@ |
412 | DEFAULT_CONFIG_FILE, [], DONT_APT_UPDATE, |
413 | NETWORK_NOT_ALREADY_SETUP, |
414 | VISUALIZATION_OFF, |
415 | - DO_INSTALL_DEPS) |
416 | + DO_INSTALL_DEPS, |
417 | + DONT_INSTALL_SILO) |
418 | + }), |
419 | + ('with install a silo', { |
420 | + 'command_line_arguments': ['--silo', str(DO_INSTALL_SILO)], |
421 | + 'parsed_arguments': ( |
422 | + DEFAULT_CONFIG_FILE, [], DONT_APT_UPDATE, |
423 | + NETWORK_NOT_ALREADY_SETUP, |
424 | + VISUALIZATION_OFF, |
425 | + DONT_INSTALL_DEPS, |
426 | + DO_INSTALL_SILO) |
427 | }), |
428 | ] |
429 | |
430 | |
431 | === added file 'ubuntu_system_tests/silo.py' |
432 | --- ubuntu_system_tests/silo.py 1970-01-01 00:00:00 +0000 |
433 | +++ ubuntu_system_tests/silo.py 2015-12-03 20:21:27 +0000 |
434 | @@ -0,0 +1,129 @@ |
435 | +#!/usr/bin/env python3 |
436 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
437 | + |
438 | +# |
439 | +# Ubuntu System Tests |
440 | +# Copyright (C) 2015 Canonical |
441 | +# |
442 | +# This program is free software: you can redistribute it and/or modify |
443 | +# it under the terms of the GNU General Public License as published by |
444 | +# the Free Software Foundation, either version 3 of the License, or |
445 | +# (at your option) any later version. |
446 | +# |
447 | +# This program is distributed in the hope that it will be useful, |
448 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
449 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
450 | +# GNU General Public License for more details. |
451 | +# |
452 | +# You should have received a copy of the GNU General Public License |
453 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
454 | +# |
455 | + |
456 | +import subprocess |
457 | + |
458 | +TMP_POLICY_RC = '/tmp/policy-rc.d' |
459 | +POLICY_RC = '/usr/sbin/policy-rc.d' |
460 | + |
461 | + |
462 | +def _get_extra_ppa_command(silo_id, series): |
463 | + extra_ppas = '/etc/apt/preferences.d/extra-ppas.pref' |
464 | + return [ |
465 | + "--setup-commands", |
466 | + "echo 'Package: *' | tee {}".format(extra_ppas), |
467 | + "--setup-commands", |
468 | + "echo 'Pin: release o=*{}*' >> {}".format(silo_id, extra_ppas), |
469 | + "--setup-commands", |
470 | + "echo 'Pin-Priority: 1100' >> {}".format(extra_ppas), |
471 | + "--setup-commands", |
472 | + "echo '' >> {}".format(extra_ppas), |
473 | + "--setup-commands", |
474 | + "echo 'Package: *' >> {}".format(extra_ppas), |
475 | + "--setup-commands", |
476 | + "echo 'Pin: release a={}*' >> {}".format(series, extra_ppas), |
477 | + "--setup-commands", |
478 | + "echo 'Pin-Priority: 50' >> {}".format(extra_ppas)] |
479 | + |
480 | + |
481 | +def _get_install_ppas_command(ppa, distro, silo_id): |
482 | + return [ |
483 | + "--setup-commands", |
484 | + "add-apt-repository -y {}/{}/stable-phone-overlay".format(ppa, distro), |
485 | + "--setup-commands", |
486 | + "add-apt-repository -y {}/{}/{}".format(ppa, distro, silo_id)] |
487 | + |
488 | + |
489 | +def _get_update_command(): |
490 | + return [ |
491 | + "--setup-commands", |
492 | + "apt-get update", |
493 | + "--setup-commands", |
494 | + "apt-mark hold lxc-android-config", |
495 | + "--setup-commands", |
496 | + "apt-get dist-upgrade --yes --force-yes", |
497 | + "--setup-commands", |
498 | + "apt-get autoremove --yes --force-yes"] |
499 | + |
500 | + |
501 | +def _get_policy_command(): |
502 | + return [ |
503 | + "--setup-commands", |
504 | + "test -e {pol} && cp {pol} {tmp} || echo 'Policy not found'".format( |
505 | + pol=POLICY_RC, tmp=TMP_POLICY_RC), |
506 | + "--setup-commands", |
507 | + "echo 'exit 101' | tee {}".format(POLICY_RC), |
508 | + "--setup-commands", |
509 | + "sudo -A chmod +x {}".format(POLICY_RC)] |
510 | + |
511 | + |
512 | +def _get_start_up_command(silo_id): |
513 | + return [ |
514 | + "--setup-commands", |
515 | + "echo 'INSTALLING SILO {}'".format(silo_id), |
516 | + "--setup-commands", |
517 | + "touch /userdata/.adb_onlock"] |
518 | + |
519 | + |
520 | +def _get_clean_up_command(): |
521 | + return [ |
522 | + "--setup-commands", |
523 | + "test ! -e {} && rm {} || echo 'Temp policy not found'".format( |
524 | + TMP_POLICY_RC, POLICY_RC), |
525 | + "--setup-commands", |
526 | + "test -e {tmp} && mv {tmp} {pol} || echo 'Temp policy moved'".format( |
527 | + tmp=TMP_POLICY_RC, pol=POLICY_RC), |
528 | + "--setup-commands", |
529 | + "apt-mark unhold lxc-android-config", |
530 | + "--setup-commands", |
531 | + "echo 'SILO INSTALLATION FINISHED'"] |
532 | + |
533 | + |
534 | +def _get_device_distro(): |
535 | + return subprocess.check_output('adb shell lsb_release -is', shell=True, |
536 | + universal_newlines=True).strip().lower() |
537 | + |
538 | + |
539 | +def _get_device_series(): |
540 | + return subprocess.check_output('adb shell lsb_release -cs', shell=True, |
541 | + universal_newlines=True).strip() |
542 | + |
543 | + |
544 | +def get_install_silo_command(silo): |
545 | + """ Retrieve the command to install a silo in the device """ |
546 | + if not silo: |
547 | + return |
548 | + |
549 | + ppa = 'ppa:ci-train-ppa-service' |
550 | + silo_id = 'landing-' + '000{}'.format(silo)[-3:] |
551 | + series = _get_device_series() |
552 | + distro = _get_device_distro() |
553 | + |
554 | + # Create full command |
555 | + install_command = [] |
556 | + install_command.extend(_get_start_up_command(silo_id)) |
557 | + install_command.extend(_get_install_ppas_command(ppa, distro, silo_id)) |
558 | + install_command.extend(_get_policy_command()) |
559 | + install_command.extend(_get_extra_ppa_command(silo_id, series)) |
560 | + install_command.extend(_get_update_command()) |
561 | + install_command.extend(_get_clean_up_command()) |
562 | + |
563 | + return install_command |
FAILED: Continuous integration, rev:278 s-jenkins. ubuntu- ci:8080/ job/ubuntu- sanity- tests-ci/ 1173/ s-jenkins. ubuntu- ci:8080/ job/ubuntu- sanity- tests-wily- amd64-ci/ 901/console s-jenkins. ubuntu- ci:8080/ job/ubuntu- sanity- tests-wily- armhf-ci/ 902/console s-jenkins. ubuntu- ci:8080/ job/ubuntu- sanity- tests-wily- i386-ci/ 901/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- sanity- tests-ci/ 1173/rebuild
http://