OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # | |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 from multiprocessing import Process | |
8 import optparse | |
9 import os | |
10 import sys | |
11 | |
12 from pylib import android_commands | |
13 from pylib import test_options_parser | |
14 from pylib import constants | |
15 | |
16 | |
17 def InstallApk(device, options): | |
18 apk_path = os.path.join(os.environ['CHROME_SRC'], | |
19 'out', options.build_type, | |
20 'apks', options.apk) | |
21 result = android_commands.AndroidCommands(device=device).ManagedInstall( | |
22 apk_path, False, options.apk_package) | |
23 print '----- Installed on %s -----' % device | |
24 print result | |
25 | |
26 | |
27 def main(argv): | |
28 parser = optparse.OptionParser() | |
29 test_options_parser.AddBuildTypeOption(parser) | |
30 test_options_parser.AddInstallAPKOption(parser) | |
31 options, args = parser.parse_args(argv) | |
32 | |
33 if len(args) > 1: | |
34 raise Exception('Error: Unknown argument:', args[1:]) | |
35 | |
36 devices = android_commands.GetAttachedDevices() | |
37 if not devices: | |
38 raise Exception('Error: no connected devices') | |
39 | |
40 procs = [] | |
41 for device in devices: | |
42 p = Process(target=InstallApk, | |
43 args=(device, options)) | |
44 p.start() | |
45 procs += [p] | |
46 | |
47 for p in procs: | |
48 p.join() | |
bulach
2012/10/02 10:40:46
would something like this work?
all_args = [(devi
klundberg
2012/10/02 18:40:06
Done.
| |
49 | |
bulach
2012/10/02 10:40:46
nit: need an extra \n here
klundberg
2012/10/02 18:40:06
Done.
| |
50 if __name__ == '__main__': | |
51 sys.exit(main(sys.argv)) | |
OLD | NEW |