コード例 #1
0
ファイル: mx_graaltest.py プロジェクト: graalvm/truffle
def testgraal(args):
    cloneFrom = mx.get_env("GRAAL_URL")
    if not cloneFrom:
        cloneFrom = "http://github.com/graalvm/graal-core"
    graalSuiteSubDir = mx.get_env("GRAAL_SUITE_SUBDIR")

    suite = mx.suite('truffle')
    suiteDir = suite.dir
    workDir = join(suite.get_output_root(), 'sanitycheck')
    mx.ensure_dir_exists(join(workDir, suite.name))
    for f in os.listdir(suiteDir):
        subDir = os.path.join(suiteDir, f)
        if subDir == suite.get_output_root():
            continue
        src = join(suiteDir, f)
        tgt = join(workDir, suite.name, f)
        if isdir(src):
            if exists(tgt):
                shutil.rmtree(tgt)
            shutil.copytree(src, tgt)
        else:
            shutil.copy(src, tgt)

    sanityDir = join(workDir, 'sanity')
    git = mx.GitConfig()
    if exists(sanityDir):
        git.pull(sanityDir)
    else:
        git.clone(cloneFrom, sanityDir)

    sanitySuiteDir = sanityDir if graalSuiteSubDir is None else join(sanityDir, graalSuiteSubDir)
    return mx.run_mx(['--java-home=' + mx.get_jdk().home, 'gate', '-B--force-deprecation-as-warning', '--tags', 'build,test'], sanitySuiteDir)
コード例 #2
0
ファイル: mx_ideconfig.py プロジェクト: graalvm/mx
def _get_ide_envvars():
    """
    Gets a dict of environment variables that must be captured in generated IDE configurations.
    """
    result = {
        'JAVA_HOME': mx.get_env('JAVA_HOME') or mx.get_jdk().home,
        'EXTRA_JAVA_HOMES': mx.get_env('EXTRA_JAVA_HOMES'),
    }
    for name, value in _ide_envvars.items():
        if value is None:
            value = mx.get_env(name)
        if value is not None:
            result[name] = value
    return result
コード例 #3
0
    def _run(self, *args, **kwargs):
        cmd = [self.binary, '-j', self.parallelism]
        mx_verbose_env = mx.get_env('MX_VERBOSE', None)
        if mx.get_opts().very_verbose or mx_verbose_env:
            cmd += ['-v']
        cmd += args

        out = kwargs.get('out', mx.OutputCapture())
        err = kwargs.get('err', subprocess.STDOUT)
        verbose = mx.get_opts().verbose or mx_verbose_env
        if verbose:
            if callable(out) and '-n' not in args:
                out = mx.TeeOutputCapture(out)
            if callable(err):
                err = mx.TeeOutputCapture(err)

        try:
            rc = mx.run(cmd, nonZeroIsFatal=False, out=out, err=err, cwd=self.build_dir)
        except OSError as e:
            if e.errno != errno.EACCES:
                mx.abort('Error executing \'{}\': {}'.format(' '.join(cmd), str(e)))
            mx.logv('{} is not executable. Trying to change permissions...'.format(self.binary))
            os.chmod(self.binary, 0o755)
            self._run(*args, **kwargs)  # retry
        else:
            not rc or mx.abort(rc if verbose else out.data)  # pylint: disable=expression-not-assigned
コード例 #4
0
ファイル: sanitycheck.py プロジェクト: yuchaocs/MaxSim
def getScalaDacapo(name, dacapoArgs=[]):
    dacapo = mx.get_env('DACAPO_SCALA_CP')
    if dacapo is None:
        l = mx.library('DACAPO_SCALA', False)
        if l is not None:
            dacapo = l.get_path(True)
        else:
            mx.abort(
                'Scala DaCapo 0.1.0 jar file must be specified with DACAPO_SCALA_CP environment variable or as DACAPO_SCALA library'
            )

    if not isfile(dacapo) or not dacapo.endswith('.jar'):
        mx.abort(
            'Specified Scala DaCapo jar file does not exist or is not a jar file: '
            + dacapo)

    dacapoSuccess = re.compile(
        r"^===== DaCapo 0\.1\.0(-SNAPSHOT)? ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====$",
        re.MULTILINE)
    dacapoFail = re.compile(
        r"^===== DaCapo 0\.1\.0(-SNAPSHOT)? ([a-zA-Z0-9_]+) FAILED (warmup|) =====$",
        re.MULTILINE)
    dacapoTime = re.compile(
        r"===== DaCapo 0\.1\.0(-SNAPSHOT)? (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec ====="
    )

    dacapoMatcher = ValuesMatcher(dacapoTime, {
        'group': "Scala-DaCapo",
        'name': '<benchmark>',
        'score': '<time>'
    })

    return Test("Scala-DaCapo-" + name, ['-jar', dacapo, name] + dacapoArgs,
                [dacapoSuccess], [dacapoFail], [dacapoMatcher],
                ['-Xms2g', '-XX:+' + gc, '-XX:-UseCompressedOops'])
コード例 #5
0
def compileWithEcjStrict(args=None):
    """build project with the option --warning-as-error"""
    if mx.get_env('JDT'):
        mx.clean([])
        mx.command_function('build')(['-p', '--warning-as-error'])
    else:
        exit('JDT environment variable not set. Cannot execute BuildJavaWithEcj task.')
コード例 #6
0
ファイル: mx_fastr.py プロジェクト: anukat2015/fastr
def _test_harness_body_install_new(args, vmArgs):
    '''the callback from mx.test'''
    libinstall = abspath("lib.install.cran")
    # make sure its empty
    shutil.rmtree(libinstall, ignore_errors=True)
    os.mkdir(libinstall)
    install_tmp = "install.tmp"
    shutil.rmtree(install_tmp, ignore_errors=True)
    os.mkdir(install_tmp)
    os.environ["TMPDIR"] = install_tmp
    os.environ['R_LIBS_USER'] = libinstall
    stack_args = ['--J', '@-DR:-PrintErrorStacktracesToFile -DR:+PrintErrorStacktraces']
    cran_args = []
    local_cran = mx.get_env('MX_HG_BASE')
    if local_cran:
        cran_args = ['--cran-mirror', join(dirname(local_cran), 'cran')]
    # the following is used to test the installation of packages that are not in the
    # --ok-pkg-filelist file, i.e. those that have never been successfully installed
    # extra_args = ['--ok-pkg-filelist', join(_cran_test_project(), 'ok.packages')]

    # the following line is used to test packages that have been successfully installed
    extra_args = ['--pkg-filelist', join(_cran_test_project(), 'ok.packages'), '--run-tests']
    rc = installcran(stack_args + cran_args + ['--testcount', '100'] + extra_args)
    shutil.rmtree(install_tmp, ignore_errors=True)
    return rc
コード例 #7
0
ファイル: mx_sulong.py プロジェクト: graalvm/sulong
def compileWithEcjStrict(args=None):
    """build project with the option --warning-as-error"""
    if mx.get_env("JDT"):
        mx.clean([])
        mx.command_function("build")(["-p", "--warning-as-error"])
    else:
        exit("JDT environment variable not set. Cannot execute BuildJavaWithEcj task.")
コード例 #8
0
ファイル: sanitycheck.py プロジェクト: woess/graal-core
def getSPECjvm2008(benchArgs=None):

    specjvm2008 = mx.get_env('SPECJVM2008')
    if specjvm2008 is None or not exists(join(specjvm2008, 'SPECjvm2008.jar')):
        mx.abort(
            'Please set the SPECJVM2008 environment variable to a SPECjvm2008 directory'
        )

    score = re.compile(
        r"^(Score on|Noncompliant) (?P<benchmark>[a-zA-Z0-9\._]+)( result)?: (?P<score>[0-9]+((,|\.)[0-9]+)?)( SPECjvm2008 Base)? ops/m$",
        re.MULTILINE)
    error = re.compile(r"^Errors in benchmark: ", re.MULTILINE)
    # The ' ops/m' at the end of the success string is important : it's how you can tell valid and invalid runs apart
    success = re.compile(
        r"^(Noncompliant c|C)omposite result: [0-9]+((,|\.)[0-9]+)?( SPECjvm2008 (Base|Peak))? ops/m$",
        re.MULTILINE)
    matcher = ValuesMatcher(score, {
        'group': 'SPECjvm2008',
        'name': '<benchmark>',
        'score': '<score>'
    })

    return Test("SPECjvm2008",
                ['-jar', 'SPECjvm2008.jar'] + _noneAsEmptyList(benchArgs),
                [success], [error], [matcher],
                vmOpts=['-Xms3g', '-XX:+' + gc, '-XX:-UseCompressedOops'],
                defaultCwd=specjvm2008)
