Esempio n. 1
0
    def setup(self, parallel, test_with_PTY=False, **kwargs):
        self.addStep(
            Configure(command=["./configure", "--prefix", "$(PWD)/target"] +
                      self.configureFlags))
        compile = ["make", self.makeTarget]
        testopts = self.testFlags
        # Timeout for the buildworker process
        self.test_timeout = self.test_timeout or TEST_TIMEOUT
        # Timeout for faulthandler
        faulthandler_timeout = self.test_timeout - 5 * 60
        if parallel:
            compile = ["make", parallel, self.makeTarget]
            testopts = testopts + " " + parallel
        if "-j" not in testopts:
            testopts = "-j2 " + testopts
        test = [
            "make",
            "buildbottest",
            "TESTOPTS=" + testopts + " ${BUILDBOT_TESTOPTS}",
            "TESTPYTHONOPTS=" + self.interpreterFlags,
            "TESTTIMEOUT=" + str(faulthandler_timeout),
        ]

        self.addStep(Compile(command=compile))
        self.addStep(
            ShellCommand(
                name="pythoninfo",
                description="pythoninfo",
                command=["make", "pythoninfo"],
                warnOnFailure=True,
            ))
        self.addStep(
            Test(command=test, timeout=self.test_timeout,
                 usePTY=test_with_PTY))
        self.addStep(Clean())
Esempio n. 2
0
    def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
        if branch == "3.x":
            branch = master_branch_version
        installed_python = "./target/bin/python%s" % branch
        self.addStep(
            Configure(command=["./configure", "--prefix", "$(PWD)/target"] +
                      self.configureFlags))

        compile = ["make", self.makeTarget]
        install = ["make", self.installTarget]
        testopts = self.defaultTestOpts[:]
        # Timeout for the buildworker process
        self.test_timeout = self.test_timeout or TEST_TIMEOUT
        # Timeout for faulthandler
        if parallel:
            compile = ["make", parallel, self.makeTarget]
            install = ["make", parallel, self.installTarget]
            testopts = testopts + [parallel]
        test = [installed_python] + self.interpreterFlags
        test += ["-m", "test.regrtest"] + testopts

        self.addStep(Compile(command=compile))
        self.addStep(Install(command=install))
        self.addStep(LockInstall())
        self.addStep(
            Test(command=test, timeout=self.test_timeout,
                 usePTY=test_with_PTY))
        self.addStep(Uninstall())
        self.addStep(Clean())
Esempio n. 3
0
 def __init__(self,
              source,
              configure="./configure",
              configureEnv={},
              configureFlags=[],
              compile=["make", "all"],
              test=["make", "check"]):
     BuildFactory.__init__(self, [source])
     if configure is not None:
         # we either need to wind up with a string (which will be
         # space-split), or with a list of strings (which will not). The
         # list of strings is the preferred form.
         if type(configure) is str:
             if configureFlags:
                 assert not " " in configure  # please use list instead
                 command = [configure] + configureFlags
             else:
                 command = configure
         else:
             assert isinstance(configure, (list, tuple))
             command = configure + configureFlags
         self.addStep(Configure(command=command, env=configureEnv))
     if compile is not None:
         self.addStep(Compile(command=compile))
     if test is not None:
         self.addStep(Test(command=test))
Esempio n. 4
0
def getLLDBLinuxCMakeStep(f,
                          build_compiler,
                          build_type,
                          target_arch,
                          env=None):
    if env is None:
        env = {}
    llvm_srcdir = 'llvm'
    llvm_builddir = 'build'
    # Construct cmake
    cmake_args = ["cmake", "-GNinja"]
    cmake_args.append(WithProperties("-DCMAKE_BUILD_TYPE=%s" % build_type))
    cmake_args.append(WithProperties('%(builddir)s/' + llvm_srcdir))
    cmake_args.append("-DCMAKE_C_COMPILER=%s" %
                      getCCompilerCmd(build_compiler))
    cmake_args.append("-DCMAKE_CXX_COMPILER=%s" %
                      getCxxCompilerCmd(build_compiler))

    f.addStep(
        Configure(name='cmake-linux-%s' % (target_arch),
                  command=cmake_args,
                  env=env,
                  haltOnFailure=True,
                  workdir=llvm_builddir))
    return f
Esempio n. 5
0
def addModernClangGDBTests(f, jobs, install_prefix):
    make_vars = [
        WithProperties('RUNTESTFLAGS=CC_FOR_TARGET=\'{0}/bin/clang\' '
                       'CXX_FOR_TARGET=\'{0}/bin/clang++\' '
                       'CFLAGS_FOR_TARGET=\'-w -fno-limit-debug-info\''.format(
                           install_prefix))
    ]
    f.addStep(
        SVN(name='svn-clang-modern-gdb-tests',
            mode='update',
            svnurl=
            'http://llvm.org/svn/llvm-project/clang-tests-external/trunk/gdb/7.5',
            workdir='clang-tests/src'))
    f.addStep(
        Configure(command='../src/configure', workdir='clang-tests/build/'))
    f.addStep(
        WarningCountingShellCommand(
            name='gdb-75-build',
            command=['make', WithProperties('-j%s' % jobs)],
            haltOnFailure=True,
            workdir='clang-tests/build'))
    f.addStep(
        commands.DejaGNUCommand.DejaGNUCommand(
            name='gdb-75-check',
            command=['make', '-k',
                     WithProperties('-j%s' % jobs), 'check'] + make_vars,
            workdir='clang-tests/build',
            logfiles={
                'dg.sum': 'gdb/testsuite/gdb.sum',
                'gdb.log': 'gdb/testsuite/gdb.log'
            }))
Esempio n. 6
0
def getLLDBAndroidCMakeStep(f, build_compiler, build_type, bindir, target_arch,
                            env):
    if env is None:
        env = {}
    llvm_srcdir = 'llvm'
    llvm_builddir = 'build/android-' + target_arch
    abiMap = {'i386': 'x86', 'arm': 'armeabi', 'aarch64': 'aarch64'}
    # Construct cmake
    cmake_args = ["cmake", "-GNinja"]
    cmake_args.append(WithProperties("-DCMAKE_BUILD_TYPE=%s" % build_type))
    cmake_args.append(WithProperties('%(builddir)s/' + llvm_srcdir))
    cmake_args.append(
        WithProperties('-DCMAKE_TOOLCHAIN_FILE=' + '%(builddir)s/' +
                       llvm_srcdir +
                       '/tools/lldb/cmake/platforms/Android.cmake'))
    cmake_args.append(
        WithProperties('-DANDROID_TOOLCHAIN_DIR=' + '%(toolchain_build)s'))
    cmake_args.append('-DANDROID_ABI=' + abiMap[target_arch])
    cmake_args.append('-DCMAKE_CXX_COMPILER_VERSION=4.9')
    cmake_args.append('-DLLVM_TARGET_ARCH=' + target_arch)
    cmake_args.append('-DLLVM_HOST_TRIPLE=' + target_arch +
                      '-unknown-linux-android')
    cmake_args.append(
        WithProperties('-DLLVM_TABLEGEN=%(tblgen_bindir)s/llvm-tblgen'))
    cmake_args.append(
        WithProperties('-DCLANG_TABLEGEN=%(tblgen_bindir)s/clang-tblgen'))

    f.addStep(
        Configure(name='cmake-android-%s' % target_arch,
                  command=cmake_args,
                  env=env,
                  haltOnFailure=True,
                  workdir=llvm_builddir))
    return f
Esempio n. 7
0
    def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
        self.addStep(
            Configure(
                command=["./configure", "--prefix", "$(PWD)/target"]
                + self.configureFlags
            )
        )
        compile = ["make", self.makeTarget]
        testopts = self.testFlags
        if "-R" not in self.testFlags:
            testopts += " --junit-xml test-results.xml"
        # Timeout for the buildworker process
        self.test_timeout = self.test_timeout or TEST_TIMEOUT
        # Timeout for faulthandler
        faulthandler_timeout = self.test_timeout - 5 * 60
        if parallel:
            compile = ["make", parallel, self.makeTarget]
            testopts = testopts + " " + parallel
        if "-j" not in testopts:
            testopts = "-j2 " + testopts
        cleantest = [
            "make",
            "cleantest",
            "TESTOPTS=" + testopts + " ${BUILDBOT_TESTOPTS}",
            "TESTPYTHONOPTS=" + self.interpreterFlags,
            "TESTTIMEOUT=" + str(faulthandler_timeout),
        ]
        test = [
            "make",
            "buildbottest",
            "TESTOPTS=" + testopts + " ${BUILDBOT_TESTOPTS}",
            "TESTPYTHONOPTS=" + self.interpreterFlags,
            "TESTTIMEOUT=" + str(faulthandler_timeout),
        ]

        self.addStep(Compile(command=compile, env=self.compile_environ))
        self.addStep(
            ShellCommand(
                name="pythoninfo",
                description="pythoninfo",
                command=["make", "pythoninfo"],
                warnOnFailure=True,
                env=self.test_environ,
            )
        )
        # FIXME: https://bugs.python.org/issue37359#msg346686
        # if regrtest_has_cleanup(branch):
        #    self.addStep(CleanupTest(command=cleantest))
        self.addStep(
            Test(
                command=test,
                timeout=self.test_timeout,
                usePTY=test_with_PTY,
                env=self.test_environ,
            )
        )
        if branch not in ("3",) and "-R" not in self.testFlags:
            self.addStep(UploadTestResults(branch))
        self.addStep(Clean())
Esempio n. 8
0
    def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
        if branch == "3.x":
            branch = master_branch_version
        elif branch == "custom":
            branch = "3"
        installed_python = "./target/bin/python%s" % branch
        self.addStep(
            Configure(
                command=["./configure", "--prefix", "$(PWD)/target"]
                + self.configureFlags
            )
        )

        compile = ["make", self.makeTarget]
        install = ["make", self.installTarget]
        testopts = self.defaultTestOpts[:]
        # Timeout for the buildworker process
        self.test_timeout = self.test_timeout or TEST_TIMEOUT
        # Timeout for faulthandler
        if branch != "2.7":
            faulthandler_timeout = self.test_timeout - 5 * 60
            testopts += [f"--timeout={faulthandler_timeout}"]
        if parallel:
            compile = ["make", parallel, self.makeTarget]
            install = ["make", parallel, self.installTarget]
            testopts = testopts + [parallel]

        test = [installed_python] + self.interpreterFlags
        test += ["-m", "test.regrtest"] + testopts

        cleantest = test + ["--cleanup"]

        self.addStep(Compile(command=compile))
        self.addStep(Install(command=install))
        self.addStep(LockInstall())
        # FIXME: https://bugs.python.org/issue37359#msg346686
        # if regrtest_has_cleanup(branch):
        #    self.addStep(CleanupTest(command=cleantest))
        self.addStep(
            ShellCommand(
                name="pythoninfo",
                description="pythoninfo",
                command=[installed_python, "-m", "test.pythoninfo"],
                warnOnFailure=True,
            )
        )
        self.addStep(
            Test(command=test, timeout=self.test_timeout, usePTY=test_with_PTY)
        )
        self.addStep(Uninstall())
        self.addStep(Clean())
