[zorg] r293211 - [zorg] Add AOSP builder

Pengxuan Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 13:39:41 PST 2017


Author: pzheng
Date: Thu Jan 26 15:39:41 2017
New Revision: 293211

URL: http://llvm.org/viewvc/llvm-project?rev=293211&view=rev
Log:
[zorg] Add AOSP builder

Summary:
This builder builds AOSP with the latest Clang produced by the polly-arm-linux
builder. More specifically, only the target build uses the Clang from the
polly-arm-linux builder. The host build still uses AOSP's default Clang. This
builder is a nightly builder instead of one triggered by commits because of the
high computational resources needed for building AOSP.

Reviewers: zinob, gkistanova, grosser, srhines

Reviewed By: grosser

Subscribers: pirama, rengolin, danalbert, kristof.beyls, llvm-commits, aemerson

Differential Revision: https://reviews.llvm.org/D29050

Added:
    zorg/trunk/zorg/buildbot/builders/AOSPBuilder.py
Modified:
    zorg/trunk/buildbot/osuosl/master/config/builders.py
    zorg/trunk/buildbot/osuosl/master/config/status.py
    zorg/trunk/buildbot/osuosl/master/master.cfg

Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/builders.py?rev=293211&r1=293210&r2=293211&view=diff
==============================================================================
--- zorg/trunk/buildbot/osuosl/master/config/builders.py (original)
+++ zorg/trunk/buildbot/osuosl/master/config/builders.py Thu Jan 26 15:39:41 2017
@@ -16,6 +16,7 @@ from zorg.buildbot.builders import Clang
 from zorg.buildbot.builders import ClangLTOBuilder
 from zorg.buildbot.builders import UnifiedTreeBuilder
 from zorg.buildbot.builders import CUDATestsuiteBuilder
+from zorg.buildbot.builders import AOSPBuilder
 
 # Plain LLVM builders.
 def _get_llvm_builders():
@@ -667,6 +668,33 @@ def _get_polly_builders():
                                 "-DCMAKE_CXX_COMPILER:FILEPATH=/local/clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-14.04/bin/clang++"])}
        ]
 
