Index: buildbot/buildbot_run.py |
diff --git a/buildbot/buildbot_run.py b/buildbot/buildbot_run.py |
index cc3a25aedbd1de6384ede0e490ca9f3b7979ecb7..9d30a416bd205bfd5010862c94725d84d040edd9 100755 |
--- a/buildbot/buildbot_run.py |
+++ b/buildbot/buildbot_run.py |
@@ -107,6 +107,26 @@ def PrepareAndroidTree(): |
cwd=ANDROID_DIR) |
+def StartAndroidEmulator(): |
+ """Start an android emulator from the built android tree.""" |
+ print '@@@BUILD_STEP Start Android emulator@@@' |
+ subprocess.Popen( |
+ ['/bin/bash', '-c', |
+ 'source build/envsetup.sh && $ANDROID_HOST_OUT/bin/emulator'], |
+ cwd=ANDROID_DIR) |
+ CallSubProcess( |
+ ['/bin/bash', '-c', |
+ 'source build/envsetup.sh && $ANDROID_HOST_OUT/bin/adb wait-for-device'], |
+ cwd=ANDROID_DIR) |
+ |
+ |
+def StopAndroidEmulator(): |
+ """Stop all android emulators.""" |
+ print '@@@BUILD_STEP Stop Android emulator@@@' |
+ # If this fails, it's because there is no emulator running. |
+ subprocess.call(['pkill', 'emulator.*']) |
+ |
+ |
def GypTestFormat(title, format=None, msvs_version=None, tests=[]): |
"""Run the gyp tests for a given format, emitting annotator tags. |
@@ -160,7 +180,11 @@ def GypBuild(): |
# The Android gyp bot runs on linux so this must be tested first. |
if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-android': |
PrepareAndroidTree() |
- retcode += GypTestFormat('android') |
+ StartAndroidEmulator() |
+ try: |
+ retcode += GypTestFormat('android') |
+ finally: |
+ StopAndroidEmulator() |
elif sys.platform.startswith('linux'): |
retcode += GypTestFormat('ninja') |
retcode += GypTestFormat('make') |