Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(655)

Side by Side Diff: build/android/emulator.py

Issue 10696170: Fix SDK installer by downloading r20 directly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | build/install-build-deps-android-sdk.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Provides an interface to start and stop Android emulator. 7 """Provides an interface to start and stop Android emulator.
8 8
9 Assumes system environment ANDROID_NDK_ROOT has been set. 9 Assumes system environment ANDROID_NDK_ROOT has been set.
10 10
11 Emulator: The class provides the methods to launch/shutdown the emulator with 11 Emulator: The class provides the methods to launch/shutdown the emulator with
12 the android virtual device named 'buildbot' . 12 the android virtual device named 'avd_armeabi' .
13 """ 13 """
14 14
15 import logging 15 import logging
16 import os 16 import os
17 import signal 17 import signal
18 import subprocess 18 import subprocess
19 import sys 19 import sys
20 import time 20 import time
21 21
22 from pylib import android_commands 22 from pylib import android_commands
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 for emulator in emulators: 79 for emulator in emulators:
80 used_ports.append(emulator.split('-')[1]) 80 used_ports.append(emulator.split('-')[1])
81 for port in PortPool.port_range(): 81 for port in PortPool.port_range():
82 if str(port) not in used_ports: 82 if str(port) not in used_ports:
83 return port 83 return port
84 84
85 85
86 class Emulator(object): 86 class Emulator(object):
87 """Provides the methods to lanuch/shutdown the emulator. 87 """Provides the methods to lanuch/shutdown the emulator.
88 88
89 The emulator has the android virtual device named 'buildbot'. 89 The emulator has the android virtual device named 'avd_armeabi'.
90 90
91 The emulator could use any even TCP port between 5554 and 5584 for the 91 The emulator could use any even TCP port between 5554 and 5584 for the
92 console communication, and this port will be part of the device name like 92 console communication, and this port will be part of the device name like
93 'emulator-5554'. Assume it is always True, as the device name is the id of 93 'emulator-5554'. Assume it is always True, as the device name is the id of
94 emulator managed in this class. 94 emulator managed in this class.
95 95
96 Attributes: 96 Attributes:
97 emulator: Path of Android's emulator tool. 97 emulator: Path of Android's emulator tool.
98 popen: Popen object of the running emulator process. 98 popen: Popen object of the running emulator process.
99 device: Device name of this emulator. 99 device: Device name of this emulator.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 self._AggressiveImageCleanup() 149 self._AggressiveImageCleanup()
150 (self.device, port) = self._DeviceName() 150 (self.device, port) = self._DeviceName()
151 emulator_command = [ 151 emulator_command = [
152 self.emulator, 152 self.emulator,
153 # Speed up emulator launch by 40%. Really. 153 # Speed up emulator launch by 40%. Really.
154 '-no-boot-anim', 154 '-no-boot-anim',
155 # The default /data size is 64M. 155 # The default /data size is 64M.
156 # That's not enough for 8 unit test bundles and their data. 156 # That's not enough for 8 unit test bundles and their data.
157 '-partition-size', '512', 157 '-partition-size', '512',
158 # Use a familiar name and port. 158 # Use a familiar name and port.
159 '-avd', 'buildbot', 159 '-avd', 'avd_armeabi',
160 '-port', str(port)] 160 '-port', str(port)]
161 if not self.fast_and_loose: 161 if not self.fast_and_loose:
162 emulator_command.extend([ 162 emulator_command.extend([
163 # Wipe the data. We've seen cases where an emulator 163 # Wipe the data. We've seen cases where an emulator
164 # gets 'stuck' if we don't do this (every thousand runs or 164 # gets 'stuck' if we don't do this (every thousand runs or
165 # so). 165 # so).
166 '-wipe-data', 166 '-wipe-data',
167 ]) 167 ])
168 logging.info('Emulator launch command: %s', ' '.join(emulator_command)) 168 logging.info('Emulator launch command: %s', ' '.join(emulator_command))
169 self.popen = subprocess.Popen(args=emulator_command, 169 self.popen = subprocess.Popen(args=emulator_command,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 """Install a handler to kill the emulator when we exit unexpectedly.""" 243 """Install a handler to kill the emulator when we exit unexpectedly."""
244 for sig in self._SIGNALS: 244 for sig in self._SIGNALS:
245 signal.signal(sig, self._ShutdownOnSignal) 245 signal.signal(sig, self._ShutdownOnSignal)
246 246
247 def main(argv): 247 def main(argv):
248 Emulator(True).Launch(True) 248 Emulator(True).Launch(True)
249 249
250 250
251 if __name__ == '__main__': 251 if __name__ == '__main__':
252 main(sys.argv) 252 main(sys.argv)
OLDNEW
« no previous file with comments | « no previous file | build/install-build-deps-android-sdk.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698