예제 #1
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
예제 #2
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
예제 #3
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
예제 #4
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