| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Provides an interface to start and stop Android emulator. | 6 """Provides an interface to start and stop Android emulator. |
| 7 | 7 |
| 8 Assumes system environment ANDROID_NDK_ROOT has been set. | 8 Assumes system environment ANDROID_NDK_ROOT has been set. |
| 9 | 9 |
| 10 Emulator: The class provides the methods to launch/shutdown the emulator with | 10 Emulator: The class provides the methods to launch/shutdown the emulator with |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if kill_all_emulators: | 145 if kill_all_emulators: |
| 146 _KillAllEmulators() # just to be sure | 146 _KillAllEmulators() # just to be sure |
| 147 if not self.fast_and_loose: | 147 if not self.fast_and_loose: |
| 148 self._AggressiveImageCleanup() | 148 self._AggressiveImageCleanup() |
| 149 (self.device, port) = self._DeviceName() | 149 (self.device, port) = self._DeviceName() |
| 150 emulator_command = [ | 150 emulator_command = [ |
| 151 self.emulator, | 151 self.emulator, |
| 152 # Speed up emulator launch by 40%. Really. | 152 # Speed up emulator launch by 40%. Really. |
| 153 '-no-boot-anim', | 153 '-no-boot-anim', |
| 154 # The default /data size is 64M. | 154 # The default /data size is 64M. |
| 155 # That's not enough for 4 unit test bundles and their data. | 155 # That's not enough for 8 unit test bundles and their data. |
| 156 '-partition-size', '256', | 156 '-partition-size', '512', |
| 157 # Use a familiar name and port. | 157 # Use a familiar name and port. |
| 158 '-avd', 'buildbot', | 158 '-avd', 'buildbot', |
| 159 '-port', str(port)] | 159 '-port', str(port)] |
| 160 if not self.fast_and_loose: | 160 if not self.fast_and_loose: |
| 161 emulator_command.extend([ | 161 emulator_command.extend([ |
| 162 # Wipe the data. We've seen cases where an emulator | 162 # Wipe the data. We've seen cases where an emulator |
| 163 # gets 'stuck' if we don't do this (every thousand runs or | 163 # gets 'stuck' if we don't do this (every thousand runs or |
| 164 # so). | 164 # so). |
| 165 '-wipe-data', | 165 '-wipe-data', |
| 166 ]) | 166 ]) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 signal.signal(sig, signal.SIG_DFL) | 240 signal.signal(sig, signal.SIG_DFL) |
| 241 self.Shutdown() | 241 self.Shutdown() |
| 242 raise KeyboardInterrupt # print a stack | 242 raise KeyboardInterrupt # print a stack |
| 243 | 243 |
| 244 def _InstallKillHandler(self): | 244 def _InstallKillHandler(self): |
| 245 """Install a handler to kill the emulator when we exit unexpectedly.""" | 245 """Install a handler to kill the emulator when we exit unexpectedly.""" |
| 246 for sig in self._SIGNALS: | 246 for sig in self._SIGNALS: |
| 247 signal.signal(sig, self._ShutdownOnSignal) | 247 signal.signal(sig, self._ShutdownOnSignal) |
| 248 | 248 |
| 249 def main(argv): | 249 def main(argv): |
| 250 Emulator().launch() | 250 Emulator(True).Launch(True) |
| 251 | 251 |
| 252 | 252 |
| 253 if __name__ == '__main__': | 253 if __name__ == '__main__': |
| 254 main(sys.argv) | 254 main(sys.argv) |
| OLD | NEW |