コード例 #9
0
ファイル: sanitycheck.py プロジェクト: woess/graal-core
def getDacapo(name, dacapoArgs=None, extraVmArguments=None):
    dacapo = mx.get_env('DACAPO_CP')
    if dacapo is None:
        l = mx.library('DACAPO', False)
        if l is not None:
            dacapo = l.get_path(True)
        else:
            mx.abort('DaCapo 9.12 jar file must be specified with DACAPO_CP environment variable or as DACAPO library')

    if not isfile(dacapo) or not dacapo.endswith('.jar'):
        mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo)

    dacapoSuccess = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====", re.MULTILINE)
    dacapoFail = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) FAILED (warmup|) =====", re.MULTILINE)
    dacapoTime = re.compile(r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec =====")
    dacapoTime1 = re.compile(r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) completed warmup 1 in (?P<time>[0-9]+) msec =====")

    dacapoMatcher = ValuesMatcher(dacapoTime, {'group' : 'DaCapo', 'name' : '<benchmark>', 'score' : '<time>'})
    dacapoMatcher1 = ValuesMatcher(dacapoTime1, {'group' : 'DaCapo-1stRun', 'name' : '<benchmark>', 'score' : '<time>'})

    # Use ipv4 stack for dacapos; tomcat+solaris+ipv6_interface fails (see also: JDK-8072384)
    return Test("DaCapo-" + name, ['-jar', mx._cygpathU2W(dacapo), name] + _noneAsEmptyList(dacapoArgs), [dacapoSuccess], [dacapoFail],
                [dacapoMatcher, dacapoMatcher1],
                ['-Xms2g', '-XX:+' + gc, '-XX:-UseCompressedOops', "-Djava.net.preferIPv4Stack=true", '-G:+ExitVMOnException'] +
                _noneAsEmptyList(extraVmArguments))
コード例 #10
0
ファイル: mx_downstream.py プロジェクト: graalvm/mx
def testdownstream_cli(args):
    """tests a downstream repo against the current working directory state of the primary suite

    Multiple repos can be specified with multiple instances of the -R/--repo option. The
    first specified repo is the one being tested. Further repos can be specified to either
    override where suites are cloned from or to satisfy --dynamicimports.
    """
    parser = ArgumentParser(prog='mx testdownstream')
    parser.add_argument('-R', '--repo', dest='repos', action='append', help='URL of downstream repo to clone. First specified repo is the primary repo being tested', required=True, metavar='<url>', default=[])
    parser.add_argument('--suitedir', action='store', help='relative directory of suite to test in primary repo (default: . )', default='.', metavar='<path>')
    parser.add_argument('--downstream-branch', action='store', help='name of branch to look for in downstream repo(s). '
                        'Can be specified by DOWNSTREAM_BRANCH environment variable. If not specified, current branch of the primary suite is used.', metavar='<name>')
    parser.add_argument('-C', '--mx-command', dest='mxCommands', action='append', help='arguments to an mx command run in primary repo suite (e.g., -C "-v --strict-compliance gate")', default=[], metavar='<args>')
    parser.add_argument('-E', '--encoded-space', help='character used to encode a space in an mx command argument. Each instance of this character in an argument will be replaced with a space.', metavar='<char>')

    args = parser.parse_args(args)

    mxCommands = []
    for command in [e.split() for e in args.mxCommands]:
        if args.encoded_space:
            command = [arg.replace(args.encoded_space, ' ') for arg in command]
        mxCommands.append(command)

    branch = args.downstream_branch or mx.get_env('DOWNSTREAM_BRANCH', None)
    return testdownstream(mx.primary_suite(), args.repos, args.suitedir, mxCommands, branch)
コード例 #11
0
def getSPECjbb2005(benchArgs=[]):

    specjbb2005 = mx.get_env('SPECJBB2005')
    if specjbb2005 is None or not exists(join(specjbb2005, 'jbb.jar')):
        mx.abort(
            'Please set the SPECJBB2005 environment variable to a SPECjbb2005 directory'
        )

    score = re.compile(r"^Valid run, Score is  (?P<score>[0-9]+)$",
                       re.MULTILINE)
    error = re.compile(r"VALIDATION ERROR")
    success = re.compile(r"^Valid run, Score is  [0-9]+$", re.MULTILINE)
    matcher = ValuesMatcher(score, {
        'group': 'SPECjbb2005',
        'name': 'score',
        'score': '<score>'
    })
    classpath = ['jbb.jar', 'check.jar']
    return Test("SPECjbb2005",
                ['spec.jbb.JBBmain', '-propfile', 'SPECjbb.props'] + benchArgs,
                [success], [error], [matcher],
                vmOpts=[
                    '-Xms3g', '-XX:+' + gc, '-XX:-UseCompressedOops', '-cp',
                    os.pathsep.join(classpath)
                ],
                defaultCwd=specjbb2005)
コード例 #12
0
ファイル: mx_urlrewrites.py プロジェクト: rowhit/mx
def register_urlrewrites_from_env(name):
    """
    Appends rewrite rules denoted by the environment variable named by `name`.
    If the environment variable has a non-empty value it must either be an JSON
    object describing a single rewrite rule, a JSON array describing a list of
    rewrite rules or a file containing one of these JSON values.

    :param str name: name of an environment variable denoting URL rewrite rules
    """
    value = mx.get_env(name, None)
    if value:
        def raiseError(msg):
            raise Exception('Error processing URL rewrite rules denoted by environment variable ' + name + ':\n' + msg)

        value = value.strip()
        if value[0] not in '{[':
            with open(value) as fp:
                jsonValue = fp.read().strip()
        else:
            jsonValue = value

        def loadJson(jsonValue):
            try:
                return json.loads(jsonValue)
            except ValueError as e:
                raise Exception('Error parsing JSON object denoted by ' + name + ' environment variable:\n' + str(e))

        if jsonValue:
            rewrites = loadJson(jsonValue) # JSON root is always either list or dict
            if isinstance(rewrites, dict):
                rewrites = [rewrites]
            for rewrite in rewrites:
                register_urlrewrite(rewrite, raiseError)
コード例 #13
0
ファイル: mx_vm_gate.py プロジェクト: rschatz/graal
def graalvm_svm():
    """
    Gives access to image building withing the GraalVM release. Requires dynamic import of substratevm.
    """
    native_image_cmd = join(
        mx_sdk_vm_impl.graalvm_output(), 'bin',
        'native-image') + ('.cmd' if mx.get_os() == 'windows' else '')
    svm = mx.suite('substratevm')
    if not exists(native_image_cmd) or not svm:
        mx.abort(
            "Image building not accessible in GraalVM {}. Build GraalVM with native-image support"
            .format(mx_sdk_vm_impl.graalvm_dist_name()))
    # useful to speed up image creation during development
    hosted_assertions = mx.get_env("DISABLE_SVM_IMAGE_HOSTED_ASSERTIONS",
                                   "false") != "true"

    @contextmanager
    def native_image_context(common_args=None,
                             hosted_assertions=hosted_assertions):
        with svm.extensions.native_image_context(
                common_args, hosted_assertions,
                native_image_cmd=native_image_cmd) as native_image:
            yield native_image

    return native_image_context, svm.extensions
コード例 #14
0
ファイル: mx_sulong.py プロジェクト: NeilBryant/sulong
def travis1(args=None):
    tasks = []
    with Task('BuildJavaWithEcj', tasks) as t:
        if t:
            if mx.get_env('JDT'):
                mx.command_function('build')(['-p', '--no-native', '--warning-as-error'])
                gate_clean([], tasks, name='CleanAfterEcjBuild')
            else:
                mx._warn_or_abort('JDT environment variable not set. Cannot execute BuildJavaWithEcj task.', args.strict_mode)
    with Task('BuildJavaWithJavac', tasks) as t:
        if t: mx.command_function('build')(['-p', '--warning-as-error', '--no-native', '--force-javac'])
    with Task('Findbugs', tasks) as t:
        if t and mx_findbugs.findbugs([]) != 0:
            t.abort('FindBugs warnings were found')
    with Task('TestBenchmarks', tasks) as t:
        if t: runBenchmarkTestCases()
    with Task('TestPolglot', tasks) as t:
        if t: runPolyglotTestCases()
    with Task('TestInterop', tasks) as t:
        if t: runInteropTestCases()
    with Task('TestAsm', tasks) as t:
        if t: runAsmTestCases()
    with Task('TestTypes', tasks) as t:
        if t: runTypeTestCases()
    with Task('TestSulong', tasks) as t:
        if t: runTruffleTestCases()
    with Task('TestLLVM', tasks) as t:
        if t: runLLVMTestCases()
コード例 #15
0
ファイル: mx_downstream.py プロジェクト: stealify/mx
def testdownstream_cli(args):
    """tests a downstream repo against the current working directory state of the primary suite

    Multiple repos can be specified with multiple instances of the -R/--repo option. The
    first specified repo is the one being tested. Further repos can be specified to either
    override where suites are cloned from or to satisfy --dynamicimports.
    """
    parser = ArgumentParser(prog='mx testdownstream')
    parser.add_argument('-R', '--repo', dest='repos', action='append', help='URL of downstream repo to clone. First specified repo is the primary repo being tested', required=True, metavar='<url>', default=[])
    parser.add_argument('--suitedir', action='store', help='relative directory of suite to test in primary repo (default: . )', default='.', metavar='<path>')
    parser.add_argument('--downstream-branch', action='store', help='name of branch to look for in downstream repo(s). '
                        'Can be specified by DOWNSTREAM_BRANCH environment variable. If not specified, current branch of the primary suite is used.', metavar='<name>')
    parser.add_argument('-C', '--mx-command', dest='mxCommands', action='append', help='arguments to an mx command run in primary repo suite (e.g., -C "-v --strict-compliance gate")', default=[], metavar='<args>')
    parser.add_argument('-E', '--encoded-space', help='character used to encode a space in an mx command argument. Each instance of this character in an argument will be replaced with a space.', metavar='<char>')

    args = parser.parse_args(args)

    mxCommands = []
    for command in [e.split() for e in args.mxCommands]:
        if args.encoded_space:
            command = [arg.replace(args.encoded_space, ' ') for arg in command]
        mxCommands.append(command)

    branch = args.downstream_branch or mx.get_env('DOWNSTREAM_BRANCH', None)
    return testdownstream(mx.primary_suite(), args.repos, args.suitedir, mxCommands, branch)
コード例 #16
0
ファイル: mx_sulong.py プロジェクト: lxp/sulong
def compileWithEcjStrict(args=None):
    """build project with the option --warning-as-error"""
    if mx.get_env('JDT'):
        mx.clean([])
        mx.command_function('build')(['-p', '--warning-as-error'])
    else:
        exit('JDT environment variable not set. Cannot execute BuildJavaWithEcj task.')
コード例 #17
0
ファイル: mx_fastr.py プロジェクト: chumer/fastr
def load_optional_suite(name, rev):
    hg_base = mx.get_env('MX_HG_BASE')
    urlinfos = None if hg_base is None else [mx.SuiteImportURLInfo(join(hg_base, name), 'hg', mx.vc_system('hg'))]
    opt_suite = _fastr_suite.import_suite(name, version=rev, urlinfos=urlinfos)
    if opt_suite:
        mx.build_suite(opt_suite)
    return opt_suite
コード例 #18
0
def getSPECjbb2013(benchArgs=[]):

    specjbb2013 = mx.get_env('SPECJBB2013')
    if specjbb2013 is None or not exists(join(specjbb2013, 'specjbb2013.jar')):
        mx.abort(
            'Please set the SPECJBB2013 environment variable to a SPECjbb2013 directory'
        )

    jops = re.compile(
        r"^RUN RESULT: hbIR \(max attempted\) = [0-9]+, hbIR \(settled\) = [0-9]+, max-jOPS = (?P<max>[0-9]+), critical-jOPS = (?P<critical>[0-9]+)$",
        re.MULTILINE)
    #error?
    success = re.compile(r"org.spec.jbb.controller: Run finished",
                         re.MULTILINE)
    matcherMax = ValuesMatcher(jops, {
        'group': 'SPECjbb2013',
        'name': 'max',
        'score': '<max>'
    })
    matcherCritical = ValuesMatcher(jops, {
        'group': 'SPECjbb2013',
        'name': 'critical',
        'score': '<critical>'
    })
    return Test("SPECjbb2013",
                ['-jar', 'specjbb2013.jar', '-m', 'composite'] + benchArgs,
                [success], [], [matcherCritical, matcherMax],
                vmOpts=[
                    '-Xmx6g', '-Xms6g', '-Xmn3g', '-XX:+UseParallelOldGC',
                    '-XX:-UseAdaptiveSizePolicy', '-XX:-UseBiasedLocking',
                    '-XX:-UseCompressedOops'
                ],
                defaultCwd=specjbb2013)
コード例 #19
0
 def __init__(self,
              suite,
              name,
              deps,
              workingSets,
              subDir,
              results=None,
              output=None,
              buildRef=True,
              buildSharedObject=False,
              bundledLLVMOnly=False,
              **args):
     projectDir = args.pop('dir', None)
     if projectDir:
         d_rel = projectDir
     elif subDir is None:
         d_rel = name
     else:
         d_rel = os.path.join(subDir, name)
     d = os.path.join(suite.dir, d_rel.replace('/', os.sep))
     super(ExternalTestSuite,
           self).__init__(suite, name, subDir, [], deps, workingSets,
                          results, output, d, **args)
     if bundledLLVMOnly and mx.get_env('CLANG_CC', None):
         self.ignore = "Environment variable 'CLANG_CC' is set but project specifies 'bundledLLVMOnly'"
     self.vpath = True
     self.buildRef = buildRef
     self.buildSharedObject = buildSharedObject
     self._is_needs_rebuild_call = False
コード例 #20
0
def jackpot(args, suite=None, nonZeroIsFatal=False):
    """run Jackpot 3.0 against non-test Java projects"""
    jackpotHome = mx.get_env('JACKPOT_HOME', None)
    if jackpotHome:
        jackpotJar = join(jackpotHome, 'jackpot.jar')
    else:
        jackpotJar = mx.library('JACKPOT').get_path(resolve=True)
    assert exists(jackpotJar)
    if suite is None:
        suite = mx.primary_suite()
    nonTestProjects = [p for p in mx.projects() if _should_test_project(p)]
    if not nonTestProjects:
        return 0
    groups = []
    for p in nonTestProjects:
        javacClasspath = []

        deps = []
        p.walk_deps(visit=lambda dep, edge: deps.append(dep)
                    if dep.isLibrary() or dep.isJavaProject() else None)
        annotationProcessorOnlyDeps = []
        if len(p.annotation_processors()) > 0:
            for apDep in p.annotation_processors():
                if not apDep in deps:
                    deps.append(apDep)
                    annotationProcessorOnlyDeps.append(apDep)

        for dep in deps:
            if dep == p:
                continue

            if dep in annotationProcessorOnlyDeps:
                continue

            javacClasspath.append(dep.classpath_repr(resolve=True))

        sourceLevel = min(p.javaCompliance.value, 9)

        groups = groups + [
            '--group', "--classpath " + mx._separatedCygpathU2W(
                _escape_string(os.pathsep.join(javacClasspath))) +
            " --source " + str(sourceLevel) + " " +
            " ".join([_escape_string(d) for d in p.source_dirs()])
        ]

    cmd = [
        '-classpath',
        mx._cygpathU2W(jackpotJar),
        'org.netbeans.modules.jackpot30.cmdline.Main'
    ]
    cmd = cmd + ['--fail-on-warnings', '--progress'] + args + groups

    jdk = mx.get_jdk(mx.JavaCompliance("8"),
                     cancel='cannot run Jackpot',
                     purpose="run Jackpot")
    if jdk is None:
        mx.warn('Skipping Jackpot since JDK 8 is not available')
        return 0
    else:
        return mx.run_java(cmd, nonZeroIsFatal=nonZeroIsFatal, jdk=jdk)
コード例 #21
0
 def daCapoPath(self):
     dacapo = mx.get_env(self.daCapoClasspathEnvVarName())
     if dacapo:
         return dacapo
     lib = mx.library(self.daCapoLibraryName(), False)
     if lib:
         return lib.get_path(True)
     return None
コード例 #22
0
 def interpreter(self):
     home = mx.get_env(ENV_PYPY_HOME)
     if not home:
         try:
             return subprocess.check_output("which %s" % PyPyVm.PYPY_INTERPRETER, shell=True).decode().strip()
         except OSError:
             mx.abort("{} is not set!".format(ENV_PYPY_HOME))
     return join(home, 'bin', PyPyVm.PYPY_INTERPRETER)
コード例 #23
0
ファイル: mx_benchmark.py プロジェクト: graalvm/mx
def builder_url():
    """
    Get the builders url from the BUILD_URL environment variable, or an empty string otherwise.

    :return: the builders url
    :rtype: basestring
    """
    return mx.get_env("BUILD_URL", default="")
コード例 #24
0
 def daCapoPath(self):
     dacapo = mx.get_env(self.daCapoClasspathEnvVarName())
     if dacapo:
         return dacapo
     lib = mx.library(self.daCapoLibraryName(), False)
     if lib:
         return lib.get_path(True)
     return None
コード例 #25
0
 def dacapoPath(self):
     dacapo = mx.get_env("DACAPO_CP")
     if dacapo:
         return dacapo
     lib = mx.library("DACAPO", False)
     if lib:
         return lib.get_path(True)
     return None
コード例 #26
0
 def dacapoPath(self):
     dacapo = mx.get_env("DACAPO_CP")
     if dacapo:
         return dacapo
     lib = mx.library("DACAPO", False)
     if lib:
         return lib.get_path(True)
     return None
コード例 #27
0
def jackpot(args, suite=None, nonZeroIsFatal=False):
    """run Jackpot 11.1 against non-test Java projects"""

    jackpotHome = mx.get_env('JACKPOT_HOME', None)
    if jackpotHome:
        jackpotJar = join(jackpotHome, 'jackpot.jar')
    else:
        jackpotJar = mx.library('JACKPOT').get_path(resolve=True)
    assert exists(jackpotJar)
    if suite is None:
        suite = mx.primary_suite()
    nonTestProjects = [p for p in mx.projects() if _should_test_project(p)]
    if not nonTestProjects:
        return 0
    groups = []
    for p in nonTestProjects:
        javacClasspath = []

        deps = []
        p.walk_deps(visit=lambda dep, edge: deps.append(dep) if dep.isLibrary() or dep.isJavaProject() else None)
        annotationProcessorOnlyDeps = []
        if len(p.annotation_processors()) > 0:
            for apDep in p.annotation_processors():
                if not apDep in deps:
                    deps.append(apDep)
                    annotationProcessorOnlyDeps.append(apDep)

        for dep in deps:
            if dep == p:
                continue

            if dep in annotationProcessorOnlyDeps:
                continue

            javacClasspath.append(dep.classpath_repr(resolve=True))

        sourceLevel = min(p.javaCompliance.value, 9)

        groups = groups + ['--group', "--classpath " + mx._separatedCygpathU2W(_escape_string(os.pathsep.join(javacClasspath))) + " --source " + str(sourceLevel) + " " + " ".join([_escape_string(d) for d in p.source_dirs()])]

    cmd = ['--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED', '--add-opens=java.base/java.net=ALL-UNNAMED', '--add-opens=java.desktop/sun.awt=ALL-UNNAMED']
    cmd = cmd + ['-classpath', mx._cygpathU2W(jackpotJar), 'org.netbeans.modules.jackpot30.cmdline.Main']
    jackCmd = ['--fail-on-warnings', '--progress'] + args + groups

    jdk = mx.get_jdk(mx.JavaCompliance("11+"), cancel='cannot run Jackpot', purpose="run Jackpot")
    if jdk is None:
        mx.warn('Skipping Jackpot since JDK 11+ is not available')
        return 0
    else:
        with tempfile.NamedTemporaryFile(mode='w', suffix='.jackpot') as f:
            for c in jackCmd:
                print(c, file=f)
            f.flush()
            ret = mx.run_java(cmd + ['@' + f.name], nonZeroIsFatal=nonZeroIsFatal, jdk=jdk)
            if ret != 0:
                mx.warn('To simulate the failure execute `mx -p {0} jackpot`.'.format(suite.dir))
                mx.warn('To fix the error automatically try `mx -p {0} jackpot --apply`'.format(suite.dir))
            return ret
コード例 #28
0
ファイル: mx_sulong.py プロジェクト: rmosaner/graal
 def provider():
     bootstrap_graalvm = mx.get_env('SULONG_BOOTSTRAP_GRAALVM')
     if bootstrap_graalvm:
         ret = os.path.join(bootstrap_graalvm, 'jre', 'languages', 'llvm', name)
         if os.path.exists(ret): # jdk8 based graalvm
             return ret
         else: # jdk11+ based graalvm
             return os.path.join(bootstrap_graalvm, 'languages', 'llvm', name)
     return mx.distribution(dist).get_output()
コード例 #29
0
def findbugs(args, fbArgs=None, suite=None, projects=None):
    """run FindBugs against non-test Java projects"""
    findBugsHome = mx.get_env('FINDBUGS_HOME', None)
    if suite is None:
        suite = mx._primary_suite
    if findBugsHome:
        findbugsJar = join(findBugsHome, 'lib', 'findbugs.jar')
    else:
        findbugsLib = join(mx._mx_suite.get_output_root(), 'findbugs-3.0.0')
        if not exists(findbugsLib):
            tmp = tempfile.mkdtemp(prefix='findbugs-download-tmp',
                                   dir=mx._mx_suite.dir)
            try:
                findbugsDist = mx.library('FINDBUGS_DIST').get_path(
                    resolve=True)
                with zipfile.ZipFile(findbugsDist) as zf:
                    candidates = [
                        e for e in zf.namelist()
                        if e.endswith('/lib/findbugs.jar')
                    ]
                    assert len(candidates) == 1, candidates
                    libDirInZip = os.path.dirname(candidates[0])
                    zf.extractall(tmp)
                shutil.copytree(join(tmp, libDirInZip), findbugsLib)
            finally:
                shutil.rmtree(tmp)
        findbugsJar = join(findbugsLib, 'findbugs.jar')
    assert exists(findbugsJar)
    nonTestProjects = [p for p in mx.projects() if _should_test_project(p)]
    if not nonTestProjects:
        return 0
    outputDirs = map(mx._cygpathU2W, [p.output_dir() for p in nonTestProjects])
    javaCompliance = max([p.javaCompliance for p in nonTestProjects])
    jdk = mx.get_jdk(javaCompliance)
    if jdk.javaCompliance >= "1.9":
        mx.log('FindBugs does not yet support JDK9 - skipping')
        return 0

    findbugsResults = join(suite.dir, 'findbugs.results')

    if fbArgs is None:
        fbArgs = defaultFindbugsArgs()
    cmd = ['-jar', mx._cygpathU2W(findbugsJar)] + fbArgs
    cmd = cmd + [
        '-auxclasspath',
        mx._separatedCygpathU2W(
            mx.classpath([p.name
                          for p in nonTestProjects], jdk=jdk)), '-output',
        mx._cygpathU2W(findbugsResults), '-exitcode'
    ] + args + outputDirs
    exitcode = mx.run_java(cmd, nonZeroIsFatal=False, jdk=jdk)
    if exitcode != 0:
        with open(findbugsResults) as fp:
            mx.log(fp.read())
    os.unlink(findbugsResults)
    return exitcode
コード例 #30
0
 def specJbbClassPath(self):
     specjbb2015 = mx.get_env("SPECJBB2015")
     if specjbb2015 is None:
         mx.abort("Please set the SPECJBB2015 environment variable to a " +
             "SPECjbb2015 directory.")
     jbbpath = join(specjbb2015, "specjbb2015.jar")
     if not exists(jbbpath):
         mx.abort("The SPECJBB2015 environment variable points to a directory " +
             "without the specjbb2015.jar file.")
     return jbbpath
コード例 #31
0
 def specJbbClassPath(self):
     specjbb2013 = mx.get_env("SPECJBB2013")
     if specjbb2013 is None:
         mx.abort("Please set the SPECJBB2013 environment variable to a " +
             "SPECjbb2013 directory.")
     jbbpath = join(specjbb2013, "specjbb2013.jar")
     if not exists(jbbpath):
         mx.abort("The SPECJBB2013 environment variable points to a directory " +
             "without the specjbb2013.jar file.")
     return jbbpath
コード例 #32
0
 def specJvmPath(self):
     specjvm2008 = mx.get_env("SPECJVM2008")
     if specjvm2008 is None:
         mx.abort("Please set the SPECJVM2008 environment variable to a " +
             "SPECjvm2008 directory.")
     jarpath = join(specjvm2008, "SPECjvm2008.jar")
     if not exists(jarpath):
         mx.abort("The SPECJVM2008 environment variable points to a directory " +
             "without the SPECjvm2008.jar file.")
     return jarpath
コード例 #33
0
 def specJvmPath(self):
     specjvm2008 = mx.get_env("SPECJVM2008")
     if specjvm2008 is None:
         mx.abort("Please set the SPECJVM2008 environment variable to a " +
             "SPECjvm2008 directory.")
     jarpath = join(specjvm2008, "SPECjvm2008.jar")
     if not exists(jarpath):
         mx.abort("The SPECJVM2008 environment variable points to a directory " +
             "without the SPECjvm2008.jar file.")
     return jarpath
コード例 #34
0
ファイル: mx_compdb.py プロジェクト: addstone/graalvm-mx
def init():
    global _compdb_path
    global _compdb_lock
    o = mx.get_opts().compdb
    if o is None:
        o = mx.get_env('MX_COMPDB')
    if o is not None and o != 'none':
        _compdb_lock = Lock()
        if o == 'default':
            _compdb_path = _default_compdb_path()
        else:
            _compdb_path = os.path.abspath(o)
コード例 #35
0
ファイル: mx_fastr.py プロジェクト: anukat2015/fastr
def load_optional_suite(name, rev, kind='hg', build=True, url=None):
    if not url:
        hg_base = mx.get_env('MX_' + kind.upper() + '_BASE')
        if hg_base is None:
            url = None
        else:
            url = join(hg_base, name)
    urlinfos = None if url is None else [mx.SuiteImportURLInfo(url, kind, mx.vc_system(kind))]
    opt_suite = _fastr_suite.import_suite(name, version=rev, urlinfos=urlinfos)
    if opt_suite and build:
        mx.build_suite(opt_suite)
    return opt_suite
コード例 #36
0
ファイル: sanitycheck.py プロジェクト: pombreda/graal
def getSPECjbb2013(benchArgs = []):
    
    specjbb2013 = mx.get_env('SPECJBB2013')
    if specjbb2013 is None or not exists(join(specjbb2013, 'specjbb2013.jar')):
        mx.abort('Please set the SPECJBB2013 environment variable to a SPECjbb2013 directory')
    
    jops = re.compile(r"^RUN RESULT: hbIR \(max attempted\) = [0-9]+, hbIR \(settled\) = [0-9]+, max-jOPS = (?P<max>[0-9]+), critical-jOPS = (?P<critical>[0-9]+)$", re.MULTILINE)
    #error?
    success = re.compile(r"org.spec.jbb.controller: Run finished", re.MULTILINE)
    matcherMax = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'max', 'score' : '<max>'})
    matcherCritical = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'critical', 'score' : '<critical>'})
    return Test("SPECjbb2013", ['-jar', 'specjbb2013.jar', '-m', 'composite'] + benchArgs, [success], [], [matcherCritical, matcherMax], vmOpts=['-Xmx6g', '-Xms6g', '-Xmn3g', '-XX:+UseParallelOldGC', '-XX:-UseAdaptiveSizePolicy', '-XX:-UseBiasedLocking', '-XX:-UseCompressedOops'], defaultCwd=specjbb2013)