Esempio n. 9
0
    def __init__(self,
                 source,
                 configure="./configure",
                 configureEnv=None,
                 configureFlags=None,
                 reconf=None,
                 compile=None,
                 test=None,
                 distcheck=None):
        if configureEnv is None:
            configureEnv = {}
        if configureFlags is None:
            configureFlags = []
        if compile is None:
            compile = ["make", "all"]
        if test is None:
            test = ["make", "check"]
        if distcheck is None:
            distcheck = ["make", "distcheck"]

        BuildFactory.__init__(self, [source])

        if reconf is True:
            reconf = ["autoreconf", "-si"]
        if reconf is not None:
            self.addStep(
                ShellCommand(name="autoreconf",
                             command=reconf,
                             env=configureEnv))

        if configure is not None:
            # we either need to wind up with a string (which will be
            # space-split), or with a list of strings (which will not). The
            # list of strings is the preferred form.
            if isinstance(configure, str):
                if configureFlags:
                    assert " " not in configure  # please use list instead
                    command = [configure] + configureFlags
                else:
                    command = configure
            else:
                assert isinstance(configure, (list, tuple))
                command = configure + configureFlags
            self.addStep(Configure(command=command, env=configureEnv))
        if compile is not None:
            self.addStep(Compile(command=compile, env=configureEnv))
        if test is not None:
            self.addStep(Test(command=test, env=configureEnv))
        if distcheck is not None:
            self.addStep(Test(command=distcheck, env=configureEnv))
Esempio n. 10
0
 def setup(self, **kwargs):
     self.addStep(
         Configure(command=["./configure", "--prefix", "$(PWD)/target"]))
     self.addStep(Compile(command=["make"]))
     self.addStep(
         ShellCommand(name="install",
                      description="installing",
                      command=["make", "install"]))
     self.addStep(
         Test(command=[
             "make",
             "-C",
             "Tools/freeze/test",
             "PYTHON=../../../target/bin/python3",
             "OUTDIR=../../../target/freezetest",
         ]))
Esempio n. 11
0
    def __init__(self, source, config):
        super().__init__([source])

        # create local tfvars config
        self.addStep(StringDownload(config, workerdest="terraform.tfvars"))
        # autoreconf
        reconf = ["autoreconf", "-si"]
        self.addStep(ShellCommand(name="autoreconf", command=reconf))

        # ./configure
        configure = "./configure"
        self.addStep(Configure(command=configure))

        # make init
        init = ["make", "init"]
        self.addStep(ShellCommand(name="init", command=init))

        # make check -s
        self.addStep(GnuAutotestTest())
Esempio n. 12
0
 def __init__(self, source, perl="perl"):
     BuildFactory.__init__(self, [source])
     self.addStep(Configure(command=[perl, "Makefile.PL"]))
     self.addStep(Compile(command=["make"]))
     self.addStep(PerlModuleTest(command=["make", "test"]))
Esempio n. 13
0
        self.setCommand(command)
        return Compile.start(self)


name = 'Boost'
hub_repo = 'ryppl/boost-zero'

include_features = ['os', 'cc']

repositories = [GitHub(hub_repo, protocol='https')]

build_procedures = [
    BuildProcedure('Integration').addSteps(
        *repositories[0].steps(workdir='boost', haltOnFailure=True)).addSteps(
            Configure(workdir='boost',
                      command=cmake('%(clean:+clean)sconfigure'),
                      haltOnFailure=True),
            CMakeBuild('Debug', workdir='boost/build', haltOnFailure=False),
            CMakeBuild('Release', workdir='boost/build', haltOnFailure=False),
            Test(workdir='boost', command=cmake('test'), haltOnFailure=False),
            ShellCommand(workdir='boost',
                         command=cmake('documentation'),
                         name='Docs'))
]

transitions = {'successToFailure': 1, 'failureToSuccess': 1, 'exception': 1}

