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

Unified Diff: build/android/pylib/utils/emulator.py

Issue 11801016: [Android] Break GTest emulator launching into a separate function. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: fixed docstring Created 7 years, 11 months 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 | « build/android/emulator.py ('k') | build/android/run_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/utils/emulator.py
diff --git a/build/android/emulator.py b/build/android/pylib/utils/emulator.py
similarity index 92%
copy from build/android/emulator.py
copy to build/android/pylib/utils/emulator.py
index 77c9a75daa11963c0de2502d33bc828363f5fef1..1d93d99a6cdafe90d0b89d5f9d366f9f954a6cfb 100755
--- a/build/android/emulator.py
+++ b/build/android/pylib/utils/emulator.py
@@ -21,6 +21,7 @@ import time
from pylib import android_commands
from pylib import cmd_helper
+from pylib.utils import time_profile
# adb_interface.py is under ../../third_party/android_testrunner/
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..',
@@ -99,8 +100,36 @@ def _GetAvailablePort():
return port
+def LaunchEmulators(emulator_count, wait_for_boot=True):
+ """Launch multiple emulators and wait for them to boot.
+
+ Args:
+ emulator_count: number of emulators to launch.
+
+ Returns:
+ List of emulators.
+ """
+ emulators = []
+ for n in xrange(emulator_count):
+ t = time_profile.TimeProfile('Emulator launch %d' % n)
+ avd_name = None
+ if n > 0:
+ # Creates a temporary AVD for the extra emulators.
+ avd_name = 'run_tests_avd_%d' % n
+ logging.info('Emulator launch %d with avd_name=%s', n, avd_name)
+ emulator = Emulator(avd_name, False)
craigdh 2013/01/09 01:32:48 The fast_and_loose option will be removed before t
+ emulator.Launch(kill_all_emulators=n == 0)
+ t.Stop()
+ emulators.append(emulator)
+ # Wait for all emulators to boot completed.
+ if wait_for_boot:
+ for emulator in emulators:
+ emulator.ConfirmLaunch(True)
+ return emulators
+
+
class Emulator(object):
- """Provides the methods to lanuch/shutdown the emulator.
+ """Provides the methods to launch/shutdown the emulator.
The emulator has the android virtual device named 'avd_armeabi'.
@@ -312,10 +341,3 @@ class Emulator(object):
"""Install a handler to kill the emulator when we exit unexpectedly."""
for sig in self._SIGNALS:
signal.signal(sig, self._ShutdownOnSignal)
-
-def main(argv):
- Emulator(None, True).Launch(True)
-
-
-if __name__ == '__main__':
- main(sys.argv)
« no previous file with comments | « build/android/emulator.py ('k') | build/android/run_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698