コード例 #37
0
ファイル: sanitycheck.py プロジェクト: pombreda/graal
def getSPECjbb2005(benchArgs = []):
    
    specjbb2005 = mx.get_env('SPECJBB2005')
    if specjbb2005 is None or not exists(join(specjbb2005, 'jbb.jar')):
        mx.abort('Please set the SPECJBB2005 environment variable to a SPECjbb2005 directory')
    
    score = re.compile(r"^Valid run, Score is  (?P<score>[0-9]+)$", re.MULTILINE)
    error = re.compile(r"VALIDATION ERROR")
    success = re.compile(r"^Valid run, Score is  [0-9]+$", re.MULTILINE)
    matcher = ValuesMatcher(score, {'group' : 'SPECjbb2005', 'name' : 'score', 'score' : '<score>'})
    classpath = ['jbb.jar', 'check.jar']
    return Test("SPECjbb2005", ['spec.jbb.JBBmain', '-propfile', 'SPECjbb.props'] + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+'+gc, '-XX:-UseCompressedOops', '-cp', os.pathsep.join(classpath)], defaultCwd=specjbb2005)
コード例 #38
0
ファイル: sanitycheck.py プロジェクト: pombreda/graal
def getSPECjvm2008(benchArgs=[]):
    
    specjvm2008 = mx.get_env('SPECJVM2008')
    if specjvm2008 is None or not exists(join(specjvm2008, 'SPECjvm2008.jar')):
        mx.abort('Please set the SPECJVM2008 environment variable to a SPECjvm2008 directory')
    
    score = re.compile(r"^(Score on|Noncompliant) (?P<benchmark>[a-zA-Z0-9\._]+)( result)?: (?P<score>[0-9]+((,|\.)[0-9]+)?)( SPECjvm2008 Base)? ops/m$", re.MULTILINE)
    error = re.compile(r"^Errors in benchmark: ", re.MULTILINE)
    # The ' ops/m' at the end of the success string is important : it's how you can tell valid and invalid runs apart
    success = re.compile(r"^(Noncompliant c|C)omposite result: [0-9]+((,|\.)[0-9]+)?( SPECjvm2008 (Base|Peak))? ops/m$", re.MULTILINE)
    matcher = ValuesMatcher(score, {'group' : 'SPECjvm2008', 'name' : '<benchmark>', 'score' : '<score>'})
    
    return Test("SPECjvm2008", ['-jar', 'SPECjvm2008.jar'] + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+'+gc, '-XX:-UseCompressedOops'], defaultCwd=specjvm2008)
コード例 #39
0
ファイル: mx_benchmark.py プロジェクト: graalvm/mx
def build_number():
    """
    Get the current build number from the BUILD_NUMBER environment variable. If BUILD_NUMBER is not set or not a number,
    a default of -1 is returned.

    :return: the build number
    :rtype: int
    """
    build_num = mx.get_env("BUILD_NUMBER", default="-1")
    try:
        return int(build_num)
    except ValueError:
        mx.logv("Could not parse the build number from BUILD_NUMBER. Expected int, instead got: {0}".format(build_num))
        return -1
コード例 #40
0
def mx_register_dynamic_suite_constituents(register_project, register_distribution):
    """
    :type register_project: (mx.Project) -> None
    :type register_distribution: (mx.Distribution) -> None
    """
    if mx_sdk_vm_impl.has_component('FastR'):
        fastr_release_env = mx.get_env('FASTR_RELEASE', None)
        if fastr_release_env != 'true':
            mx.abort(('When including FastR, please set FASTR_RELEASE to \'true\' (env FASTR_RELEASE=true mx ...). Got FASTR_RELEASE={}. '
                      'For local development, you may also want to disable recommended packages build (FASTR_NO_RECOMMENDED=true) and '
                      'capturing of system libraries (export FASTR_CAPTURE_DEPENDENCIES set to an empty value). '
                      'See building.md in FastR documentation for more details.').format(fastr_release_env))
    if register_project:
        register_project(GraalVmSymlinks())
コード例 #41
0
 def specJbbClassPath(self):
     specjbb2005 = mx.get_env("SPECJBB2005")
     if specjbb2005 is None:
         mx.abort("Please set the SPECJBB2005 environment variable to a " +
             "SPECjbb2005 directory.")
     jbbpath = join(specjbb2005, "jbb.jar")
     if not exists(jbbpath):
         mx.abort("The SPECJBB2005 environment variable points to a directory " +
             "without the jbb.jar file.")
     checkpath = join(specjbb2005, "check.jar")
     if not exists(checkpath):
         mx.abort("The SPECJBB2005 environment variable points to a directory " +
             "without the check.jar file.")
     return jbbpath + ":" + checkpath
コード例 #42
0
 def specJbbClassPath(self):
     specjbb2005 = mx.get_env("SPECJBB2005")
     if specjbb2005 is None:
         mx.abort("Please set the SPECJBB2005 environment variable to a " +
             "SPECjbb2005 directory.")
     jbbpath = join(specjbb2005, "jbb.jar")
     if not exists(jbbpath):
         mx.abort("The SPECJBB2005 environment variable points to a directory " +
             "without the jbb.jar file.")
     checkpath = join(specjbb2005, "check.jar")
     if not exists(checkpath):
         mx.abort("The SPECJBB2005 environment variable points to a directory " +
             "without the check.jar file.")
     return jbbpath + ":" + checkpath
コード例 #43
0
def getDacapo(name, n, dacapoArgs=[]):
    dacapo = mx.get_env('DACAPO_CP')
    if dacapo is None:
        l = mx.library('DACAPO', False)
        if l is not None:
            dacapo = l.get_path(True)
        else:
            mx.abort(
                'DaCapo 9.12 jar file must be specified with DACAPO_CP environment variable or as DACAPO library'
            )

    if not isfile(dacapo) or not dacapo.endswith('.jar'):
        mx.abort(
            'Specified DaCapo jar file does not exist or is not a jar file: ' +
            dacapo)

    dacapoSuccess = re.compile(
        r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====$",
        re.MULTILINE)
    dacapoFail = re.compile(
        r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) FAILED (warmup|) =====$",
        re.MULTILINE)
    dacapoTime = re.compile(
        r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec ====="
    )
    dacapoTime1 = re.compile(
        r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) completed warmup 1 in (?P<time>[0-9]+) msec ====="
    )

    dacapoMatcher = ValuesMatcher(dacapoTime, {
        'group': 'DaCapo',
        'name': '<benchmark>',
        'score': '<time>'
    })
    dacapoMatcher1 = ValuesMatcher(dacapoTime1, {
        'group': 'DaCapo-1stRun',
        'name': '<benchmark>',
        'score': '<time>'
    })

    return Test("DaCapo-" + name, [
        '-jar',
        dacapo,
        name,
        '-n',
        str(n),
    ] + dacapoArgs, [dacapoSuccess], [dacapoFail],
                [dacapoMatcher, dacapoMatcher1],
                ['-Xms2g', '-XX:+' + gc, '-XX:-UseCompressedOops'])
