Chromium Code Reviews| Index: build/android/emulator.py |
| diff --git a/build/android/emulator.py b/build/android/emulator.py |
| index 67adfb335674a6ad3e64f79427859736d4c52f3e..ff40df654bfcb315700f286c6f08b1329d84d457 100755 |
| --- a/build/android/emulator.py |
| +++ b/build/android/emulator.py |
| @@ -92,7 +92,14 @@ class Emulator(object): |
| # Time to wait for a "wait for boot complete" (property set on device). |
| _WAITFORBOOT_TIMEOUT = 300 |
| - def __init__(self): |
| + def __init__(self, fast_and_loose=False): |
| + """Init an Emulator. |
| + |
| + Args: |
| + fast_and_loose: go fast and loose. Intended for quick testing. |
|
Peter Beverloo
2012/01/12 11:19:18
Instead of "go fast and loose", could you copy the
|
| + Not for bots! |
| + |
| + """ |
| try: |
| android_sdk_root = os.environ['ANDROID_SDK_ROOT'] |
| except KeyError: |
| @@ -102,6 +109,7 @@ class Emulator(object): |
| self.emulator = os.path.join(android_sdk_root, 'tools', 'emulator') |
| self.popen = None |
| self.device = None |
| + self.fast_and_loose = fast_and_loose |
| def _DeviceName(self): |
| """Return our device name.""" |
| @@ -114,7 +122,8 @@ class Emulator(object): |
| If fails, an exception will be raised. |
| """ |
| _KillAllEmulators() # just to be sure |
| - self._AggressiveImageCleanup() |
| + if not self.fast_and_loose: |
| + self._AggressiveImageCleanup() |
| (self.device, port) = self._DeviceName() |
| emulator_command = [ |
| self.emulator, |
| @@ -123,13 +132,16 @@ class Emulator(object): |
| # The default /data size is 64M. |
| # That's not enough for 4 unit test bundles and their data. |
| '-partition-size', '256', |
| - # ALWAYS wipe the data. We've seen cases where an emulator |
| - # gets 'stuck' if we don't do this (every thousand runs or |
| - # so). |
| - '-wipe-data', |
| # Use a familiar name and port. |
| '-avd', 'buildbot', |
| '-port', str(port)] |
| + if not self.fast_and_loose: |
| + emulator_command.extend([ |
| + # ALWAYS wipe the data. We've seen cases where an emulator |
|
Peter Beverloo
2012/01/12 11:19:18
This "ALWAYS" is not accurate anymore now that it'
|
| + # gets 'stuck' if we don't do this (every thousand runs or |
| + # so). |
| + '-wipe-data', |
| + ]) |
| logging.info('Emulator launch command: %s', ' '.join(emulator_command)) |
| self.popen = subprocess.Popen(args=emulator_command, |
| stderr=subprocess.STDOUT) |