OLD | NEW |
---|---|
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 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 """Launches the emulator asynchronously. Call ConfirmLaunch() to ensure the | 141 """Launches the emulator asynchronously. Call ConfirmLaunch() to ensure the |
142 emulator is ready for use. | 142 emulator is ready for use. |
143 | 143 |
144 If fails, an exception will be raised. | 144 If fails, an exception will be raised. |
145 """ | 145 """ |
146 if kill_all_emulators: | 146 if kill_all_emulators: |
147 _KillAllEmulators() # just to be sure | 147 _KillAllEmulators() # just to be sure |
148 if not self.fast_and_loose: | 148 if not self.fast_and_loose: |
149 self._AggressiveImageCleanup() | 149 self._AggressiveImageCleanup() |
150 (self.device, port) = self._DeviceName() | 150 (self.device, port) = self._DeviceName() |
151 abi = os.environ.get("TARGET_PRODUCT") | |
152 if abi and "x86" in abi: | |
bulach
2012/07/12 07:45:06
nit: single quotes here and in 151..
however, I th
Wei James(wistoch)
2012/07/12 08:09:55
fixed. and thanks for the suggestion. agree that i
| |
153 abi = 'x86' | |
154 else: | |
155 abi = 'armeabi' | |
151 emulator_command = [ | 156 emulator_command = [ |
152 self.emulator, | 157 self.emulator, |
153 # Speed up emulator launch by 40%. Really. | 158 # Speed up emulator launch by 40%. Really. |
154 '-no-boot-anim', | 159 '-no-boot-anim', |
155 # The default /data size is 64M. | 160 # The default /data size is 64M. |
156 # That's not enough for 8 unit test bundles and their data. | 161 # That's not enough for 8 unit test bundles and their data. |
157 '-partition-size', '512', | 162 '-partition-size', '512', |
158 # Use a familiar name and port. | 163 # Use a familiar name and port. |
159 '-avd', 'avd_armeabi', | 164 '-avd', 'avd_' + abi, |
160 '-port', str(port)] | 165 '-port', str(port)] |
161 if not self.fast_and_loose: | 166 if not self.fast_and_loose: |
162 emulator_command.extend([ | 167 emulator_command.extend([ |
163 # Wipe the data. We've seen cases where an emulator | 168 # Wipe the data. We've seen cases where an emulator |
164 # gets 'stuck' if we don't do this (every thousand runs or | 169 # gets 'stuck' if we don't do this (every thousand runs or |
165 # so). | 170 # so). |
166 '-wipe-data', | 171 '-wipe-data', |
167 ]) | 172 ]) |
168 logging.info('Emulator launch command: %s', ' '.join(emulator_command)) | 173 logging.info('Emulator launch command: %s', ' '.join(emulator_command)) |
169 self.popen = subprocess.Popen(args=emulator_command, | 174 self.popen = subprocess.Popen(args=emulator_command, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 """Install a handler to kill the emulator when we exit unexpectedly.""" | 248 """Install a handler to kill the emulator when we exit unexpectedly.""" |
244 for sig in self._SIGNALS: | 249 for sig in self._SIGNALS: |
245 signal.signal(sig, self._ShutdownOnSignal) | 250 signal.signal(sig, self._ShutdownOnSignal) |
246 | 251 |
247 def main(argv): | 252 def main(argv): |
248 Emulator(True).Launch(True) | 253 Emulator(True).Launch(True) |
249 | 254 |
250 | 255 |
251 if __name__ == '__main__': | 256 if __name__ == '__main__': |
252 main(sys.argv) | 257 main(sys.argv) |
OLD | NEW |