コード例 #44
0
def testgraal(args):
    cloneFrom = mx.get_env("GRAAL_URL")
    if not cloneFrom:
        cloneFrom = "http://github.com/graalvm/graal-core"
    graalSuiteSubDir = mx.get_env("GRAAL_SUITE_SUBDIR")

    suite = mx.suite('truffle')
    suiteDir = suite.dir
    workDir = join(suite.get_output_root(), 'sanitycheck')
    mx.ensure_dir_exists(join(workDir, suite.name))
    for f in os.listdir(suiteDir):
        subDir = os.path.join(suiteDir, f)
        if subDir == suite.get_output_root():
            continue
        src = join(suiteDir, f)
        tgt = join(workDir, suite.name, f)
        if isdir(src):
            if exists(tgt):
                shutil.rmtree(tgt)
            shutil.copytree(src, tgt)
        else:
            shutil.copy(src, tgt)

    sanityDir = join(workDir, 'sanity')
    git = mx.GitConfig()
    if exists(sanityDir):
        git.pull(sanityDir)
    else:
        git.clone(cloneFrom, sanityDir)

    sanitySuiteDir = sanityDir if graalSuiteSubDir is None else join(
        sanityDir, graalSuiteSubDir)
    return mx.run_mx([
        '-v', '--java-home=' + mx.get_jdk().home, 'gate',
        '-B--force-deprecation-as-warning', '--tags', 'build,test'
    ], sanitySuiteDir)
