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

Unified Diff: buildbot/buildbot_run.py

Issue 493743002: android: Make buildbot able to use a custom manifest. (Closed) Base URL: https://chromium.googlesource.com/external/gyp@master
Patch Set: open devnull as RO, not RW Created 6 years, 4 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
Index: buildbot/buildbot_run.py
diff --git a/buildbot/buildbot_run.py b/buildbot/buildbot_run.py
index b20a424de53ee49fc087666a23729b76c8391a75..63827074295aaae3e5837c211c0ee9769f7cd5dd 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
@@ -30,7 +31,8 @@ OUT_DIR = os.path.join(TRUNK_DIR, 'out')
def CallSubProcess(*args, **kwargs):
"""Wrapper around subprocess.call which treats errors as build exceptions."""
- retcode = subprocess.call(*args, **kwargs)
+ with open(os.devnull) as devnull_fd:
+ retcode = subprocess.call(stdin=devnull_fd, *args, **kwargs)
if retcode != 0:
print '@@@STEP_EXCEPTION@@@'
sys.exit(1)
@@ -49,10 +51,6 @@ def PrepareCmake():
print '@@@BUILD_STEP Initialize CMake checkout@@@'
os.mkdir(CMAKE_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'])
print '@@@BUILD_STEP Sync CMake@@@'
CallSubProcess(
@@ -82,27 +80,44 @@ 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(
+ ['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 +128,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',
bradn 2014/08/22 16:13:32 Rather than going thru /bin/bash you can add the a
+ '%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,
+ # 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',
bradn 2014/08/22 16:13:32 same
+ '%s && %s adb start-server ' % (_ANDROID_SETUP, adbd_wrapper)],
+ cwd=ANDROID_DIR)
+
subprocess.Popen(
['/bin/bash', '-c',
bradn 2014/08/22 16:13:32 same
- '%s && %s/emulator -no-window' % (_ANDROID_SETUP, android_host_bin)],
+ '%s && emulator -no-window' % _ANDROID_SETUP],
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)
« no previous file with comments | « buildbot/aosp_manifest.xml ('k') | test/lib/TestGyp.py » ('j') | test/lib/TestGyp.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698