+# AOSP builders.
+def _get_aosp_builders():
+    return [
+        {'name': "aosp-O3-polly-before-vectorizer-unprofitable",
+         'slavenames': ["hexagon-build-03"],
+         'builddir': "aosp",
+         'factory': AOSPBuilder.getAOSPBuildFactory(
+                device="angler",
+                build_clang=True,
+                extra_cmake_args=["-G", "Ninja",
+                                  "-DLLVM_TARGETS_TO_BUILD='ARM;AArch64'",
+                                  "-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-androideabi",
+                                  "-DLLVM_TARGET_ARCH=arm-linux-androideabi",
+                                  "-DLLVM_ENABLE_ASSERTIONS=True",
+                                  "-DCMAKE_C_COMPILER:FILEPATH=/local/clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-14.04/bin/clang",
+                                  "-DCMAKE_CXX_COMPILER:FILEPATH=/local/clang+llvm-3.7.1-x86_64-linux-gnu-ubuntu-14.04/bin/clang++"])}
+                timeout=180,
+                target_clang=None,
+                target_flags="-Wno-error -O3 -mllvm -polly -mllvm -polly-position=before-vectorizer -mllvm -polly-process-unprofitable",
+                jobs=16,
+                extra_make_args=None,
+                env={},
+                clean=False,
+                sync=False,
+                patch=None)}
+    ]
+
 # LLDB builders.
 def _get_lldb_builders():
     return [
@@ -1338,6 +1366,10 @@ def get_builders():
         b['category'] = 'polly'
         yield b
 
+    for b in _get_aosp_builders():
+        b['category'] = 'aosp'
+        yield b
+
     for b in _get_lld_builders():
         b['category'] = 'lld'
         yield b

Modified: zorg/trunk/buildbot/osuosl/master/config/status.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/status.py?rev=293211&r1=293210&r2=293211&view=diff
==============================================================================
--- zorg/trunk/buildbot/osuosl/master/config/status.py (original)
+++ zorg/trunk/buildbot/osuosl/master/config/status.py Thu Jan 26 15:39:41 2017
@@ -174,7 +174,8 @@ def get_status_targets(standard_builders
             extraRecipients = ["efriedma at codeaurora.org"],
             subject="Build %(builder)s Failure",
             mode = "failing",
-            builders = ["polly-arm-linux"],
+            builders = ["polly-arm-linux",
+                        "aosp-O3-polly-before-vectorizer-unprofitable"],
             addLogs=False,
             num_lines = 15),
         InformativeMailNotifier(

Modified: zorg/trunk/buildbot/osuosl/master/master.cfg
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/master.cfg?rev=293211&r1=293210&r2=293211&view=diff
==============================================================================
--- zorg/trunk/buildbot/osuosl/master/master.cfg (original)
+++ zorg/trunk/buildbot/osuosl/master/master.cfg Thu Jan 26 15:39:41 2017
@@ -109,6 +109,7 @@ from buildbot.scheduler import Scheduler
 from buildbot.schedulers import triggerable
 from buildbot.schedulers.filter import ChangeFilter
 from buildbot.schedulers.basic import SingleBranchScheduler
+from buildbot.schedulers.timed import Nightly
 
 def depends_on(projects):
     """
@@ -225,6 +226,12 @@ c['schedulers'].append(SingleBranchSched
                                 "cfe",
                                 "llgo"])))
 
+c['schedulers'].append(Nightly(name="aosp_scheduler",
+                               builderNames=get_all_for("aosp"),
+                               hour=19,
+                               minute=0,
+                               branch=None))
+
 c['schedulers'].extend(
     config.schedulers.getSingleBranchSchedulers(c['builders'], c['schedulers'])
     )

Added: zorg/trunk/zorg/buildbot/builders/AOSPBuilder.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/AOSPBuilder.py?rev=293211&view=auto
==============================================================================
--- zorg/trunk/zorg/buildbot/builders/AOSPBuilder.py (added)
+++ zorg/trunk/zorg/buildbot/builders/AOSPBuilder.py Thu Jan 26 15:39:41 2017
@@ -0,0 +1,124 @@
+import buildbot
+from buildbot.steps.shell import ShellCommand
+from buildbot.steps.source import SVN
+from zorg.buildbot.builders import PollyBuilder
+
+# Setting up the build envrionment for building AOSP on Ubuntu (>=15.04).
+# $ sudo apt-get update
+# $ sudo apt-get install openjdk-8-jdk
+# For older Ubuntu versions, refer to the following link for detailed instructions.
+# https://source.android.com/source/initializing.html
+#
+# Downloading AOSP source.
+# $ curl https://storage.googleapis.com/git-repo-downloads/repo > REPO_PATH/repo
+# $ chmod a+x REPO_PATH/repo
+# $ mkdir aosp && cd aosp
+# $ REPO_PATH/repo init -u https://android.googlesource.com/platform/manifest -b BRANCH_NAME
+# $ REPO_PATH/repo sync
+# Refer to the following link for detailed instructions:
+# http://source.android.com/source/downloading.html
+
+
+def getAOSPBuildCommand(
+    device,                # Target device for AOSP build
+    timeout=None,          # Maximum CPU time in seconds, umlimited if 'None'
+    target_clang=None,     # Path to the Clang used for AOSP target build
+                           # Set target_clang to None to use AOSP's default Clang
+    target_flags=None,     # Extra C/CXX flags for AOSP target build
+    jobs=None,             # Number of concurrent jobs
+    extra_make_args=None): # Extra args for the make command
+    command = "source build/envsetup.sh"
+    command += " && lunch aosp_%s-userdebug" % device
+    command += " && make -k"
+    if timeout:
+        command += " TIMEOUT=%s" % timeout
+    if target_clang:
+        command += " TARGET_CLANG=%s" % target_clang
+    if target_flags:
+        command += " TARGET_FLAGS='%s'" % target_flags
+    if extra_make_args:
+        command += " " + extra_make_args
+    if jobs:
+        command += " -j" + str(jobs)
+    return command
+
+
+def getAOSPBuildFactory(
+    device,                # Target device for AOSP build
+    build_clang=False,     # Flag to control building Clang for AOSP target build
+    extra_cmake_args=[],   # Extra args for the LLVM cmake command
+                           # This flag is ignored if build_clang is False
+    timeout=None,          # Maximum CPU time in seconds, umlimited if 'None'
+    target_clang=None,     # Path to the Clang used for AOSP target build
+                           # Set target_clang to None to use AOSP's default Clang
+                           # This flag is ignored if build_clang is True
+    target_flags=None,     # Extra C/CXX flags for AOSP target build
+    jobs=None,             # Number of concurrent jobs
+    extra_make_args=None,  # Extra args for the make command
+    env={},                # Environmen variables for all steps
+    clean=False,           # Flag to control whether AOSP repo is cleaned
+    sync=False,            # Flag to control whether AOSP repo is synced
+    patch=None):           # Name of the patch to apply to AOSP source
+    f = buildbot.process.factory.BuildFactory()
+    clang_dir = target_clang
+
+    # Build Clang for AOSP target build
+    if build_clang:
+        f = PollyBuilder.getPollyBuildFactory(clean=True,
+                                              install=True,
+                                              make='ninja',
+                                              jobs=jobs,
+                                              checkFormat=False,
+                                              extraCmakeArgs=extra_cmake_args)
+        clang_dir = 'llvm.inst/bin'
+
+    # Restore AOSP repo to a clean state
+    if clean:
+        f.addStep(ShellCommand(name="clean-repo",
+                               command=['repo', 'forall', '-c',
+                                        'git reset --hard; git clean -fdx'],
+                               haltOnFailure=False,
+                               description=["clean repo"],
+                               workdir=".",
+                               env=env))
+
+    # Sync AOSP repo
+    if sync:
+        f.addStep(ShellCommand(name="sync-repo",
+                               command=['repo', 'sync', '-c', '--no-tags'],
+                               haltOnFailure=False,
+                               description=["sync repo"],
+                               workdir=".",
+                               env=env))
+
+    # Patch AOSP build system to allow switching Clang for target build
+    if patch:
+        f.addStep(ShellCommand(name="patch-aosp",
+                               command=['patch', '-p1', '-i',
+                                        'patches/%s.patch' % patch],
+                               haltOnFailure=True,
+                               description=["patch aosp"],
+                               workdir=".",
+                               env=env))
+
+    # Delete existing output dir
+    f.addStep(ShellCommand(name="delete-out-dir",
+                           command=['rm', '-rf', 'out'],
+                           haltOnFailure=False,
+                           description=["delete out dir"],
+                           workdir=".",
+                           env=env))
+
+    # Build AOSP
+    f.addStep(ShellCommand(name="build-aosp",
+                           command=getAOSPBuildCommand(device=device,
+                                                       timeout=timeout,
+                                                       target_clang=clang_dir,
+                                                       target_flags=target_flags,
+                                                       jobs=jobs,
+                                                       extra_make_args=extra_make_args),
+                           haltOnFailure=True,
+                           description=["build aosp"],
+                           workdir=".",
+                           env=env))
+    return f




More information about the llvm-commits mailing list