コード例 #45
0
ファイル: sanitycheck.py プロジェクト: woess/graal-core
def getDacapo(name, dacapoArgs=None, extraVmArguments=None):
    dacapo = mx.get_env('DACAPO_CP')
    if dacapo is None:
        l = mx.library('DACAPO', False)
        if l is not None:
            dacapo = l.get_path(True)
        else:
            mx.abort(
                'DaCapo 9.12 jar file must be specified with DACAPO_CP environment variable or as DACAPO library'
            )

    if not isfile(dacapo) or not dacapo.endswith('.jar'):
        mx.abort(
            'Specified DaCapo jar file does not exist or is not a jar file: ' +
            dacapo)

    dacapoSuccess = re.compile(
        r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====",
        re.MULTILINE)
    dacapoFail = re.compile(
        r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) FAILED (warmup|) =====",
        re.MULTILINE)
    dacapoTime = re.compile(
        r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec ====="
    )
    dacapoTime1 = re.compile(
        r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) completed warmup 1 in (?P<time>[0-9]+) msec ====="
    )

    dacapoMatcher = ValuesMatcher(dacapoTime, {
        'group': 'DaCapo',
        'name': '<benchmark>',
        'score': '<time>'
    })
    dacapoMatcher1 = ValuesMatcher(dacapoTime1, {
        'group': 'DaCapo-1stRun',
        'name': '<benchmark>',
        'score': '<time>'
    })

    # Use ipv4 stack for dacapos; tomcat+solaris+ipv6_interface fails (see also: JDK-8072384)
    return Test("DaCapo-" + name,
                ['-jar', mx._cygpathU2W(dacapo), name] +
                _noneAsEmptyList(dacapoArgs), [dacapoSuccess], [dacapoFail],
                [dacapoMatcher, dacapoMatcher1], [
                    '-Xms2g', '-XX:+' + gc, '-XX:-UseCompressedOops',
                    "-Djava.net.preferIPv4Stack=true", '-G:+ExitVMOnException'
                ] + _noneAsEmptyList(extraVmArguments))