status = [
    IRC(host="irc.freenode.net",
        nick="rypbot",
        notify_events=transitions,
Esempio n. 14
0
def createTarballFactory(gerrit_repo):
    """ Generates a build factory for a tarball generating builder.
    Returns:
        BuildFactory: Build factory with steps for generating tarballs.
    """
    bf = util.BuildFactory()

    # are we building a tag or a patchset?
    bf.addStep(SetProperty(
        property='category',
        value=buildCategory, 
        hideStepIf=hide_except_error))

    # update dependencies
    bf.addStep(ShellCommand(
        command=dependencyCommand,
        decodeRC={0 : SUCCESS, 1 : FAILURE, 2 : WARNINGS, 3 : SKIPPED },
        haltOnFailure=True,
        logEnviron=False,
        doStepIf=do_step_installdeps,
        hideStepIf=hide_if_skipped,
        description=["installing dependencies"],
        descriptionDone=["installed dependencies"]))

    # Pull the patch from Gerrit
    bf.addStep(Gerrit(
        repourl=gerrit_repo,
        workdir="build/lustre",
        mode="full",
        method="fresh",
        retry=[60,60],
        timeout=3600,
        logEnviron=False,
        getDescription=True,
        haltOnFailure=True,
        description=["cloning"],
        descriptionDone=["cloned"]))

    # make tarball
    bf.addStep(ShellCommand(
        command=['sh', './autogen.sh'],
        haltOnFailure=True,
        description=["autogen"],
        descriptionDone=["autogen"],
        workdir="build/lustre"))

    bf.addStep(Configure(
        command=['./configure', '--enable-dist'],
        workdir="build/lustre"))

    bf.addStep(ShellCommand(
        command=['make', 'dist'],
        haltOnFailure=True,
        description=["making dist"],
        descriptionDone=["make dist"],
        workdir="build/lustre"))

    # upload it to the master
    bf.addStep(SetPropertyFromCommand(
        command=['sh', '-c', 'echo *.tar.gz'],
        property='tarball',
        workdir="build/lustre",
        hideStepIf=hide_except_error,
        haltOnFailure=True))

    bf.addStep(FileUpload(
        workdir="build/lustre",
        slavesrc=util.Interpolate("%(prop:tarball)s"),
        masterdest=tarballMasterDest,
        url=tarballUrl))

    # trigger our builders to generate packages
    bf.addStep(Trigger(
        schedulerNames=["package-builders"],
        copy_properties=['tarball', 'category'],
        waitForFinish=False))

    return bf
Esempio n. 15
0
                descriptionDone=["mingw headers", "installed"],
                command=["make", "-f", "mingw-makefile", "headers-install"],
                env={
                    "SRC_ARCHIVE": WithProperties("%(src_archive)s"),
                    "TARGET_ARCH": WithProperties("%(target_arch)s")
                }))

        # Make binutils
        self.addStep(
            Configure(
                name="binutils-configure",
                description=["binutils", "configure"],
                descriptionDone=["binutils", "configured"],
                command=["make", "-f", "mingw-makefile", "binutils-configure"],
                env={
                    "SRC_ARCHIVE":
                    WithProperties("%(src_archive)s"),
                    "BINUTILS_CONFIG_EXTRA_ARGS":
                    WithProperties("%(binutils_config_args)s"),
                    "TARGET_ARCH":
                    WithProperties("%(target_arch)s")
                }))

        self.addStep(
            Compile(
                name="binutils-compile",
                description=["binutils compile"],
                descriptionDone=["binutils compiled"],
                command=["make", "-f", "mingw-makefile", "binutils-compile"],
                env={
                    "SRC_ARCHIVE": WithProperties("%(src_archive)s"),
Esempio n. 16
0
def getLLVMBuildFactory(
    triple=None,  # Triple to build, host, and target.
    clean=True,  # "clean-llvm" step is requested if true.
    test=True,  # "test-llvm" step is requested if true.
    expensive_checks=False,
    examples=False,  # "compile.examples" step is requested if true.
    valgrind=False,  # Valgrind is used on "test-llvm" step if true.
    valgrindLeakCheck=False,  # Valgrind leak check is requested if true.
    valgrindSuppressions=None,  # Valgrind suppression file.
    jobs='%(jobs)s',  # Number of concurrent jobs.
    timeout=20,  # Timeout if no activity seen (minutes).
    make='make',  # Make command.
    enable_shared=False,  # Enable shared (--enable-shared configure parameters added) if true.
    enable_targets=None,  # List of enabled targets (--enable-targets configure param).
    defaultBranch='trunk',  # Branch to build.
    llvmgccdir=None,  # Path to llvm-gcc.
    config_name='Debug+Asserts',  # Configuration name.
    env={},  # Environmental variables for all steps.
    extra_configure_args=[]):  # Extra args for the conigure step.
    # Prepare environmental variables. Set here all env we want everywhere.
    merged_env = {
        'TERM': 'dumb'  # Make sure Clang doesn't use color escape sequences.
    }
    if env is not None:
        merged_env.update(
            env
        )  # Overwrite pre-set items with the given ones, so user can set anything.

    llvm_srcdir = "llvm.src"
    llvm_objdir = "llvm.obj"

    f = buildbot.process.factory.BuildFactory()

    # Determine the build directory.
    f.addStep(
        buildbot.steps.shell.SetProperty(name="get_builddir",
                                         command=["pwd"],
                                         property="builddir",
                                         description="set build dir",
                                         workdir=".",
                                         env=merged_env))

    # Checkout sources.
    f.addStep(
        SVN(name='svn-llvm',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/llvm/',
            defaultBranch=defaultBranch,
            workdir=llvm_srcdir))

    # Force without llvm-gcc so we don't run afoul of Frontend test failures.
    configure_args = [
        WithProperties("%%(builddir)s/%s/configure" % llvm_srcdir)
    ]
    if llvmgccdir:
        configure_args += ['--with-llvmgccdir=%s' % llvmgccdir]
    else:
        configure_args += ["--without-llvmgcc", "--without-llvmgxx"]
    configure_args += getConfigArgs(config_name)
    if enable_targets is not None:
        configure_args.append('--enable-targets=%s' % enable_targets)
    if triple:
        configure_args += [
            '--build=%s' % triple,
            '--host=%s' % triple,
            '--target=%s' % triple
        ]
    if enable_shared:
        configure_args.append('--enable-shared')
    configure_args.extend(extra_configure_args)
    f.addStep(
        Configure(command=configure_args,
                  description=['configuring', config_name],
                  descriptionDone=['configure', config_name],
                  workdir=llvm_objdir,
                  env=merged_env))
    if clean:
        f.addStep(
            WarningCountingShellCommand(name="clean-llvm",
                                        command=[make, 'clean'],
                                        haltOnFailure=True,
                                        description="cleaning llvm",
                                        descriptionDone="clean llvm",
                                        workdir=llvm_objdir,
                                        env=merged_env))
    f.addStep(
        WarningCountingShellCommand(
            name="compile",
            command=['nice', '-n', '10', make,
                     WithProperties("-j%s" % jobs)],
            haltOnFailure=True,
            description="compiling llvm",
            descriptionDone="compile llvm",
            workdir=llvm_objdir,
            env=merged_env,
            timeout=timeout * 60))
    if examples:
        f.addStep(
            WarningCountingShellCommand(
                name="compile.examples",
                command=[
                    'nice', '-n', '10', make,
                    WithProperties("-j%s" % jobs), 'BUILD_EXAMPLES=1'
                ],
                haltOnFailure=True,
                description=["compiling", "llvm", "examples"],
                descriptionDone=["compile", "llvm", "examples"],
                workdir=llvm_objdir,
                env=merged_env,
                timeout=timeout * 60))
    if test:
        litTestArgs = '-v -j %s' % jobs
        if valgrind:
            litTestArgs += ' --vg '
            if valgrindLeakCheck:
                litTestArgs += ' --vg-leak'
            if valgrindSuppressions is not None:
                litTestArgs += ' --vg-arg --suppressions=%%(builddir)s/llvm/%s' % valgrindSuppressions
        f.addStep(
            LitTestCommand(name='test-llvm',
                           command=[
                               make, "check-lit", "VERBOSE=1",
                               WithProperties("LIT_ARGS=%s" % litTestArgs)
                           ],
                           description=["testing", "llvm"],
                           descriptionDone=["test", "llvm"],
                           workdir=llvm_objdir,
                           env=merged_env))
    return f
Esempio n. 17
0
def getLLVMCMakeBuildFactory(
    clean=True,  # "clean-llvm" step is requested if true.
    test=True,  # "test-llvm" step is requested if true.
    jobs='%(jobs)s',  # Number of concurrent jobs.
    timeout=20,  # Timeout if no activity seen (minutes).
    make='make',  # Make command.
    enable_shared=False,  # Enable shared (-DBUILD_SHARED_LIBS=ON configure parameters added) if true.
    defaultBranch='trunk',  # Branch to build.
    config_name='Debug',  # Configuration name.
    env={},  # Environmental variables for all steps.
    extra_cmake_args=[]):  # Extra args for the cmake step.
    # Prepare environmental variables. Set here all env we want everywhere.
    merged_env = {
        'TERM': 'dumb'  # Make sure Clang doesn't use color escape sequences.
    }
    if env is not None:
        merged_env.update(
            env
        )  # Overwrite pre-set items with the given ones, so user can set anything.

    llvm_srcdir = "llvm.src"
    llvm_objdir = "llvm.obj"

    f = buildbot.process.factory.BuildFactory()

    # Determine the build directory.
    f.addStep(
        buildbot.steps.shell.SetProperty(name="get_builddir",
                                         command=["pwd"],
                                         property="builddir",
                                         description="set build dir",
                                         workdir=".",
                                         env=merged_env))

    # Checkout sources.
    f.addStep(
        SVN(name='svn-llvm',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/llvm/',
            defaultBranch=defaultBranch,
            workdir=llvm_srcdir))

    cmake_args = ['cmake']
    cmake_args += ["-DCMAKE_BUILD_TYPE=" + config_name]
    if enable_shared:
        cmake_args.append('-DBUILD_SHARED_LIBS=ON')
    cmake_args.extend(extra_cmake_args)
    cmake_args += ['../' + llvm_srcdir]
    f.addStep(
        Configure(command=cmake_args,
                  description=['configuring', config_name],
                  descriptionDone=['configure', config_name],
                  workdir=llvm_objdir,
                  env=merged_env))
    if clean:
        f.addStep(
            WarningCountingShellCommand(name="clean-llvm",
                                        command=[make, 'clean'],
                                        haltOnFailure=True,
                                        description="cleaning llvm",
                                        descriptionDone="clean llvm",
                                        workdir=llvm_objdir,
                                        env=merged_env))
    f.addStep(
        WarningCountingShellCommand(
            name="compile",
            command=['nice', '-n', '10', make,
                     WithProperties("-j%s" % jobs)],
            haltOnFailure=True,
            description="compiling llvm",
            descriptionDone="compile llvm",
            workdir=llvm_objdir,
            env=merged_env,
            timeout=timeout * 60))
    if test:
        litTestArgs = '-v -j %s' % jobs
        f.addStep(
            LitTestCommand(name='test-llvm',
                           command=[
                               make, "check-all", "VERBOSE=1",
                               WithProperties("-j%s" % jobs),
                               WithProperties("LIT_ARGS=%s" % litTestArgs)
                           ],
                           description=["testing", "llvm"],
                           descriptionDone=["test", "llvm"],
                           workdir=llvm_objdir,
                           env=merged_env))
    return f
def getDragonEggNightlyTestBuildFactory(gcc='gcc',
                                        gxx='g++',
                                        llvm_configure_args=[],
                                        testsuite_configure_args=[],
                                        xfails=[],
                                        clean=True,
                                        env={},
                                        jobs='%(jobs)s',
                                        timeout=20):
    f = buildbot.process.factory.BuildFactory()

    # Determine the build directory.
    f.addStep(
        buildbot.steps.shell.SetProperty(name='get_builddir',
                                         command=['pwd'],
                                         property='builddir',
                                         description='set build dir',
                                         workdir='.',
                                         env=env))

    # Checkout LLVM sources.
    llvm_src_dir = 'llvm.src'
    f.addStep(
        SVN(name='svn-llvm',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/llvm/',
            defaultBranch='trunk',
            workdir=llvm_src_dir,
            env=env))

    # Checkout DragonEgg sources.
    dragonegg_src_dir = 'dragonegg.src'
    f.addStep(
        SVN(name='svn-dragonegg',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/dragonegg/',
            defaultBranch='trunk',
            workdir=dragonegg_src_dir,
            env=env))

    # Checkout the test-suite sources.
    testsuite_src_dir = 'test-suite.src'
    f.addStep(
        SVN(name='svn-test-suite',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/test-suite/',
            defaultBranch='trunk',
            workdir=testsuite_src_dir,
            env=env))

    # Build and install LLVM.
    llvm_obj_dir = 'llvm.obj'
    llvm_install_dir = 'llvm.install'
    if clean:
        f.addStep(
            ShellCommand(name='rm-%s' % llvm_obj_dir,
                         command=['rm', '-rf', llvm_obj_dir, llvm_install_dir],
                         description='rm build dir llvm',
                         haltOnFailure=True,
                         workdir='.',
                         env=env))
    f.addStep(
        Configure(
            name='configure.llvm',
            command=([
                '../' + llvm_src_dir + '/configure',
                WithProperties('--prefix=%%(builddir)s/%s' % llvm_install_dir)
            ] + llvm_configure_args),
            description='configuring llvm',
            descriptionDone='configure llvm',
            haltOnFailure=True,
            workdir=llvm_obj_dir,
            env=env))
    f.addStep(
        WarningCountingShellCommand(name='compile.llvm',
                                    command=[
                                        'nice', '-n', '10', 'make',
                                        WithProperties('-j%s' % jobs)
                                    ],
                                    haltOnFailure=True,
                                    description='compiling llvm',
                                    descriptionDone='compile llvm',
                                    workdir=llvm_obj_dir,
                                    env=env,
                                    timeout=timeout * 60))
    f.addStep(
        WarningCountingShellCommand(
            name='install.llvm',
            command=['nice', '-n', '10', 'make', 'install'],
            haltOnFailure=True,
            description='installing llvm',
            descriptionDone='install llvm',
            workdir=llvm_obj_dir,
            env=env))

    # Build dragonegg with the just built LLVM.
    dragonegg_obj_dir = 'dragonegg.obj'
    if clean:
        f.addStep(
            ShellCommand(name='rm-%s' % dragonegg_obj_dir,
                         command=['rm', '-rf', dragonegg_obj_dir],
                         description='rm build dir dragonegg',
                         haltOnFailure=True,
                         workdir='.',
                         env=env))
    f.addStep(
        WarningCountingShellCommand(
            name='compile.dragonegg',
            command=[
                'nice', '-n', '10', 'make', '-f',
                '../' + dragonegg_src_dir + '/Makefile',
                WithProperties('-j%s' % jobs),
                WithProperties('GCC=' + gcc),
                WithProperties('LLVM_CONFIG=%(builddir)s/' + llvm_install_dir +
                               '/bin/llvm-config'),
                WithProperties('TOP_DIR=%(builddir)s/' + dragonegg_src_dir)
            ],
            haltOnFailure=True,
            description='compiling dragonegg',
            descriptionDone='compile dragonegg',
            workdir=dragonegg_obj_dir,
            env=env,
            timeout=timeout * 60))

    # Pretend that DragonEgg is llvm-gcc by creating llvm-gcc and llvm-g++
    # scripts that dispatch to gcc with dragonegg and g++ with dragonegg.
    if clean:
        f.addStep(
            ShellCommand(name='rm-bin',
                         command=['rm', '-rf', 'bin'],
                         description='rm bin dir',
                         haltOnFailure=True,
                         workdir='.',
                         env=env))
    f.addStep(
        ShellCommand(
            name='create.llvm-gcc.script',
            command=WithProperties('echo "#!/bin/sh" > llvm-gcc'
                                   '; echo "exec ' + gcc +
                                   ' -fplugin=%(builddir)s/' +
                                   dragonegg_obj_dir +
                                   '/dragonegg.so \\"\$@\\"" >> llvm-gcc'
                                   '; chmod a+x llvm-gcc'),
            description='create llvm-gcc script',
            haltOnFailure=True,
            workdir='bin',
            env=env))
    f.addStep(
        ShellCommand(
            name='create.llvm-g++.script',
            command=WithProperties('echo "#!/bin/sh" > llvm-g++'
                                   '; echo "exec ' + gxx +
                                   ' -fplugin=%(builddir)s/' +
                                   dragonegg_obj_dir +
                                   '/dragonegg.so \\"\$@\\"" >> llvm-g++'
                                   '; chmod a+x llvm-g++'),
            description='create llvm-g++ script',
            haltOnFailure=True,
            workdir='bin',
            env=env))

    # Configure the test-suite.
    testsuite_obj_dir = 'test-suite.obj'
    if clean:
        f.addStep(
            ShellCommand(name='rm-%s' % testsuite_obj_dir,
                         command=['rm', '-rf', testsuite_obj_dir],
                         description='rm test-suite build dir',
                         haltOnFailure=True,
                         workdir='.',
                         env=env))
    f.addStep(
        Configure(
            name='configure.test-suite',
            command=[
                '../' + testsuite_src_dir + '/configure',
                WithProperties('--with-llvmsrc=%(builddir)s/' + llvm_src_dir),
                WithProperties('--with-llvmobj=%(builddir)s/' + llvm_obj_dir),
                WithProperties('--with-llvmgccdir=%(builddir)s/'),
                '--with-llvmcc=llvm-gcc', 'CC=' + gcc, 'CXX=' + gxx
            ] + testsuite_configure_args,
            description='configuring nightly test-suite',
            descriptionDone='configure nightly test-suite',
            haltOnFailure=True,
            workdir=testsuite_obj_dir,
            env=env))

    # Build and test.
    f.addStep(
        ShellCommand(name='rm.test-suite.report',
                     command=[
                         'rm', '-rf', testsuite_obj_dir + '/report',
                         testsuite_obj_dir + '/report.nightly.raw.out',
                         testsuite_obj_dir + '/report.nightly.txt'
                     ],
                     description='rm test-suite report',
                     haltOnFailure=True,
                     workdir='.',
                     env=env))
    f.addStep(
        NightlyTestCommand(name='make.test-suite',
                           command=[
                               'make',
                               WithProperties('-j%s' % jobs),
                               'ENABLE_PARALLEL_REPORT=1', 'DISABLE_CBE=1',
                               'DISABLE_JIT=1',
                               'RUNTIMELIMIT=%s' % (timeout * 60),
                               'TEST=nightly', 'report'
                           ],
                           logfiles={'report': 'report.nightly.txt'},
                           description='running nightly test-suite',
                           descriptionDone='run nightly test-suite',
                           haltOnFailure=True,
                           xfails=xfails,
                           timeout=timeout * 60,
                           workdir=testsuite_obj_dir,
                           env=env))

    return f
Esempio n. 19
0
def getFastNightlyTestBuildFactory(triple,
                                   xfails=[],
                                   clean=True,
                                   test=False,
                                   make='make',
                                   **kwargs):
    # Build compiler to test.
    f = ClangBuilder.getClangBuildFactory(triple,
                                          clean=clean,
                                          test=test,
                                          make=make,
                                          **kwargs)

    # Prepare environmental variables. Set here all env we want everywhere.
    merged_env = {
        'TERM': 'dumb'  # Make sure Clang doesn't use color escape sequences.
    }
    env = kwargs.pop('env', None)
    if env is not None:
        merged_env.update(
            env
        )  # Overwrite pre-set items with the given ones, so user can set anything.

    # Get the test-suite sources.
    f.addStep(
        SVN(name='svn-test-suite',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/test-suite/',
            defaultBranch='trunk',
            workdir='test-suite.src'))

    # Clean up.
    if clean:
        f.addStep(
            ShellCommand(name="rm.test-suite",
                         command=["rm", "-rf", "test-suite.obj"],
                         haltOnFailure=True,
                         description="rm test-suite build dir",
                         workdir=".",
                         env=merged_env))

    # Configure.
    f.addStep(
        Configure(name="configure.test-suite",
                  command=[
                      '../test-suite.src/configure',
                      WithProperties("--with-llvmsrc=%(builddir)s/llvm.src"),
                      WithProperties("--with-llvmobj=%(builddir)s/llvm.obj"),
                      WithProperties("--with-built-clang")
                  ],
                  haltOnFailure=True,
                  description=["configuring", "test-suite"],
                  descriptionDone=["configure", "test-suite"],
                  workdir='test-suite.obj',
                  env=merged_env))

    # Build and test.
    f.addStep(
        ShellCommand(name="rm.test-suite.report",
                     command=[
                         "rm", "-rf", "test-suite.obj/report.nightly.raw.out",
                         "test-suite.obj/report.nightly.txt"
                     ],
                     haltOnFailure=True,
                     description="rm test-suite report",
                     workdir=".",
                     env=merged_env))
    f.addStep(
        NightlyTestCommand(name="make.test-suite",
                           command=[
                               make,
                               WithProperties("-j%(jobs)s"),
                               "ENABLE_PARALLEL_REPORT=1", "DISABLE_CBE=1",
                               "DISABLE_JIT=1", "TEST=nightly", "report"
                           ],
                           haltOnFailure=True,
                           logfiles={'report': 'report.nightly.txt'},
                           xfails=xfails,
                           description=["running", "test-suite"],
                           descriptionDone=["run", "test-suite"],
                           workdir='test-suite.obj',
                           env=merged_env))

    return f
Esempio n. 20
0
def getLLVMGCCBuildFactory(jobs='%(jobs)s', update=True, clean=True,
                           gxxincludedir=None,
                           triple=None, build=None, host=None, target=None,
                           useTwoStage=True, stage1_config='Release+Asserts',
                           stage2_config='Release+Asserts', make='make',
                           extra_configure_args=[], extra_languages=None,
                           verbose=False, env = {}, defaultBranch='trunk',
                           timeout=20, package_dst=None):
  if build or host or target:
    if not build or not host or not target:
      raise ValueError,"Must specify all of 'build', 'host', 'target' if used."
    if triple:
      raise ValueError,"Cannot specify 'triple' and 'build', 'host', 'target' options."
  elif triple:
    build = host = target = triple

    # Prepare environmental variables. Set here all env we want everywhere.
    merged_env = {
                   'TERM' : 'dumb'     # Make sure Clang doesn't use color escape sequences.
                 }
    if env is not None:
        merged_env.update(env)  # Overwrite pre-set items with the given ones, so user can set anything.

  f = buildbot.process.factory.BuildFactory()

  # Determine the build directory.
  f.addStep(buildbot.steps.shell.SetProperty(name="get_builddir",
                                             command=["pwd"],
                                             property    = "builddir",
                                             description = "set build dir",
                                             workdir     = ".",
                                             env         = merged_env))

  # Get the sources.
  if update:
    f.addStep(SVN(name='svn-llvm',
                  mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm/',
                  defaultBranch = defaultBranch,
                  workdir       = "llvm.src"))

    f.addStep(SVN(name='svn-llvm-gcc',
                  mode='update', baseURL='http://llvm.org/svn/llvm-project/llvm-gcc-4.2/',
                  defaultBranch = defaultBranch,
                  workdir       = "llvm-gcc.src"))

  # Clean up llvm (stage 1).
  if clean:
    f.addStep(ShellCommand(name="rm-llvm.obj.stage1",
                           command=["rm", "-rf", "llvm.obj"],
                           haltOnFailure = True,
                           description   = ["rm build dir",
                                            "llvm",
                                            "(stage 1)"],
                           workdir       = ".",
                           env           = merged_env))

  # Configure llvm (stage 1).
  base_llvm_configure_args = [WithProperties("%(builddir)s/llvm.src/configure")]
  if build:
    base_llvm_configure_args.append('--build=' + build)
    base_llvm_configure_args.append('--host=' + host)
    base_llvm_configure_args.append('--target=' + target)
  stage_configure_args = getConfigArgs(stage1_config)
  f.addStep(Configure(name='configure.llvm.stage1',
                      command=base_llvm_configure_args +
                              stage_configure_args +
                              ["--without-llvmgcc",
                               "--without-llvmgxx"],
                      description = [ "configure",
                                      "llvm",
                                      "(stage 1)",
                                      stage1_config ],
                      workdir     = "llvm.obj",
                      env         = merged_env))

  # Build llvm (stage 1).
  base_llvm_make_args = ['nice', '-n', '10',
                         make, WithProperties("-j%s" % jobs)]
  if verbose:
    base_llvm_make_args.append('VERBOSE=1')
  f.addStep(WarningCountingShellCommand(name = "compile.llvm.stage1",
                                        command       = base_llvm_make_args,
                                        haltOnFailure = True,
                                        description   = ["compile",
                                                         "llvm",
                                                         "(stage 1)",
                                                         stage1_config],
                                        workdir       = "llvm.obj",
                                        env           = merged_env,
                                        timeout       = timeout * 60))

  # Run LLVM tests (stage 1).
  f.addStep(LitTestCommand(name = 'test.llvm.stage1',
                             command = [make, "check-lit", "VERBOSE=1"],
                             description     = ["testing", "llvm"],
                             descriptionDone = ["test",    "llvm"],
                             workdir         = 'llvm.obj',
                             env             = merged_env))

  # Clean up llvm-gcc.
  if clean:
    f.addStep(ShellCommand(name="rm-llvm-gcc.obj.stage1",
                           command=["rm", "-rf", "llvm-gcc.obj"],
                           haltOnFailure = True,
                           description   = ["rm build dir",
                                            "llvm-gcc"],
                           workdir       = ".",
                           env           = merged_env))

  # Configure llvm-gcc.
  base_llvmgcc_configure_args = ["../llvm-gcc.src/configure"]
  llvmgcc_languages = "--enable-languages=c,c++"
  if extra_languages:
    llvmgcc_languages = llvmgcc_languages + "," + extra_languages
  base_llvmgcc_configure_args.append(llvmgcc_languages)
  if gxxincludedir:
    base_llvmgcc_configure_args.append('--with-gxx-include-dir=' + gxxincludedir)
  base_llvmgcc_configure_args.extend(extra_configure_args)
  if build:
    base_llvmgcc_configure_args.append('--build=' + build)
    base_llvmgcc_configure_args.append('--host=' + host)
    base_llvmgcc_configure_args.append('--target=' + target)
  f.addStep(Configure(name='configure.llvm-gcc.stage1',
                      command=(base_llvmgcc_configure_args +
                               ["--program-prefix=llvm-",
                                WithProperties("--prefix=%(builddir)s/llvm-gcc.install"),                      
                                WithProperties("--enable-llvm=%(builddir)s/llvm.obj")]),
                      haltOnFailure = True,
                      description   = ["configure",
                                       "llvm-gcc",
                                       "(stage 1)"],
                      workdir       = "llvm-gcc.obj",
                      env           = merged_env))

  # Build llvm-gcc.
  f.addStep(WarningCountingShellCommand(name="compile.llvm-gcc.stage1",
                                        command=['nice', '-n', '10',
                                                 make, WithProperties("-j%s" % jobs)],
                                        haltOnFailure = True,
                                        description   = ["compile",
                                                         "llvm-gcc"],
                                        workdir       = "llvm-gcc.obj",
                                        env           = merged_env,
                                        timeout       = timeout * 60))

  # Clean up llvm-gcc install.
  if clean:
    f.addStep(ShellCommand(name="rm-llvm-gcc.install.stage1",
                           command=["rm", "-rf", "llvm-gcc.install"],
                           haltOnFailure = True,
                           description   = ["rm install dir",
                                            "llvm-gcc"],
                           workdir       = ".",
                           env           = merged_env))

  # Install llvm-gcc.
  f.addStep(WarningCountingShellCommand(name="install.llvm-gcc.stage1",
                                        command=['nice', '-n', '10',
                                                 make, 'install'],
                                        haltOnFailure = True,
                                        description   = ["install",
                                                         "llvm-gcc"],
                                        workdir       = "llvm-gcc.obj",
                                        env           = merged_env))

  # We are done if not doing a two-stage build.
  if not useTwoStage:
    return f

  # Clean up llvm (stage 2).
  if clean:
    f.addStep(ShellCommand(name="rm-llvm.obj.stage2",
                           command=["rm", "-rf", "llvm.obj.2"],
                           haltOnFailure = True,
                           description   = ["rm build dir",
                                            "llvm",
                                            "(stage 2)"],
                           workdir       = ".",
                           env           = merged_env))

  # Configure llvm (stage 2).
  stage_configure_args = getConfigArgs(stage2_config)
  local_env = dict(merged_env)
  local_env['CC'] = WithProperties("%(builddir)s/llvm-gcc.install/bin/llvm-gcc")
  local_env['CXX'] = WithProperties("%(builddir)s/llvm-gcc.install/bin/llvm-g++")
  f.addStep(Configure(name="configure.llvm.stage2",
                      command=base_llvm_configure_args + 
                              stage_configure_args +
                              [WithProperties("--with-llvmgcc=%(builddir)s/llvm-gcc.install/bin/llvm-gcc"),
                               WithProperties("--with-llvmgxx=%(builddir)s/llvm-gcc.install/bin/llvm-g++")],
                      haltOnFailure = True,
                      description   = ["configure",
                                       "llvm",
                                       "(stage 2)",
                                       stage2_config],
                      workdir      = "llvm.obj.2",
                      env          = local_env))

  # Build LLVM (stage 2).
  f.addStep(WarningCountingShellCommand(name = "compile.llvm.stage2",
                                        command = base_llvm_make_args,
                                        haltOnFailure = True,
                                        description   = ["compile",
                                                         "llvm",
                                                         "(stage 2)",
                                                         stage2_config],
                                        workdir       = "llvm.obj.2",
                                        env           = merged_env,
                                        timeout       = timeout * 60))

  # Run LLVM tests (stage 2).
  f.addStep(LitTestCommand(name = 'test.llvm.stage2',
                             command = [make, "check-lit", "VERBOSE=1"],
                             description     = ["testing", "llvm", "(stage 2)"],
                             descriptionDone = ["test",    "llvm", "(stage 2)"],
                             workdir         = 'llvm.obj.2',
                             env             = merged_env))

  # Clean up llvm-gcc (stage 2).
  if clean:
    f.addStep(ShellCommand(name="rm-llvm-gcc.obj.stage2",
                           command=["rm", "-rf", "llvm-gcc.obj.2"],
                           haltOnFailure = True,
                           description   = ["rm build dir",
                                            "llvm-gcc",
                                            "(stage 2)"],
                           workdir       = ".",
                           env           = merged_env))

  # Configure llvm-gcc (stage 2).
  local_env = dict(merged_env)
  local_env['CC'] = WithProperties("%(builddir)s/llvm-gcc.install/bin/llvm-gcc")
  local_env['CXX'] = WithProperties("%(builddir)s/llvm-gcc.install/bin/llvm-g++")
  f.addStep(Configure(name = 'configure.llvm-gcc.stage2',
                      command=base_llvmgcc_configure_args + [
                               "--program-prefix=llvm.2-",
                               WithProperties("--prefix=%(builddir)s/llvm-gcc.install.2"),
                               WithProperties("--enable-llvm=%(builddir)s/llvm.obj.2")],
                      haltOnFailure = True,
                      description   = ["configure",
                                       "llvm-gcc",
                                       "(stage 2)"],
                      workdir       = "llvm-gcc.obj.2",
                      env           = local_env))

  # Build llvm-gcc (stage 2).
  f.addStep(WarningCountingShellCommand(name="compile.llvm-gcc.stage2",
                                        command=['nice', '-n', '10',
                                                 make, WithProperties("-j%s" % jobs)],
                                        haltOnFailure = True,
                                        description   = ["compile",
                                                         "llvm-gcc",
                                                         "(stage 2)"],
                                        workdir       = "llvm-gcc.obj.2",
                                        env           = merged_env,
                                        timeout       = timeout * 60))

  # Clean up llvm-gcc install (stage 2).
  if clean:
    f.addStep(ShellCommand(name="rm-llvm-gcc.install.stage2",
                           command=["rm", "-rf", "llvm-gcc.install.2"],
                           haltOnFailure = True,
                           description   = ["rm install dir",
                                            "llvm-gcc",
                                            "(stage 2)"],
                           workdir       = ".",
                           env           = merged_env))

  # Install llvm-gcc.
  f.addStep(WarningCountingShellCommand(name="install.llvm-gcc.stage2",
                                        command = ['nice', '-n', '10',
                                                   make, 'install'],
                                        haltOnFailure = True,
                                        description   = ["install",
                                                         "llvm-gcc",
                                                         "(stage 2)"],
                                        workdir       = "llvm-gcc.obj.2",
                                        env           = merged_env))
  if package_dst:
    addPackageStep(f, package_dst, obj_path = 'llvm-gcc.install.2', env = merged_env)

  return f
Esempio n. 21
0
def getKLEEBuildFactory(triple, jobs='%(jobs)d', llvm_branch='trunk',
                        config_name='Release+Asserts', clean=True, llvmgccdir=None,
                        *args, **kwargs):
    if False:
        f = buildbot.process.factory.BuildFactory()

        # Determine the build directory.
        f.addStep(buildbot.steps.shell.SetProperty(name="get_builddir",
                                                   command=["pwd"],
                                                   property="builddir",
                                                   description="set build dir",
                                                   workdir="."))
    else:
        # If we are building from trunk, we need to build Clang as
        # well so we have access to an LLVM capable compiler.
        if llvm_branch == 'trunk':
            f = ClangBuilder.getClangBuildFactory(triple, jobs=jobs,
                                                  stage1_config=config_name, extra_configure_args=['--with-built-clang',
                                                                                                   '--enable-targets=host',
                                                                                                   '--with-llvmcc=clang'],
                                                  clean=clean, test=False, *args, **kwargs)
        else:
            f = LLVMBuilder.getLLVMBuildFactory(triple, jobs=jobs, defaultBranch=llvm_branch,
                                                config_name=config_name, llvmgccdir=llvmgccdir,
                                                enable_targets='x86', clean=clean, test=False,
                                                *args, **kwargs)

    # Checkout sources.
    f.addStep(SVN(name='svn-klee',
                  mode='update', baseURL='http://llvm.org/svn/llvm-project/klee/',
                  defaultBranch='trunk', workdir='klee'))

    # Configure.
    configure_args = ["./configure", WithProperties("--with-llvm=%(builddir)s/llvm")]
    configure_args += getConfigArgs(config_name)
    if triple:
        configure_args += ['--build=%s' % triple,
                           '--host=%s' % triple,
                           '--target=%s' % triple]
    f.addStep(Configure(command=configure_args, workdir='klee',
                        description=['configure','klee',config_name]))

    # Clean, if requested.
    if clean:
        f.addStep(WarningCountingShellCommand(name="clean-klee",
                                              command=['make', 'clean'],
                                              haltOnFailure=True,
                                              description="clean klee",
                                              workdir='klee'))

    # Compile.
    f.addStep(WarningCountingShellCommand(name="compile",
                                          command=['nice', '-n', '10',
                                                   'make', WithProperties("-j%s" % jobs)],
                                          haltOnFailure=True, description="compile klee",
                                          workdir='klee'))

    # Test.
    f.addStep(DejaGNUCommand(name="test",
                             command=['nice', '-n', '10',
                                      'make', 'check'],
                             haltOnFailure=True, description="test klee",
                             workdir='klee',
                             logfiles={ 'dg.sum' : 'test/testrun.sum' }))

    return f
Esempio n. 22
0
    def getPerPlatformBuilders(self, platform):
        if not platform.canBuild(self):
            return []

        src_path = "{0}/src/{1}".format(platform.workerdatapath, self.name)
        configure_path = src_path + "/configure"
        build_path = "{0}/builds/{1}/{2}".format(platform.workerdatapath,
                                                 platform.name, self.name)
        packages_path = "{0}/packages/snapshots/{1}".format(
            platform.workerdatapath, self.name)

        env = platform.getEnv(self)

        f = factory.BuildFactory()
        f.useProgress = False

        f.addStep(steps.Clean(dir="", doStepIf=Property("clean", False)))

        f.addStep(
            steps.SetPropertyIfOlder(name="check config.mk freshness",
                                     src=configure_path,
                                     generated="config.mk",
                                     property="do_configure"))

        if self.verbose_build:
            platform_build_verbosity = "--enable-verbose-build"
        else:
            platform_build_verbosity = ""

        f.addStep(
            Configure(command=[configure_path, platform_build_verbosity] +
                      platform.getConfigureArgs(self),
                      doStepIf=Property("do_configure",
                                        default=True,
                                        defaultWhenFalse=False),
                      env=env))

        f.addStep(Compile(command=["make", "-j5"], env=env))

        # No tests

        packaging_cmd = None
        if platform.getPackagingCmd(self) is not None:
            packaging_cmd = platform.getPackagingCmd(self)
        else:
            if platform.getStripCmd(self) is not None:
                f.addStep(steps.Strip(command=platform.getStripCmd()))

        if platform.canPackage(self):
            f.addStep(
                steps.Package(
                    disttarget=packaging_cmd,
                    srcpath=src_path,
                    dstpath=packages_path,
                    data_files=self.data_files,
                    buildname="{0}-{1}".format(platform.name, self.name),
                    platform_built_files=platform.getBuiltFiles(self),
                    platform_data_files=platform.getDataFiles(self),
                    archive_format=platform.archiveext,
                    env=env))

        return [
            BuilderConfig(
                name="{0}-{1}".format(self.name, platform.name),
                workername=platform.workername,
                workerbuilddir=build_path,
                factory=f,
                locks=[
                    lock_build.access('counting'),
                    self.lock_src.access("counting")
                ],
                tags=[self.name],
                properties={
                    "platformname": platform.name,
                    "workerimage": platform.getWorkerImage(self),
                },
            )
        ]
def getDragonEggTestBuildFactory(gcc='gcc',
                                 svn_testsuites=[],
                                 llvm_configure_args=[],
                                 xfails=[],
                                 clean=True,
                                 env={},
                                 jobs='%(jobs)s',
                                 timeout=20):
    f = buildbot.process.factory.BuildFactory()

    # Determine the build directory.
    f.addStep(
        buildbot.steps.shell.SetProperty(name='get_builddir',
                                         command=['pwd'],
                                         property='builddir',
                                         description='set build dir',
                                         workdir='.',
                                         env=env))

    # Checkout LLVM sources.
    llvm_src_dir = 'llvm.src'
    f.addStep(
        SVN(name='svn-llvm',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/llvm/',
            defaultBranch='trunk',
            workdir=llvm_src_dir,
            env=env))

    # Checkout DragonEgg sources.
    dragonegg_src_dir = 'dragonegg.src'
    f.addStep(
        SVN(name='svn-dragonegg',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/dragonegg/',
            defaultBranch='trunk',
            workdir=dragonegg_src_dir,
            env=env))

    # Checkout victims for the compilator.
    compilator_dir = dragonegg_src_dir + '/test/compilator'

    # Checkout testsuites held in subversion repositories.  These are usually
    # specified using a known good revision (supplied by appending @revision to
    # the URL).  The SVN step can't handle that.  As it provides no mechanism at
    # all for checking out a specific revision, run the command directly here.
    for svn_testsuite in svn_testsuites:
        url = svn_testsuite[0]
        name = svn_testsuite[1]
        if url is None:
            f.addStep(
                ShellCommand(name='rm-%s' % name,
                             command=['rm', '-rf', name],
                             description=['rm', name],
                             haltOnFailure=True,
                             workdir=compilator_dir,
                             env=env))
        else:
            svn_co = ['svn', 'checkout', url, name]
            f.addStep(
                ShellCommand(name=name,
                             command=svn_co,
                             haltOnFailure=True,
                             workdir=compilator_dir,
                             env=env))

    # Checkout miscellaneous testsuites.

    # LAPACK.
    f.addStep(
        ShellCommand(
            name='wget.lapack',
            command='wget -N http://www.netlib.org/lapack/lapack-3.4.0.tgz',
            haltOnFailure=False,
            workdir=compilator_dir,
            env=env))
    f.addStep(
        ShellCommand(name='unpack.lapack',
                     command='tar xzf lapack-3.4.0.tgz',
                     haltOnFailure=True,
                     workdir=compilator_dir,
                     env=env))

    # Nist Fortran 77 test suite.
    f.addStep(
        ShellCommand(
            name='wget.nist',
            command=
            'wget -N http://www.itl.nist.gov/div897/ctg/suites/fcvs21.tar.Z',
            haltOnFailure=False,
            workdir=compilator_dir,
            env=env))
    f.addStep(
        ShellCommand(name='unpack.nist',
                     command='tar xzf ../fcvs21.tar.Z',
                     haltOnFailure=True,
                     workdir=compilator_dir + '/fcvs21/',
                     env=env))

    # Polyhedron.
    f.addStep(
        ShellCommand(
            name='wget.polyhedron',
            command=
            'wget -N http://www.polyhedron.com/web_images/documents/pb11.zip',
            haltOnFailure=False,
            workdir=compilator_dir,
            env=env))
    f.addStep(
        ShellCommand(name='unpack.polyhedron',
                     command='unzip -o pb11.zip',
                     haltOnFailure=True,
                     workdir=compilator_dir,
                     env=env))

    # Large single compilation-unit C programs.
    f.addStep(
        ShellCommand(
            name='wget.bzip2',
            command=
            'wget -N http://people.csail.mit.edu/smcc/projects/single-file-programs/bzip2.c',
            haltOnFailure=False,
            workdir=compilator_dir,
            env=env))
    f.addStep(
        ShellCommand(
            name='wget.gzip',
            command=
            'wget -N http://people.csail.mit.edu/smcc/projects/single-file-programs/gzip.c',
            haltOnFailure=False,
            workdir=compilator_dir,
            env=env))
    f.addStep(
        ShellCommand(name='fix.gzip',
                     command='sed -i "s/^static char \*$/char */" gzip.c',
                     haltOnFailure=True,
                     workdir=compilator_dir,
                     env=env))
    f.addStep(
        ShellCommand(
            name='wget.oggenc',
            command=
            'wget -N http://people.csail.mit.edu/smcc/projects/single-file-programs/oggenc.c',
            haltOnFailure=False,
            workdir=compilator_dir,
            env=env))
    f.addStep(
        ShellCommand(
            name='wget.gcc',
            command=
            'wget -N http://people.csail.mit.edu/smcc/projects/single-file-programs/gcc.c.bz2',
            haltOnFailure=False,
            workdir=compilator_dir,
            env=env))
    f.addStep(
        ShellCommand(name='unpack.gcc',
                     command='bunzip2 -f -k gcc.c.bz2',
                     haltOnFailure=True,
                     workdir=compilator_dir,
                     env=env))

    # Build and install LLVM.
    llvm_obj_dir = 'llvm.obj'
    llvm_install_dir = 'llvm.install'
    if clean:
        f.addStep(
            ShellCommand(name='rm-%s' % llvm_obj_dir,
                         command=['rm', '-rf', llvm_obj_dir, llvm_install_dir],
                         description='rm build dir llvm',
                         haltOnFailure=True,
                         workdir='.',
                         env=env))
    f.addStep(
        Configure(
            name='configure.llvm',
            command=([
                '../' + llvm_src_dir + '/configure',
                WithProperties('--prefix=%%(builddir)s/%s' % llvm_install_dir)
            ] + llvm_configure_args),
            description='configuring llvm',
            descriptionDone='configure llvm',
            haltOnFailure=True,
            workdir=llvm_obj_dir,
            env=env))
    f.addStep(
        WarningCountingShellCommand(name='compile.llvm',
                                    command=[
                                        'nice', '-n', '10', 'make',
                                        WithProperties('-j%s' % jobs)
                                    ],
                                    haltOnFailure=True,
                                    description='compiling llvm',
                                    descriptionDone='compile llvm',
                                    workdir=llvm_obj_dir,
                                    env=env,
                                    timeout=timeout * 60))
    f.addStep(
        WarningCountingShellCommand(
            name='install.llvm',
            command=['nice', '-n', '10', 'make', 'install'],
            haltOnFailure=True,
            description='installing llvm',
            descriptionDone='install llvm',
            workdir=llvm_obj_dir,
            env=env))

    # Build dragonegg with the just built LLVM.
    dragonegg_obj_dir = 'dragonegg.obj'
    if clean:
        f.addStep(
            ShellCommand(name='rm-%s' % dragonegg_obj_dir,
                         command=['rm', '-rf', dragonegg_obj_dir],
                         description='rm build dir dragonegg',
                         haltOnFailure=True,
                         workdir='.',
                         env=env))
    f.addStep(
        WarningCountingShellCommand(
            name='compile.dragonegg',
            command=[
                'nice', '-n', '10', 'make', '-f',
                '../' + dragonegg_src_dir + '/Makefile',
                WithProperties('-j%s' % jobs),
                WithProperties('GCC=' + gcc),
                WithProperties('LLVM_CONFIG=%(builddir)s/' + llvm_install_dir +
                               '/bin/llvm-config'),
                WithProperties('TOP_DIR=%(builddir)s/' + dragonegg_src_dir)
            ],
            haltOnFailure=True,
            description='compiling dragonegg',
            descriptionDone='compile dragonegg',
            workdir=dragonegg_obj_dir,
            env=env,
            timeout=timeout * 60))

    # Run the dragonegg testsuite.
    testsuite_output_dir = dragonegg_obj_dir + '/test/Output'
    if clean:
        f.addStep(
            ShellCommand(name='rm-%s' % testsuite_output_dir,
                         command=['rm', '-rf', testsuite_output_dir],
                         description='rm test-suite output directory',
                         haltOnFailure=True,
                         workdir='.',
                         env=env))

    f.addStep(
        LitTestCommand(
            name='make.check',
            command=[
                'nice', '-n', '10', 'make', '-f',
                '../' + dragonegg_src_dir + '/Makefile',
                WithProperties('GCC=' + gcc),
                WithProperties('LLVM_CONFIG=%(builddir)s/' + llvm_install_dir +
                               '/bin/llvm-config'),
                WithProperties('TOP_DIR=%(builddir)s/' + dragonegg_src_dir),
                WithProperties('LIT_ARGS=-v -j%s' % jobs), 'check'
            ],
            description='running test-suite',
            descriptionDone='run test-suite',
            haltOnFailure=True,
            workdir=dragonegg_obj_dir,
            env=env,
            timeout=timeout * 60))

    return f
Esempio n. 24
0
    def setup(self, parallel, branch, test_with_PTY=False, **kwargs):
        out_of_tree_dir = "build_oot"

        if self.build_out_of_tree:
            self.addStep(
                ShellCommand(
                    name="mkdir out-of-tree directory",
                    description="Create out-of-tree directory",
                    command=["mkdir", "-p", out_of_tree_dir],
                    warnOnFailure=True,
                )
            )

        if self.build_out_of_tree:
            configure_cmd = "../configure"
            oot_kwargs = {'workdir': os.path.join("build", out_of_tree_dir)}
        else:
            configure_cmd = "./configure"
            oot_kwargs = {}
        configure_cmd = [configure_cmd, "--prefix", "$(PWD)/target"]
        configure_cmd += self.configureFlags
        self.addStep(
            Configure(command=configure_cmd, **oot_kwargs)
        )
        compile = ["make", self.makeTarget]
        testopts = self.testFlags
        if "-R" not in self.testFlags:
            testopts += " --junit-xml test-results.xml"
        # Timeout for the buildworker process
        self.test_timeout = self.test_timeout or TEST_TIMEOUT
        # Timeout for faulthandler
        faulthandler_timeout = self.test_timeout - 5 * 60
        if parallel:
            compile = ["make", parallel, self.makeTarget]
            testopts = testopts + " " + parallel
        if "-j" not in testopts:
            testopts = "-j2 " + testopts
        test = [
            "make",
            "buildbottest",
            "TESTOPTS=" + testopts + " ${BUILDBOT_TESTOPTS}",
            "TESTPYTHONOPTS=" + self.interpreterFlags,
            "TESTTIMEOUT=" + str(faulthandler_timeout),
        ]

        self.addStep(Compile(command=compile,
                             env=self.compile_environ,
                             **oot_kwargs))
        self.addStep(
            ShellCommand(
                name="pythoninfo",
                description="pythoninfo",
                command=["make", "pythoninfo"],
                warnOnFailure=True,
                env=self.test_environ,
                **oot_kwargs
            )
        )
        self.addStep(
            Test(
                command=test,
                timeout=self.test_timeout,
                usePTY=test_with_PTY,
                env=self.test_environ,
                **oot_kwargs
            )
        )
        if branch not in ("3",) and "-R" not in self.testFlags:
            filename = "test-results.xml"
            if self.build_out_of_tree:
                filename = os.path.join(out_of_tree_dir, filename)
            self.addStep(UploadTestResults(branch, filename=filename))
        self.addStep(Clean(**oot_kwargs))
Esempio n. 25
0
def getOpenMPCMakeBuildFactory(
        c_compiler='gcc',  # The C compiler to use.
        cxx_compiler='g++',  # The C++ compiler to use.
        jobs='%(jobs)s',  # Number of concurrent jobs.
        clean=True,  # "clean" step is requested if true
        env=None,  # Environmental variables for all steps.
        ompt=False,  # Whether to enable the OpenMP Tools Interface.
        test=True,  # Test the built libraries.
):

    # Prepare environmental variables. Set here all env we want everywhere.
    merged_env = {
        'TERM': 'dumb'  # Make sure Clang doesn't use color escape sequences.
    }
    # Overwrite pre-set items with the given ones, so user can set anything.
    if env is not None:
        merged_env.update(env)

    openmp_srcdir = 'openmp.src'
    openmp_builddir = 'openmp.build'
    llvm_srcdir = 'llvm.src'
    llvm_builddir = 'llvm.build'
    build_clang = c_compiler == 'clang'

    f = buildbot.process.factory.BuildFactory()

    # Checkout sources.
    f.addStep(
        SVN(name='svn-openmp',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/openmp/',
            defaultBranch='trunk',
            workdir=openmp_srcdir))

    # LLVM sources are needed to build utilities for testing.
    f.addStep(
        SVN(name='svn-llvm',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/llvm/',
            defaultBranch='trunk',
            workdir=llvm_srcdir))

    # Get Clang sources, if requested.
    if build_clang:
        f.addStep(
            SVN(name='svn-clang',
                mode='update',
                baseURL='http://llvm.org/svn/llvm-project/cfe/',
                defaultBranch='trunk',
                workdir='%s/tools/clang' % llvm_srcdir))

    cleanBuildRequested = lambda step: clean or step.build.getProperty("clean")
    f.addStep(
        ShellCommand(name='clean',
                     command=['rm', '-rf', openmp_builddir, llvm_builddir],
                     warnOnFailure=True,
                     description=['clean'],
                     doStepIf=cleanBuildRequested,
                     workdir='.',
                     env=merged_env))

    # Configure LLVM (and Clang, if requested).
    cmake_args = ['cmake', '-G', 'Ninja', '../%s' % llvm_srcdir]
    cmake_args += ['-DCMAKE_BUILD_TYPE=Release', '-DLLVM_ENABLE_ASSERTIONS=ON']
    cmake_args += ['-DCMAKE_C_COMPILER=%s' % c_compiler]
    cmake_args += ['-DCMAKE_CXX_COMPILER=%s' % cxx_compiler]
    f.addStep(
        Configure(name='configure-llvm',
                  command=cmake_args,
                  description='configure llvm',
                  workdir=llvm_builddir,
                  env=merged_env))

    # Build LLVM utils.
    f.addStep(
        NinjaCommand(name='compile-llvm-utils',
                     targets=['FileCheck'],
                     description='compile llvm utils',
                     workdir=llvm_builddir,
                     env=merged_env))

    # Build Clang if requested.
    if build_clang:
        f.addStep(
            NinjaCommand(name='compile-clang',
                         description='compile clang',
                         workdir=llvm_builddir,
                         env=merged_env))

    # Add llvm-lit and clang (if built) to PATH
    merged_env.update({
        'PATH':
        WithProperties('%(workdir)s/' + llvm_builddir + '/bin:${PATH}')
    })

    # Configure OpenMP runtime libraries.
    cmake_args = ['cmake', '-G', 'Ninja', '../%s' % openmp_srcdir]
    cmake_args += ['-DCMAKE_C_COMPILER=%s' % c_compiler]
    cmake_args += ['-DCMAKE_CXX_COMPILER=%s' % cxx_compiler]
    if ompt:
        cmake_args += ['-DLIBOMP_OMPT_SUPPORT=ON']

    if test:
        lit_args = '-v --show-unsupported --show-xfail -j %s' % jobs
        cmake_args += [WithProperties('-DOPENMP_LIT_ARGS=%s' % lit_args)]

    f.addStep(
        Configure(name='configure-openmp',
                  command=cmake_args,
                  description='configure openmp',
                  workdir=openmp_builddir,
                  env=merged_env))

    # Build OpenMP runtime libraries.
    f.addStep(
        NinjaCommand(name='compile-openmp',
                     description='compile openmp',
                     workdir=openmp_builddir,
                     env=merged_env))

    # Test OpenMP runtime libraries, if requested.
    if test:
        ninja_test_args = ['ninja', WithProperties('-j %s' % jobs)]
        f.addStep(
            LitTestCommand(name='test-openmp',
                           command=ninja_test_args + ['check-openmp'],
                           description='test openmp',
                           workdir=openmp_builddir,
                           env=merged_env))

    return f
Esempio n. 26
0
def getLLDBBuildFactory(triple,
                        useTwoStage=False,
                        make='make',
                        jobs='%(jobs)s',
                        extra_configure_args=[],
                        env={},
                        *args,
                        **kwargs):

    llvm_srcdir = "llvm.src"
    llvm_objdir = "llvm.obj"

    f = buildbot.process.factory.BuildFactory()

    # Determine the build directory.
    f.addStep(
        SetProperty(name="get_builddir",
                    command=["pwd"],
                    property="builddir",
                    description="set build dir",
                    workdir="."))

    # Find out what version of llvm and clang are needed to build this version
    # of lldb. Right now we will assume they use the same version.
    # XXX - could this be done directly on the master instead of the slave?
    f.addStep(
        SetProperty(
            command=
            'svn cat http://llvm.org/svn/llvm-project/lldb/trunk/scripts/build-llvm.pl | grep ^our.*llvm_revision | cut -d \\" -f 2',
            property='llvmrev'))

    # The SVN build step provides no mechanism to check out a specific revision
    # based on a property, so just run the commands directly here.

    svn_co = ['svn', 'checkout', '--force']
    svn_co += ['--revision', WithProperties('%(llvmrev)s')]

    # build llvm svn checkout command
    svn_co_llvm = svn_co + \
     [WithProperties('http://llvm.org/svn/llvm-project/llvm/trunk@%(llvmrev)s'),
                     llvm_srcdir]
    # build clang svn checkout command
    svn_co_clang = svn_co + \
     [WithProperties('http://llvm.org/svn/llvm-project/cfe/trunk@%(llvmrev)s'),
                     '%s/tools/clang' % llvm_srcdir]

    f.addStep(
        ShellCommand(name='svn-llvm',
                     command=svn_co_llvm,
                     haltOnFailure=True,
                     workdir='.'))
    f.addStep(
        ShellCommand(name='svn-clang',
                     command=svn_co_clang,
                     haltOnFailure=True,
                     workdir='.'))

    f.addStep(
        SVN(name='svn-lldb',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/lldb/',
            defaultBranch='trunk',
            always_purge=True,
            workdir='%s/tools/lldb' % llvm_srcdir))

    # Run configure
    config_args = [
        WithProperties("%%(builddir)s/%s/configure" % llvm_srcdir),
        "--disable-bindings",
        "--without-llvmgcc",
        "--without-llvmgxx",
    ]
    if triple:
        config_args += ['--build=%s' % triple]
    config_args += extra_configure_args

    f.addStep(
        Configure(name='configure',
                  command=config_args,
                  env=env,
                  workdir=llvm_objdir))

    f.addStep(
        WarningCountingShellCommand(
            name="compile",
            command=['nice', '-n', '10', make,
                     WithProperties("-j%s" % jobs)],
            env=env,
            haltOnFailure=True,
            workdir=llvm_objdir))

    # Test.
    f.addStep(
        LitTestCommand(name="test lldb",
                       command=['nice', '-n', '10', make],
                       description="test lldb",
                       env=env,
                       workdir='%s/tools/lldb/test' % llvm_objdir))

    return f
Esempio n. 27
0
from buildbot.steps.source import SVN
from buildbot.steps.vstudio import VC10
from buildbot.steps.trigger import Trigger
from buildbot.process.factory import BuildFactory
from cmake import CMakeFactory

step_svn_copy = SVN(mode='copy',
                    baseURL=(ea_svnurl + '%%BRANCH%%'),
                    defaultBranch='trunk',
                    retry=(30, 2),
                    logEnviron=True)
step_autoconf = Compile(command=["autoconf"],
                        description=["running autoconf"],
                        descriptionDone=["autoconf"],
                        logEnviron=False)
step_configure = Configure(command=["./configure"], logEnviron=False)
step_configure_64 = Configure(command=["./configure", "--enable-64bit"],
                              logEnviron=False)
step_compile_all = Compile(command=["make", "clean", "all"], logEnviron=False)
step_compile_txt = Compile(command=["make", "clean", "txt"],
                           description="compiling txt",
                           descriptionDone="compile txt",
                           logEnviron=False)
step_compile_sql = Compile(command=["make", "clean", "sql"],
                           description="compiling sql",
                           descriptionDone="compile sql",
                           logEnviron=False)
step_compile_VS10 = Compile(
    command=["devenv.com", "eAthena-10.sln", "/REBUILD"], logEnviron=False)
step_trigger_tests = Trigger(
    waitForFinish=True, schedulerNames=["test-Ubuntu-12.04-x64-scheduler"])
def getDragonEggBootstrapFactory(gcc_repository,
                                 extra_languages=[],
                                 extra_gcc_configure_args=[],
                                 extra_llvm_configure_args=[],
                                 check_llvm=True,
                                 check_dragonegg=True,
                                 clean=True,
                                 env={},
                                 jobs='%(jobs)s',
                                 timeout=20):
    # Add gcc configure arguments required by the plugin.
    gcc_configure_args = extra_gcc_configure_args + [
        '--enable-plugin', '--enable-lto',
        ','.join(['--enable-languages=c,c++'] + extra_languages)
    ]

    llvm_configure_args = extra_llvm_configure_args

    f = buildbot.process.factory.BuildFactory()

    # Determine the build directory.
    f.addStep(
        buildbot.steps.shell.SetProperty(name='get_builddir',
                                         command=['pwd'],
                                         property='builddir',
                                         description='set build dir',
                                         workdir='.',
                                         env=env))

    # Checkout LLVM sources.
    llvm_src_dir = 'llvm.src'
    f.addStep(
        SVN(name='svn-llvm',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/llvm/',
            defaultBranch='trunk',
            workdir=llvm_src_dir,
            env=env))

    # Checkout DragonEgg sources.
    dragonegg_src_dir = 'dragonegg.src'
    f.addStep(
        SVN(name='svn-dragonegg',
            mode='update',
            baseURL='http://llvm.org/svn/llvm-project/dragonegg/',
            defaultBranch='trunk',
            workdir=dragonegg_src_dir,
            env=env))

    # Checkout GCC.  This is usually a specific known good revision (supplied by
    # appending @revision to the URL).  The SVN step can't handle that.  As it
    # provides no mechanism at all for checking out a specific revision, just
    # run the command directly here.
    gcc_src_dir = 'gcc.src'
    svn_co = ['svn', 'checkout', gcc_repository, gcc_src_dir]
    f.addStep(
        ShellCommand(name='svn-gcc',
                     command=svn_co,
                     haltOnFailure=True,
                     workdir='.',
                     env=env))

    gcc_install_dir = 'gcc.install'  # Names are embedded in object files, so
    llvm_install_dir = 'llvm.install'  # would cause bootstrap comparison fails
    # if they were different for each stage.

    # Remove any install directories hanging over from a previous run.
    if clean:
        f.addStep(
            ShellCommand(name='rm-%s' % gcc_install_dir,
                         command=['rm', '-rf', gcc_install_dir],
                         haltOnFailure=True,
                         description=['rm install dir', 'gcc'],
                         workdir='.',
                         env=env))
        f.addStep(
            ShellCommand(name='rm-%s' % llvm_install_dir,
                         command=['rm', '-rf', llvm_install_dir],
                         haltOnFailure=True,
                         description=['rm install dir', 'llvm'],
                         workdir='.',
                         env=env))

    # Do the boostrap.
    cur_env = env
    prev_gcc = None  # C compiler built during the previous stage.
    prev_gxx = None  # C++ compiler built during the previous stage.
    prev_plugin = None  # Plugin built during the previous stage.
    for stage in 'stage1', 'stage2', 'stage3':

        # Build and install GCC.
        gcc_obj_dir = 'gcc.obj.%s' % stage
        if clean:
            f.addStep(
                ShellCommand(name='rm-%s' % gcc_obj_dir,
                             command=['rm', '-rf', gcc_obj_dir],
                             haltOnFailure=True,
                             description=['rm build dir', 'gcc', stage],
                             workdir='.',
                             env=cur_env))
        f.addStep(
            Configure(name='configure.gcc.%s' % stage,
                      command=([
                          '../' + gcc_src_dir + '/configure',
                          WithProperties(
                              '--prefix=%%(builddir)s/%s' % gcc_install_dir)
                      ] + gcc_configure_args +
                               getCCSetting(prev_gcc, prev_gxx)),
                      haltOnFailure=True,
                      description=['configure', 'gcc', stage],
                      workdir=gcc_obj_dir,
                      env=cur_env))
        f.addStep(
            WarningCountingShellCommand(name='compile.gcc.%s' % stage,
                                        command=[
                                            'nice', '-n', '10', 'make',
                                            WithProperties('-j%s' % jobs)
                                        ],
                                        haltOnFailure=True,
                                        description=['compile', 'gcc', stage],
                                        workdir=gcc_obj_dir,
                                        env=cur_env,
                                        timeout=timeout * 60))
        f.addStep(
            WarningCountingShellCommand(
                name='install.gcc.%s' % stage,
                command=['nice', '-n', '10', 'make', 'install'],
                haltOnFailure=True,
                description=['install', 'gcc', stage],
                workdir=gcc_obj_dir,
                env=cur_env))

        # From this point on build everything using the just built GCC.
        prev_gcc = '%(builddir)s/' + gcc_install_dir + '/bin/gcc'
        prev_gxx = '%(builddir)s/' + gcc_install_dir + '/bin/g++'

        # The built libstdc++ and libgcc may well be more recent than the system
        # versions.  Set the library path so that programs compiled with the just
        # built GCC will start successfully, rather than failing due to missing
        # shared library dependencies.
        f.addStep(
            buildbot.steps.shell.SetProperty(
                name='gcc.search.paths.%s' % stage,
                command=[WithProperties(prev_gcc), '-print-search-dirs'],
                extract_fn=extractSearchPaths,
                haltOnFailure=True,
                description=['gcc', 'search paths', stage],
                env=cur_env))
        cur_env = cur_env.copy()
        if 'LIBRARY_PATH' in env:
            cur_env['LIBRARY_PATH'] = WithProperties('%(gcc_libraries)s' +
                                                     ':' + env['LIBRARY_PATH'])
        else:
            cur_env['LIBRARY_PATH'] = WithProperties('%(gcc_libraries)s')
        if 'LD_LIBRARY_PATH' in env:
            cur_env['LD_LIBRARY_PATH'] = WithProperties('%(gcc_libraries)s' +
                                                        ':' +
                                                        env['LD_LIBRARY_PATH'])
        else:
            cur_env['LD_LIBRARY_PATH'] = WithProperties('%(gcc_libraries)s')

        # Build everything using the DragonEgg plugin from the previous stage.
        if prev_plugin is not None:
            prev_gcc += ' -fplugin=' + prev_plugin
            prev_gxx += ' -fplugin=' + prev_plugin

        # Build LLVM with the just built GCC and install it.
        llvm_obj_dir = 'llvm.obj.%s' % stage
        if clean:
            f.addStep(
                ShellCommand(name='rm-%s' % llvm_obj_dir,
                             command=['rm', '-rf', llvm_obj_dir],
                             haltOnFailure=True,
                             description=['rm build dir', 'llvm', stage],
                             workdir='.',
                             env=cur_env))
        f.addStep(
            Configure(name='configure.llvm.%s' % stage,
                      command=([
                          '../' + llvm_src_dir + '/configure',
                          WithProperties(
                              '--prefix=%%(builddir)s/%s' % llvm_install_dir)
                      ] + llvm_configure_args +
                               getCCSetting(prev_gcc, prev_gxx)),
                      haltOnFailure=True,
                      description=['configure', 'llvm', stage],
                      workdir=llvm_obj_dir,
                      env=cur_env))
        f.addStep(
            WarningCountingShellCommand(name='compile.llvm.%s' % stage,
                                        command=[
                                            'nice', '-n', '10', 'make',
                                            WithProperties('-j%s' % jobs)
                                        ],
                                        haltOnFailure=True,
                                        description=['compile', 'llvm', stage],
                                        workdir=llvm_obj_dir,
                                        env=cur_env,
                                        timeout=timeout * 60))

        # Optionally run the LLVM testsuite.
        if check_llvm:
            f.addStep(
                LitTestCommand(name='check.llvm.%s' % stage,
                               command=[
                                   'nice', '-n', '10', 'make',
                                   WithProperties('LIT_ARGS=-v -j%s' % jobs),
                                   'check-all'
                               ],
                               description=['test', 'llvm', stage],
                               haltOnFailure=True,
                               workdir=llvm_obj_dir,
                               env=cur_env,
                               timeout=timeout * 60))

        f.addStep(
            WarningCountingShellCommand(
                name='install.llvm.%s' % stage,
                command=['nice', '-n', '10', 'make', 'install'],
                haltOnFailure=True,
                description=['install', 'llvm', stage],
                workdir=llvm_obj_dir,
                env=cur_env))

        # Build dragonegg with the just built LLVM and GCC.
        dragonegg_pre_obj_dir = 'dragonegg.obj.pre.%s' % stage
        if clean:
            f.addStep(
                ShellCommand(
                    name='rm-%s' % dragonegg_pre_obj_dir,
                    command=['rm', '-rf', dragonegg_pre_obj_dir],
                    description=['rm build dir', 'dragonegg pre', stage],
                    haltOnFailure=True,
                    workdir='.',
                    env=cur_env))
        f.addStep(
            WarningCountingShellCommand(
                name='compile.dragonegg.pre.%s' % stage,
                command=[
                    'nice', '-n', '10', 'make', '-f',
                    '../' + dragonegg_src_dir + '/Makefile',
                    WithProperties('-j%s' % jobs),
                    WithProperties('GCC=%(builddir)s/' + gcc_install_dir +
                                   '/bin/gcc'),
                    WithProperties('LLVM_CONFIG=%(builddir)s/' +
                                   llvm_install_dir + '/bin/llvm-config'),
                    WithProperties('TOP_DIR=%(builddir)s/' + dragonegg_src_dir)
                ] + getCCSetting(prev_gcc, prev_gxx),
                haltOnFailure=True,
                description=['compile', 'dragonegg pre', stage],
                workdir=dragonegg_pre_obj_dir,
                env=cur_env,
                timeout=timeout * 60))
        prev_gcc = '%(builddir)s/' + gcc_install_dir + '/bin/gcc -fplugin=%(builddir)s/' + dragonegg_pre_obj_dir + '/dragonegg.so'
        prev_gxx = '%(builddir)s/' + gcc_install_dir + '/bin/g++ -fplugin=%(builddir)s/' + dragonegg_pre_obj_dir + '/dragonegg.so'

        # Now build dragonegg again using the just built dragonegg.  The build is
        # always done in the same directory to ensure that object files built by
        # the different stages should be the same (the build directory name ends
        # up in object files via debug info), then moved to a per-stage directory.
        dragonegg_bld_dir = 'dragonegg.obj'  # The common build directory.
        dragonegg_obj_dir = 'dragonegg.obj.%s' % stage  # The per-stage directory.
        f.addStep(
            ShellCommand(
                name='rm-%s' % dragonegg_obj_dir,
                command=['rm', '-rf', dragonegg_bld_dir, dragonegg_obj_dir],
                description=['rm build dirs', 'dragonegg', stage],
                haltOnFailure=True,
                workdir='.',
                env=cur_env))
        f.addStep(
            WarningCountingShellCommand(
                name='compile.dragonegg.%s' % stage,
                command=[
                    'nice', '-n', '10', 'make', '-f', '../' +
                    dragonegg_src_dir + '/Makefile', 'DISABLE_VERSION_CHECK=1',
                    WithProperties('-j%s' % jobs),
                    WithProperties('GCC=%(builddir)s/' + gcc_install_dir +
                                   '/bin/gcc'),
                    WithProperties('LLVM_CONFIG=%(builddir)s/' +
                                   llvm_install_dir + '/bin/llvm-config'),
                    WithProperties('TOP_DIR=%(builddir)s/' + dragonegg_src_dir)
                ] + getCCSetting(prev_gcc, prev_gxx),
                description=['compile', 'dragonegg', stage],
                haltOnFailure=True,
                workdir=dragonegg_bld_dir,
                env=cur_env,
                timeout=timeout * 60))
        f.addStep(
            ShellCommand(name='mv-%s' % dragonegg_obj_dir,
                         command=['mv', dragonegg_bld_dir, dragonegg_obj_dir],
                         description=['mv build dir', 'dragonegg', stage],
                         haltOnFailure=True,
                         workdir='.',
                         env=cur_env))

        # Optionally run the dragonegg testsuite.
        if check_dragonegg:
            f.addStep(
                LitTestCommand(
                    name='check.dragonegg.%s' % stage,
                    command=[
                        'nice', '-n', '10', 'make', '-f',
                        '../' + dragonegg_src_dir + '/Makefile',
                        WithProperties('GCC=%(builddir)s/' + gcc_install_dir +
                                       '/bin/gcc'),
                        WithProperties('LLVM_CONFIG=%(builddir)s/' +
                                       llvm_install_dir + '/bin/llvm-config'),
                        WithProperties('TOP_DIR=%(builddir)s/' +
                                       dragonegg_src_dir),
                        WithProperties('LIT_ARGS=-v -j%s' % jobs), 'check'
                    ],
                    description=['test', 'dragonegg', stage],
                    haltOnFailure=True,
                    workdir=dragonegg_obj_dir,
                    env=cur_env,
                    timeout=timeout * 60))

        # Ensure that the following stages use the just built plugin.
        prev_plugin = '%(builddir)s/' + dragonegg_obj_dir + '/dragonegg.so'
        prev_gcc = '%(builddir)s/' + gcc_install_dir + '/bin/gcc -fplugin=' + prev_plugin
        prev_gxx = '%(builddir)s/' + gcc_install_dir + '/bin/g++ -fplugin=' + prev_plugin

    # Check that the dragonegg objects didn't change between stages 2 and 3.
    f.addStep(
        ShellCommand(name='compare.stages',
                     command=[
                         'sh', '-c', 'for O in *.o ; do cmp ' +
                         '../dragonegg.obj.stage2/$O ' +
                         '../dragonegg.obj.stage3/$O || exit 1 ; ' + 'done'
                     ],
                     haltOnFailure=True,
                     description='compare stages 2 and 3',
                     workdir='dragonegg.obj.stage3',
                     env=cur_env))

    return f
Esempio n. 29
0
def CreateLinuxChromeFactory():
    """Run chrome tests with the latest dynamorio.

  TODO(rnk): Run drmemory, not dynamorio.

  We use a build of chrome produced weekly from a known good revision on the
  same slave.
  """
    cr_src = '../../linux-cr-builder/build/src'
    ret = factory.BuildFactory()
    ret.addStep(
        SVN(svnurl=dr_svnurl,
            workdir='dynamorio',
            mode='update',
            name='Checkout DynamoRIO'))

    # If we need to execute 32-bit children, we'll need a full exports package.
    ret.addStep(
        Configure(command=['cmake', '..', '-DDEBUG=OFF'],
                  workdir='dynamorio/build',
                  name='Configure release DynamoRIO'))
    ret.addStep(
        Compile(command=['make', '-j5'],
                workdir='dynamorio/build',
                name='Compile release DynamoRIO'))

    # Don't follow python children.  This should speed up net_unittests, which
    # spawns a bunch of simple http servers to talk to.
    ret.addStep(
        ShellCommand(
            command=['bin64/drconfig', '-reg', 'python', '-norun', '-v'],
            workdir='dynamorio/build',
            name='don\'t follow python',
            description='don\'t follow python',
            descriptionDone='don\'t follow python'))

    # Chromium tests
    for test in LINUX_CHROME_TESTS:
        cmd = [
            'xvfb-run',
            '-a',
            '../dynamorio/build/bin64/drrun',
            '-stderr_mask',
            '12',  # Show DR crashes
            '--',
            cr_src + '/out/Release/' + test
        ]
        if test == 'browser_tests':
            cmd += ['--gtest_filter=AutofillTest.BasicFormFill']
        elif test == 'net_unittests':
            cmd += [
                '--gtest_filter=-CertDatabaseNSSTest.ImportCACertHierarchy*'
            ]
        elif test == 'remoting_unittests':
            cmd += [
                '--gtest_filter='
                '-VideoFrameCapturerTest.Capture:'
                'DesktopProcessTest.DeathTest'
            ]
        elif test == 'base_unittests':
            # crbug.com/308273: this test is flaky
            cmd += [
                '--gtest_filter=-TraceEventTestFixture.TraceContinuousSampling'
            ]
        elif test == 'content_shell':
            cmd += ['-dump-render-tree', 'file:///home/chrome-bot/bb.html']
        # We used to md5 the output, but that's too brittle.  Just dump it to stdout
        # so humans can verify it.  The return code will tell us if we crash.
        # TODO(rnk): We should run some selection of layout tests if we want to
        # verify output.
        ret.addStep(
            Test(command=cmd,
                 env={'CHROME_DEVEL_SANDBOX': '/opt/chromium/chrome_sandbox'},
                 name=test,
                 descriptionDone=test,
                 description=test))

    return ret