Index: build/android/emulator.py |
diff --git a/build/android/emulator.py b/build/android/emulator.py |
index 67adfb335674a6ad3e64f79427859736d4c52f3e..07f64bb8fabebcbcc322c169320459125137f936 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: Loosen up the rules for reliable running for speed. |
+ Intended for quick testing or re-testing. |
+ |
+ """ |
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([ |
+ # 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', |
+ ]) |
logging.info('Emulator launch command: %s', ' '.join(emulator_command)) |
self.popen = subprocess.Popen(args=emulator_command, |
stderr=subprocess.STDOUT) |