コード例 #46
0
def _getJdkHome():
    global _jdkHome
    if not _jdkHome:
        if mx.suite('compiler', fatalIfMissing=False):
            import mx_compiler
            if hasattr(mx_compiler, 'get_graaljdk'):
                _jdkHome = mx_compiler.get_graaljdk().home
            elif hasattr(mx_compiler, '_update_graaljdk'):
                jdk = mx.get_jdk(tag='default')
                _jdkHome, _ = mx_compiler._update_graaljdk(jdk)
            else:
                mx.abort(
                    'Cannot find a GraalJDK.\nAre you running with an old version of Graal?'
                )
        else:
            _jdkHome = mx.get_env('JAVA_HOME')
    return _jdkHome
コード例 #47
0
ファイル: mx_findbugs.py プロジェクト: graalvm/mx
def findbugs(args, fbArgs=None, suite=None, projects=None):
    """run FindBugs against non-test Java projects"""
    findBugsHome = mx.get_env('FINDBUGS_HOME', None)
    if suite is None:
        suite = mx._primary_suite
    if findBugsHome:
        findbugsJar = join(findBugsHome, 'lib', 'findbugs.jar')
    else:
        findbugsLib = join(mx._mx_suite.get_output_root(), 'findbugs-3.0.0')
        if not exists(findbugsLib):
            tmp = tempfile.mkdtemp(prefix='findbugs-download-tmp', dir=mx._mx_suite.dir)
            try:
                findbugsDist = mx.library('FINDBUGS_DIST').get_path(resolve=True)
                with zipfile.ZipFile(findbugsDist) as zf:
                    candidates = [e for e in zf.namelist() if e.endswith('/lib/findbugs.jar')]
                    assert len(candidates) == 1, candidates
                    libDirInZip = os.path.dirname(candidates[0])
                    zf.extractall(tmp)
                shutil.copytree(join(tmp, libDirInZip), findbugsLib)
            finally:
                shutil.rmtree(tmp)
        findbugsJar = join(findbugsLib, 'findbugs.jar')
    assert exists(findbugsJar)
    nonTestProjects = [p for p in mx.projects() if _should_test_project(p)]
    if not nonTestProjects:
        return 0
    outputDirs = map(mx._cygpathU2W, [p.output_dir() for p in nonTestProjects])
    javaCompliance = max([p.javaCompliance for p in nonTestProjects])
    jdk = mx.get_jdk(javaCompliance)
    if jdk.javaCompliance >= "1.9":
        mx.log('FindBugs does not yet support JDK9 - skipping')
        return 0

    findbugsResults = join(suite.dir, 'findbugs.results')

    if fbArgs is None:
        fbArgs = defaultFindbugsArgs()
    cmd = ['-jar', mx._cygpathU2W(findbugsJar)] + fbArgs
    cmd = cmd + ['-auxclasspath', mx._separatedCygpathU2W(mx.classpath([p.name for p in nonTestProjects], jdk=jdk)), '-output', mx._cygpathU2W(findbugsResults), '-exitcode'] + args + outputDirs
    exitcode = mx.run_java(cmd, nonZeroIsFatal=False, jdk=jdk)
    if exitcode != 0:
        with open(findbugsResults) as fp:
            mx.log(fp.read())
    os.unlink(findbugsResults)
    return exitcode
コード例 #48
0
ファイル: mx_sulong.py プロジェクト: Prototype1/sulong
def travis1(args=None):
    tasks = []
    with Task('BuildJavaWithEcj', tasks) as t:
        if t:
            if mx.get_env('JDT'):
                mx.command_function('build')(['-p', '--no-native', '--warning-as-error'])
                gate_clean([], tasks, name='CleanAfterEcjBuild')
            else:
                mx._warn_or_abort('JDT environment variable not set. Cannot execute BuildJavaWithEcj task.', args.strict_mode)
    with Task('BuildJavaWithJavac', tasks) as t:
        if t: mx.command_function('build')(['-p', '--warning-as-error', '--no-native', '--force-javac'])
    with Task('BuildHotSpotGraalServer: product', tasks) as t:
        if t: buildvms(['-c', '--vms', 'server', '--builds', 'product'])
    with VM('server', 'product'):
        with Task('Findbugs', tasks) as t:
            if t and mx_findbugs.findbugs([]) != 0:
                t.abort('FindBugs warnings were found')
    with VM('server', 'product'):
        with Task('TestBenchmarks', tasks) as t:
            if t: runBenchmarkTestCases()
    with VM('server', 'product'):
        with Task('TestPolglot', tasks) as t:
            if t: runPolyglotTestCases()
    with VM('server', 'product'):
        with Task('TestInterop', tasks) as t:
            if t: runInteropTestCases()
    with VM('server', 'product'):
        with Task('TestAsm', tasks) as t:
            if t: runAsmTestCases()
    with VM('server', 'product'):
        with Task('TestTypes', tasks) as t:
            if t: runTypeTestCases()
    with VM('server', 'product'):
        with Task('TestSulong', tasks) as t:
            if t: runTruffleTestCases()
    with VM('server', 'product'):
        with Task('TestLLVM', tasks) as t:
            if t: runLLVMTestCases()
    with VM('server', 'product'):
        with Task('TestNWCC', tasks) as t:
            if t: runNWCCTestCases()
    with VM('server', 'product'):
        with Task('TestGCCSuiteCompile', tasks) as t:
            if t: runCompileTestCases()
