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

Unified Diff: build/android/emulator.py

Issue 8889040: Android emulator image cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/emulator.py
diff --git a/build/android/emulator.py b/build/android/emulator.py
index a4b6167f357e9d5201fbbf2284cf2eac84e97bb8..ff65a918d9304f226604123753e29de87b392802 100755
--- a/build/android/emulator.py
+++ b/build/android/emulator.py
@@ -114,6 +114,7 @@ class Emulator(object):
If fails, an exception will be raised.
"""
_KillAllEmulators() # just to be sure
+ self._AggressiveImageCleanup()
(self.device, port) = self._DeviceName()
emulator_command = [
self.emulator,
@@ -135,6 +136,22 @@ class Emulator(object):
self._InstallKillHandler()
self._ConfirmLaunch()
+ def _AggressiveImageCleanup(self):
+ """Aggressive cleanup of emulator images.
+
+ Experimentally it looks like our current emulator use on the bot
+ leaves image files around in /tmp/android-$USER. If a "random"
+ name gets reused, we choke with a 'File exists' error.
+ TODO(jrg): is there a less hacky way to accomplish the same goal?
+ """
+ logging.info('Aggressive Image Cleanup')
+ emulator_imagedir = '/tmp/android-%s' % os.environ['USER']
+ for image in os.listdir(emulator_imagedir):
bulach 2011/12/09 05:32:26 nit: you may want to combine with list comprehensi
+ fullname = os.path.join(emulator_imagedir, image)
+ if 'emulator' in fullname:
+ logging.info('Deleting emulator image %s' % fullname)
+ os.unlink(fullname)
+
def _ConfirmLaunch(self, wait_for_boot=False):
"""Confirm the emulator launched properly.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698