Index: buildbot/buildbot_run.py |
diff --git a/buildbot/buildbot_run.py b/buildbot/buildbot_run.py |
index b20a424de53ee49fc087666a23729b76c8391a75..2d301d6fa9bd68f135d16800ad42f5ddee0ad6b3 100755 |
--- a/buildbot/buildbot_run.py |
+++ b/buildbot/buildbot_run.py |
@@ -7,6 +7,7 @@ |
"""Argument-less script to select what to run on the buildbots.""" |
+import filecmp |
import os |
import shutil |
import subprocess |
@@ -82,27 +83,48 @@ def PrepareAndroidTree(): |
print '@@@BUILD_STEP Clobber Android checkout@@@' |
shutil.rmtree(ANDROID_DIR) |
- # The release of Android we use is static, so there's no need to do anything |
- # if the directory already exists. |
- if os.path.isdir(ANDROID_DIR): |
+ # (Re)create the directory so that the following steps will succeed. |
+ if not os.path.isdir(ANDROID_DIR): |
+ os.mkdir(ANDROID_DIR) |
+ |
+ # We use a manifest from the gyp project listing pinned revisions of AOSP to |
+ # use, to ensure that we test against a stable target. This needs to be |
+ # updated to pick up new build system changes sometimes, so we must test if |
+ # it has changed. |
+ manifest_filename = 'aosp_manifest.xml' |
+ gyp_manifest = os.path.join(BUILDBOT_DIR, manifest_filename) |
+ android_manifest = os.path.join(ANDROID_DIR, '.repo', 'manifests', |
+ manifest_filename) |
+ manifest_is_current = (os.path.isfile(android_manifest) and |
+ filecmp.cmp(gyp_manifest, android_manifest)) |
+ if not manifest_is_current: |
+ # It's safe to repeat these steps, so just do them again to make sure we are |
+ # in a good state. |
+ print '@@@BUILD_STEP Initialize Android checkout@@@' |
+ CallSubProcess(['git', 'config', '--global', 'user.name', 'trybot']) |
jbudorick
2014/08/22 05:10:48
Ha, I think I wound up trying to upload a CL as "t
Primiano Tucci (use gerrit)
2014/08/22 11:18:16
Actually turns out that we don't need this at all
|
+ CallSubProcess(['git', 'config', '--global', |
+ 'user.email', 'chrome-bot@google.com']) |
+ CallSubProcess(['git', 'config', '--global', 'color.ui', 'false']) |
+ CallSubProcess( |
+ ['repo', 'init', |
+ '-u', 'https://android.googlesource.com/platform/manifest', |
+ '-b', 'master', |
+ '-g', 'all,-notdefault,-device,-darwin,-mips,-x86'], |
+ cwd=ANDROID_DIR) |
+ shutil.copy(gyp_manifest, android_manifest) |
+ |
+ print '@@@BUILD_STEP Sync Android@@@' |
+ CallSubProcess(['repo', 'sync', '-j4', '-m', manifest_filename], |
+ cwd=ANDROID_DIR) |
+ |
+ # If we already built the system image successfully and didn't sync to a new |
+ # version of the source, skip running the build again as it's expensive even |
+ # when there's nothing to do. |
+ system_img = os.path.join(ANDROID_DIR, 'out', 'target', 'product', 'generic', |
+ 'system.img') |
+ if manifest_is_current and os.path.isfile(system_img): |
return |
- print '@@@BUILD_STEP Initialize Android checkout@@@' |
- os.mkdir(ANDROID_DIR) |
- CallSubProcess(['git', 'config', '--global', 'user.name', 'trybot']) |
- CallSubProcess(['git', 'config', '--global', |
- 'user.email', 'chrome-bot@google.com']) |
- CallSubProcess(['git', 'config', '--global', 'color.ui', 'false']) |
- CallSubProcess( |
- ['repo', 'init', |
- '-u', 'https://android.googlesource.com/platform/manifest', |
- '-b', 'android-4.2.1_r1', |
- '-g', 'all,-notdefault,-device,-darwin,-mips,-x86'], |
- cwd=ANDROID_DIR) |
- |
- print '@@@BUILD_STEP Sync Android@@@' |
- CallSubProcess(['repo', 'sync', '-j4'], cwd=ANDROID_DIR) |
- |
print '@@@BUILD_STEP Build Android@@@' |
CallSubProcess( |
['/bin/bash', |
@@ -113,14 +135,28 @@ def PrepareAndroidTree(): |
def StartAndroidEmulator(): |
"""Start an android emulator from the built android tree.""" |
print '@@@BUILD_STEP Start Android emulator@@@' |
- android_host_bin = '$ANDROID_HOST_OUT/bin' |
+ |
+ CallSubProcess(['/bin/bash', '-c', |
+ '%s && adb kill-server ' % _ANDROID_SETUP], |
+ cwd=ANDROID_DIR) |
+ |
+ # If taskset is available, use it to force adbd to run only on one core, as, |
jbudorick
2014/08/22 05:10:48
yay adb
Primiano Tucci (use gerrit)
2014/08/22 11:18:16
Amazing, isn't it?
|
+ # sadly, it improves its reliability (see crbug.com/268450). |
+ adbd_wrapper = '' |
+ with open(os.devnull, 'w') as devnull_fd: |
+ if subprocess.call(['which', 'taskset'], stdout=devnull_fd) == 0: |
+ adbd_wrapper = 'taskset -c 0' |
+ CallSubProcess(['/bin/bash', '-c', |
+ '%s && %s adb start-server ' % (_ANDROID_SETUP, adbd_wrapper)], |
+ cwd=ANDROID_DIR) |
+ |
subprocess.Popen( |
['/bin/bash', '-c', |
- '%s && %s/emulator -no-window' % (_ANDROID_SETUP, android_host_bin)], |
+ '%s && emulator -no-window' % _ANDROID_SETUP], |
jbudorick
2014/08/22 05:10:48
I think I asked this on torne's review, but is thi
Primiano Tucci (use gerrit)
2014/08/22 11:18:16
Correct. envsetup / lunch make it so that the corr
|
cwd=ANDROID_DIR) |
CallSubProcess( |
['/bin/bash', '-c', |
- '%s && %s/adb wait-for-device' % (_ANDROID_SETUP, android_host_bin)], |
+ '%s && adb wait-for-device' % _ANDROID_SETUP], |
cwd=ANDROID_DIR) |