コード例 #49
0
def hsdis(args, copyToDir=None):
    """download the hsdis library

    This is needed to support HotSpot's assembly dumping features.
    By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax."""
    flavor = None
    if mx.get_arch() == "amd64":
        flavor = mx.get_env('HSDIS_SYNTAX')
        if flavor is None:
            flavor = 'intel'
        if 'att' in args:
            flavor = 'att'

    libpattern = mx.add_lib_suffix('hsdis-' + mx.get_arch() + '-' + mx.get_os() + '-%s')

    sha1s = {
        'att/hsdis-amd64-windows-%s.dll' : 'bcbd535a9568b5075ab41e96205e26a2bac64f72',
        'att/hsdis-amd64-linux-%s.so' : '36a0b8e30fc370727920cc089f104bfb9cd508a0',
        'att/hsdis-amd64-darwin-%s.dylib' : 'c1865e9a58ca773fdc1c5eea0a4dfda213420ffb',
        'intel/hsdis-amd64-windows-%s.dll' : '6a388372cdd5fe905c1a26ced614334e405d1f30',
        'intel/hsdis-amd64-linux-%s.so' : '0d031013db9a80d6c88330c42c983fbfa7053193',
        'intel/hsdis-amd64-darwin-%s.dylib' : '67f6d23cbebd8998450a88b5bef362171f66f11a',
        'hsdis-sparcv9-solaris-%s.so': '970640a9af0bd63641f9063c11275b371a59ee60',
        'hsdis-sparcv9-linux-%s.so': '0c375986d727651dee1819308fbbc0de4927d5d9',
    }

    if flavor:
        flavoredLib = flavor + "/" + libpattern
    else:
        flavoredLib = libpattern
    if flavoredLib not in sha1s:
        mx.warn("hsdis with flavor '{}' not supported on this plattform or architecture".format(flavor))
        return

    sha1 = sha1s[flavoredLib]
    lib = flavoredLib % (sha1)
    path = join(_suite.get_output_root(), lib)
    if not exists(path):
        sha1path = path + '.sha1'
        mx.download_file_with_sha1('hsdis', path, ['https://lafo.ssw.uni-linz.ac.at/pub/hsdis/' + lib], sha1, sha1path, True, True, sources=False)
    if copyToDir is not None and exists(copyToDir):
        destFileName = mx.add_lib_suffix('hsdis-' + mx.get_arch())
        mx.logv('Copying {} to {}'.format(path, copyToDir + os.sep + destFileName))
        shutil.copy(path, copyToDir + os.sep + destFileName)
コード例 #50
0
    def __init__(self,
                 suite,
                 name,
                 deps,
                 workingSets,
                 subDir,
                 buildRef=True,
                 buildSharedObject=False,
                 bundledLLVMOnly=False,
                 ninja_install_targets=None,
                 max_jobs=8,
                 cmakeConfigVariant=None,
                 **args):

        if bundledLLVMOnly and mx.get_env('CLANG_CC', None):
            self.ignore = "Environment variable 'CLANG_CC' is set but project specifies 'bundledLLVMOnly'"
        if 'buildDependencies' not in args:
            args['buildDependencies'] = []
        if 'sdk:LLVM_TOOLCHAIN' not in args['buildDependencies']:
            args['buildDependencies'].append('sdk:LLVM_TOOLCHAIN')
        self.buildRef = buildRef
        self.buildSharedObject = buildSharedObject
        self.current_variant = None
        self.cmake_config_variant = cmakeConfigVariant or {}
        super(SulongCMakeTestSuite,
              self).__init__(suite,
                             name,
                             deps,
                             workingSets,
                             subDir,
                             ninja_install_targets=ninja_install_targets
                             or ["install"],
                             max_jobs=max_jobs,
                             **args)
        self._install_dir = mx.join(self.out_dir, "result")
        # self._ninja_targets = self.getResults()
        _config = self._cmake_config_raw
        _module_path = mx.Suite._pop_list(_config, 'CMAKE_MODULE_PATH', self)
        _module_path.append('<path:com.oracle.truffle.llvm.tests.cmake>')
        _config['CMAKE_MODULE_PATH'] = ';'.join(_module_path)
        _config[
            'SULONG_MODULE_PATH'] = '<path:com.oracle.truffle.llvm.tests.cmake>'
        self._init_cmake = False
コード例 #51
0
ファイル: sanitycheck.py プロジェクト: pombreda/graal
def getScalaDacapo(name, dacapoArgs=[]):
    dacapo = mx.get_env('DACAPO_SCALA_CP')
    if dacapo is None:
        l = mx.library('DACAPO_SCALA', False)
        if l is not None:
            dacapo = l.get_path(True)
        else:
            mx.abort('Scala DaCapo 0.1.0 jar file must be specified with DACAPO_SCALA_CP environment variable or as DACAPO_SCALA library')
    
    if not isfile(dacapo) or not dacapo.endswith('.jar'):
        mx.abort('Specified Scala DaCapo jar file does not exist or is not a jar file: ' + dacapo)
    
    dacapoSuccess = re.compile(r"^===== DaCapo 0\.1\.0(-SNAPSHOT)? ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====$", re.MULTILINE)
    dacapoFail = re.compile(r"^===== DaCapo 0\.1\.0(-SNAPSHOT)? ([a-zA-Z0-9_]+) FAILED (warmup|) =====$", re.MULTILINE)
    dacapoTime = re.compile(r"===== DaCapo 0\.1\.0(-SNAPSHOT)? (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec =====")
    
    dacapoMatcher = ValuesMatcher(dacapoTime, {'group' : "Scala-DaCapo", 'name' : '<benchmark>', 'score' : '<time>'})
    
    return Test("Scala-DaCapo-" + name, ['-jar', dacapo, name] + dacapoArgs, [dacapoSuccess], [dacapoFail], [dacapoMatcher], ['-Xms2g', '-XX:+'+gc, '-XX:-UseCompressedOops'])
コード例 #52
0
ファイル: mx_jackpot.py プロジェクト: charig/mx
def jackpot(args, suite=None, nonZeroIsFatal=False):
    """run Jackpot 3.0 against non-test Java projects"""
    jackpotHome = mx.get_env('JACKPOT_HOME', None)
    if jackpotHome:
        jackpotJar = join(jackpotHome, 'jackpot.jar')
    else:
        jackpotJar = mx.library('JACKPOT').get_path(resolve=True)
    assert exists(jackpotJar)
    if suite is None:
        suite = mx._primary_suite
    nonTestProjects = [p for p in mx.projects() if _should_test_project(p)]
    if not nonTestProjects:
        return 0
    groups = []
    for p in nonTestProjects:
        javacClasspath = []

        deps = []
        p.walk_deps(visit=lambda dep, edge: deps.append(dep) if dep.isLibrary() or dep.isJavaProject() else None)
        annotationProcessorOnlyDeps = []
        if len(p.annotation_processors()) > 0:
            for apDep in p.annotation_processors():
                if not apDep in deps:
                    deps.append(apDep)
                    annotationProcessorOnlyDeps.append(apDep)

        for dep in deps:
            if dep == p:
                continue

            if dep in annotationProcessorOnlyDeps:
                continue

            javacClasspath.append(dep.classpath_repr(resolve=True))

        javaCompliance = p.javaCompliance

        groups = groups + ['--group', "--classpath " + mx._separatedCygpathU2W(_escape_string(os.pathsep.join(javacClasspath))) + " --source " + str(p.javaCompliance) + " " + " ".join([_escape_string(d) for d in p.source_dirs()])]

    cmd = ['-classpath', mx._cygpathU2W(jackpotJar), 'org.netbeans.modules.jackpot30.cmdline.Main']
    cmd = cmd + ['--fail-on-warnings', '--progress'] + args + groups

    return mx.run_java(cmd, nonZeroIsFatal=nonZeroIsFatal, jdk=mx.get_jdk(javaCompliance))
コード例 #53
0
    def run(self, cwd, args):
        jar = mx.get_env(ENV_JYTHON_JAR)
        if jar:
            _check_vm_args(self.name(), args)
            host_vm = self.host_vm()

            vm_args = mx.get_runtime_jvm_args([])
            vm_args += ["-jar", jar]
            for a in args[:]:
                if a.startswith("-D") or a.startswith("-XX"):
                    vm_args.insert(0, a)
                    args.remove(a)
            args = self._override_iterations_args(args)
            cmd = vm_args + args

            if not self._env:
                self._env = dict()
            with environ(self._env):
                return host_vm.run(cwd, cmd)
        else:
            return AbstractPythonIterationsControlVm.run(self, cwd, args)
コード例 #54
0
ファイル: sanitycheck.py プロジェクト: dain/graal
def getDacapo(name, dacapoArgs=None):
    dacapo = mx.get_env('DACAPO_CP')
    if dacapo is None:
        l = mx.library('DACAPO', False)
        if l is not None:
            dacapo = l.get_path(True)
        else:
            mx.abort('DaCapo 9.12 jar file must be specified with DACAPO_CP environment variable or as DACAPO library')

    if not isfile(dacapo) or not dacapo.endswith('.jar'):
        mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo)

    dacapoSuccess = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====$", re.MULTILINE)
    dacapoFail = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) FAILED (warmup|) =====$", re.MULTILINE)
    dacapoTime = re.compile(r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec =====")
    dacapoTime1 = re.compile(r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) completed warmup 1 in (?P<time>[0-9]+) msec =====")

    dacapoMatcher = ValuesMatcher(dacapoTime, {'group' : 'DaCapo', 'name' : '<benchmark>', 'score' : '<time>'})
    dacapoMatcher1 = ValuesMatcher(dacapoTime1, {'group' : 'DaCapo-1stRun', 'name' : '<benchmark>', 'score' : '<time>'})

    return Test("DaCapo-" + name, ['-jar', dacapo, name] + _noneAsEmptyList(dacapoArgs), [dacapoSuccess], [dacapoFail], [dacapoMatcher, dacapoMatcher1], ['-Xms2g', '-XX:+' + gc, '-XX:-UseCompressedOops'])
コード例 #55
0
ファイル: mx_benchmark.py プロジェクト: christhalinger/mx
 def buildNumber(self):
     build_num = mx.get_env("BUILD_NUMBER", default="")
     if not build_num:
         return -1
     return int(build_num)
コード例 #56
0
 def renaissancePath(self):
     renaissance = mx.get_env("RENAISSANCE")
     if renaissance:
         return join(renaissance, "jars")
     return None
コード例 #57
0
ファイル: mx_benchmark.py プロジェクト: christhalinger/mx
 def machineName(self, mxBenchmarkArgs):
     if mxBenchmarkArgs.machine_name:
         return mxBenchmarkArgs.machine_name
     return mx.get_env("MACHINE_NAME", default="")
コード例 #58
0
ファイル: mx_gate.py プロジェクト: christianwimmer/mx
def gate(args):
    """run the tests used to validate a push

    If this command exits with a 0 exit code, then the gate passed."""

    parser = ArgumentParser(prog='mx gate')
    add_omit_clean_args(parser)
    parser.add_argument('--all-suites', action='store_true', help='run gate tasks for all suites, not just the primary suite')
    parser.add_argument('--dry-run', action='store_true', help='just show the tasks that will be run without running them')
    parser.add_argument('-x', action='store_true', help='makes --task-filter an exclusion instead of inclusion filter')
    parser.add_argument('--jacocout', help='specify the output directory for jacoco report')
    parser.add_argument('--strict-mode', action='store_true', help='abort if a task cannot be executed due to missing tool configuration')
    filtering = parser.add_mutually_exclusive_group()
    filtering.add_argument('-t', '--task-filter', help='comma separated list of substrings to select subset of tasks to be run')
    filtering.add_argument('-s', '--start-at', help='substring to select starting task')
    for a, k in _extra_gate_arguments:
        parser.add_argument(*a, **k)

    args = parser.parse_args(args)
    cleanArgs = check_gate_noclean_arg(args)

    global _jacoco
    if args.dry_run:
        Task.dryRun = True
    if args.start_at:
        Task.startAtFilter = args.start_at
    elif args.task_filter:
        Task.filters = args.task_filter.split(',')
        Task.filtersExclude = args.x
    elif args.x:
        mx.abort('-x option cannot be used without --task-filter option')

    tasks = []
    total = Task('Gate')
    try:
        with Task('Versions', tasks) as t:
            if t:
                mx.command_function('version')(['--oneline'])
                mx.command_function('sversions')([])

        with Task('JDKReleaseInfo', tasks) as t:
            if t:
                jdkDirs = os.pathsep.join([mx.get_env('JAVA_HOME', ''), mx.get_env('EXTRA_JAVA_HOMES', '')])
                for jdkDir in jdkDirs.split(os.pathsep):
                    release = join(jdkDir, 'release')
                    if exists(release):
                        mx.log('==== ' + jdkDir + ' ====')
                        with open(release) as fp:
                            mx.log(fp.read().strip())

        with Task('Pylint', tasks) as t:
            if t:
                if mx.command_function('pylint')(['--primary']) != 0:
                    _warn_or_abort('Pylint not configured correctly. Cannot execute Pylint task.', args.strict_mode)

        gate_clean(cleanArgs, tasks)

        with Task('Distribution Overlap Check', tasks) as t:
            if t:
                if mx.command_function('checkoverlap')([]) != 0:
                    t.abort('Found overlapping distributions.')

        with Task('Canonicalization Check', tasks) as t:
            if t:
                mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...'))
                if mx.command_function('canonicalizeprojects')([]) != 0:
                    t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/suite*.py files.')

        with Task('BuildJavaWithEcj', tasks) as t:
            if t:
                if mx.get_env('JDT'):
                    mx.command_function('build')(['-p', '--no-native', '--warning-as-error'])
                    gate_clean(cleanArgs, tasks, name='CleanAfterEcjBuild')
                else:
                    _warn_or_abort('JDT environment variable not set. Cannot execute BuildJavaWithEcj task.', args.strict_mode)

        with Task('BuildJavaWithJavac', tasks) as t:
            if t: mx.command_function('build')(['-p', '--warning-as-error', '--no-native', '--force-javac'])

        with Task('IDEConfigCheck', tasks) as t:
            if t:
                if args.cleanIDE:
                    mx.command_function('ideclean')([])
                    mx.command_function('ideinit')([])

        with Task('CodeFormatCheck', tasks) as t:
            if t:
                eclipse_exe = mx.get_env('ECLIPSE_EXE')
                if eclipse_exe is not None:
                    if mx.command_function('eclipseformat')(['-e', eclipse_exe, '--primary']) != 0:
                        t.abort('Formatter modified files - run "mx eclipseformat", check in changes and repush')
                else:
                    _warn_or_abort('ECLIPSE_EXE environment variable not set. Cannot execute CodeFormatCheck task.', args.strict_mode)

        with Task('Checkstyle', tasks) as t:
            if t and mx.command_function('checkstyle')(['--primary']) != 0:
                t.abort('Checkstyle warnings were found')

        with Task('Checkheaders', tasks) as t:
            if t and mx.command_function('checkheaders')([]) != 0:
                t.abort('Checkheaders warnings were found')

        with Task('FindBugs', tasks) as t:
            if t and mx.command_function('findbugs')([]) != 0:
                t.abort('FindBugs warnings were found')

        if exists('jacoco.exec'):
            os.unlink('jacoco.exec')

        if args.jacocout is not None:
            _jacoco = 'append'
        else:
            _jacoco = 'off'

        for suiteRunner in _gate_runners:
            suite, runner = suiteRunner
            if args.all_suites or suite is mx.primary_suite():
                runner(args, tasks)

        if args.jacocout is not None:
            mx.command_function('jacocoreport')([args.jacocout])
            _jacoco = 'off'

    except KeyboardInterrupt:
        total.abort(1)

    except BaseException as e:
        import traceback
        traceback.print_exc()
        total.abort(str(e))

    total.stop()

    mx.log('Gate task times:')
    for t in tasks:
        mx.log('  ' + str(t.duration) + '\t' + t.title)
    mx.log('  =======')
    mx.log('  ' + str(total.duration))

    if args.task_filter:
        Task.filters = None
コード例 #59
0
 def workingDirectory(self, benchmarks, bmSuiteArgs):
     return mx.get_env("SPECJBB2015")
コード例 #60
0
ファイル: mx_benchmark.py プロジェクト: christhalinger/mx
 def buildUrl(self):
     return mx.get_env("BUILD_URL", default="")