本文整理汇总了Python中mx.get_jdk函数的典型用法代码示例。如果您正苦于以下问题:Python get_jdk函数的具体用法?Python get_jdk怎么用?Python get_jdk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_jdk函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run_java
def run_java(self, args, out=None, err=None, cwd=None, nonZeroIsFatal=False):
tag = mx.get_jdk_option().tag
if tag and tag != mx_graal_core._JVMCI_JDK_TAG:
mx.abort("The '{0}/{1}' VM requires '--jdk={2}'".format(
self.name(), self.config_name(), mx_graal_core._JVMCI_JDK_TAG))
mx.get_jdk(tag=mx_graal_core._JVMCI_JDK_TAG).run_java(
args, out=out, err=out, cwd=cwd, nonZeroIsFatal=False)
开发者ID:gilles-duboscq,项目名称:graal-core,代码行数:7,代码来源:mx_graal_benchmark.py
示例2: jdkartifactstats
def jdkartifactstats(args):
"""show stats about JDK deployed Graal artifacts"""
artifacts = {}
jdkDir = get_jvmci_jdk().home
def _getDeployedJars():
if JVMCI_VERSION < 9:
for root, _, filenames in os.walk(join(jdkDir, 'jre', 'lib')):
for f in filenames:
if f.endswith('.jar') and not f.endswith('.stripped.jar'):
yield join(root, f)
else:
for jdkDist in jdkDeployedDists:
dist = jdkDist.dist()
if isinstance(jdkDist, JvmciJDKDeployedDist):
yield dist.path
for jar in _getDeployedJars():
f = basename(jar)
if 'truffle' in f:
if 'enterprise' in f:
artifacts.setdefault('GraalEnterpriseTruffle', []).append(jar)
else:
artifacts.setdefault('GraalTruffle', []).append(jar)
elif 'enterprise' in f:
artifacts.setdefault('GraalEnterprise', []).append(jar)
elif 'jvmci' in f:
artifacts.setdefault('JVMCI', []).append(jar)
elif 'graal' in f:
artifacts.setdefault('Graal', []).append(jar)
else:
mx.logv('ignored: ' + jar)
print '{:>10} {:>10} {:>10} {}'.format('All', 'NoVars', 'None', 'Jar')
for category in sorted(artifacts.viewkeys()):
jars = artifacts[category]
if jars:
totals = (0, 0, 0)
print
for j in jars:
gSize = os.path.getsize(j)
stripped = j[:-len('.jar')] + '.stripped.jar'
mx.run([mx.get_jdk().pack200, '--repack', '--quiet', '-J-Djava.util.logging.config.file=', '-DLocalVariableTypeTable=strip', '-DLocalVariableTable=strip', stripped, j])
gLinesSourceSize = os.path.getsize(stripped)
mx.run([mx.get_jdk().pack200, '--repack', '--quiet', '-J-Djava.util.logging.config.file=', '-G', stripped, j])
gNoneSize = os.path.getsize(stripped)
os.remove(stripped)
print '{:10,} {:10,} {:10,} {}:{}'.format(gSize, gLinesSourceSize, gNoneSize, category, basename(j))
t1, t2, t3 = totals
totals = (t1 + gSize, t2 + gLinesSourceSize, t3 + gNoneSize)
t1, t2, t3 = totals
print '{:10,} {:10,} {:10,} {}'.format(t1, t2, t3, category)
jvmLib = join(jdkDir, relativeVmLibDirInJdk(), get_vm(), mx.add_lib_suffix(mx.add_lib_prefix('jvm')))
print
if exists(jvmLib):
print '{:10,} {}'.format(os.path.getsize(jvmLib), jvmLib)
else:
print '{:>10} {}'.format('<missing>', jvmLib)
开发者ID:axel22,项目名称:graal-core,代码行数:58,代码来源:mx_graal_8.py
示例3: _sigtest_check
def _sigtest_check(checktype, args, suite=None, projects=None):
"""run sigtest against Java projects with API"""
sigtestlib = mx.library('SIGTEST').get_path(resolve=True)
nonTestProjects = [p for p in mx.projects() if _should_test_project(p)]
if not nonTestProjects:
return 1
javaCompliance = max([p.javaCompliance for p in nonTestProjects])
class OutputCapture:
def __init__(self):
self.data = ""
def __call__(self, data):
self.data += data
failed = None
for p in nonTestProjects:
sigtestResults = p.dir + os.sep + 'snapshot.sigtest'
if not os.path.exists(sigtestResults):
continue
jdk = mx.get_jdk(javaCompliance)
cmd = ['-cp', mx._cygpathU2W(sigtestlib), 'com.sun.tdk.signaturetest.SignatureTest',
'-Static', '-Mode', 'bin', '-FileName', sigtestResults,
'-ClassPath', mx.classpath(p, jdk=jdk) + os.pathsep + jdk.bootclasspath(),
]
if checktype != 'all':
cmd.append('-b')
for pkg in mx._find_packages(p):
cmd = cmd + ['-PackageWithoutSubpackages', pkg]
out = OutputCapture()
print 'Checking ' + checktype + ' signature changes against ' + sigtestResults
exitcode = mx.run_java(cmd, nonZeroIsFatal=False, jdk=mx.get_jdk(javaCompliance), out=out, err=out)
mx.ensure_dir_exists(p.get_output_root())
with open(p.get_output_root() + os.path.sep + 'sigtest-junit.xml', 'w') as f:
f.write('<?xml version="1.0" encoding="UTF-8" ?>\n')
f.write('<testsuite tests="1" name="' + p.name + '.sigtest.' + checktype + '">\n')
f.write('<testcase classname="' + p.name + '" name="sigtest.' + checktype + '">\n')
if exitcode != 95:
print out.data
failed = sigtestResults
f.write('<failure type="SignatureCheck"><![CDATA[\n')
f.write(out.data)
f.write(']]></failure>')
else:
f.write('<system-err><![CDATA[\n')
f.write(out.data)
f.write(']]></system-err>')
f.write('</testcase>\n')
f.write('</testsuite>\n')
if failed:
mx.abort('Signature error in ' + failed)
else:
print 'OK.'
return 0
开发者ID:charig,项目名称:mx,代码行数:52,代码来源:mx_sigtest.py
示例4: testgen
def testgen(args):
'''generate the expected output for unit tests, and All/Failing test classes'''
parser = ArgumentParser(prog='r testgen')
parser.add_argument('--tests', action='store', default=_all_unit_tests(), help='pattern to match test classes')
args = parser.parse_args(args)
# check we are in the home directory
if os.getcwd() != _fastr_suite.dir:
mx.abort('must run rtestgen from FastR home directory')
# check the version of GnuR against FastR
try:
fastr_version = subprocess.check_output([mx.get_jdk().java, '-cp', mx.classpath('com.oracle.truffle.r.runtime'), 'com.oracle.truffle.r.runtime.RVersionNumber'])
gnur_version = subprocess.check_output(['R', '--version'])
if not gnur_version.startswith(fastr_version):
mx.abort('R version is incompatible with FastR, please update to ' + fastr_version)
except subprocess.CalledProcessError:
mx.abort('RVersionNumber.main failed')
# clean the test project to invoke the test analyzer AP
testOnly = ['--projects', 'com.oracle.truffle.r.test']
mx.clean(['--no-dist', ] + testOnly)
mx.build(testOnly)
# now just invoke junit with the appropriate options
mx.log("generating expected output for packages: ")
for pkg in args.tests.split(','):
mx.log(" " + str(pkg))
junit(['--tests', args.tests, '--gen-expected-output', '--gen-expected-quiet'])
开发者ID:chumer,项目名称:fastr,代码行数:25,代码来源:mx_fastr.py
示例5: _runmake
def _runmake(args):
"""run the JDK make process
To build hotspot and import it into the JDK: "mx make hotspot import-hotspot"
{0}"""
jdkBuildDir = _get_jdk_build_dir()
if not exists(jdkBuildDir):
# JDK9 must be bootstrapped with a JDK8
compliance = mx.JavaCompliance('8')
jdk8 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value)
cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers', '--with-jvm-features=graal',
'--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home, '--with-jvm-features=graal']
mx.run(cmd, cwd=_jdkSourceRoot)
cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel]
if mx.get_opts().verbose:
cmd.append('LOG=debug')
cmd.extend(args)
if mx.get_opts().use_jdk_image and 'images' not in args:
cmd.append('images')
if not mx.get_opts().verbose:
mx.log('--------------- make execution ----------------------')
mx.log('Working directory: ' + _jdkSourceRoot)
mx.log('Command line: ' + ' '.join(cmd))
mx.log('-----------------------------------------------------')
mx.run(cmd, cwd=_jdkSourceRoot)
开发者ID:mearvk,项目名称:JVM,代码行数:28,代码来源:mx_jvmci.py
示例6: _tck
def _tck(args):
"""runs TCK tests"""
parser = ArgumentParser(prog="mx tck", description="run the TCK tests", formatter_class=RawDescriptionHelpFormatter, epilog=_debuggertestHelpSuffix)
parser.add_argument("--tck-configuration", help="TCK configuration", choices=["compile", "debugger", "default"], default="default")
parsed_args, args = parser.parse_known_args(args)
tckConfiguration = parsed_args.tck_configuration
index = len(args)
for arg in reversed(args):
if arg.startswith("-"):
break
index = index - 1
args_no_tests = args[0:index]
tests = args[index:len(args)]
if len(tests) == 0:
tests = ["com.oracle.truffle.tck.tests"]
index = len(args_no_tests)
for arg in reversed(args_no_tests):
if arg.startswith("--"):
break
index = index - 1
unitTestOptions = args_no_tests[0:max(index-1, 0)]
jvmOptions = args_no_tests[index:len(args_no_tests)]
if tckConfiguration == "default":
unittest(unitTestOptions + ["--"] + jvmOptions + tests)
elif tckConfiguration == "debugger":
with mx.SafeFileCreation(os.path.join(tempfile.gettempdir(), "debugalot")) as sfc:
_execute_debugger_test(tests, sfc.tmpPath, False, unitTestOptions, jvmOptions)
elif tckConfiguration == "compile":
if not _is_graalvm(mx.get_jdk()):
mx.abort("The 'compile' TCK configuration requires graalvm execution, run with --java-home=<path_to_graalvm>.")
unittest(unitTestOptions + ["--"] + jvmOptions + ["-Dgraal.TruffleCompileImmediately=true", "-Dgraal.TruffleCompilationExceptionsAreThrown=true"] + tests)
开发者ID:charig,项目名称:truffle,代码行数:32,代码来源:mx_truffle.py
示例7: testgraal
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)
开发者ID:graalvm,项目名称:truffle,代码行数:32,代码来源:mx_graaltest.py
示例8: run_r
def run_r(args, command, parser=None, extraVmArgs=None, jdk=None, nonZeroIsFatal=True):
'''
Common function for running either R, Rscript (or rrepl).
args are a list of strings that came after 'command' on the command line
'''
parser = parser if parser is not None else ArgumentParser(prog='mx ' + command)
parser.add_argument('--J', dest='extraVmArgsList', action='append', help='extra Java VM arguments', metavar='@<args>')
parser.add_argument('--jdk', action='store', help='jdk to use')
ns, rargs = parser.parse_known_args(args)
if ns.extraVmArgsList:
j_extraVmArgsList = mx.split_j_args(ns.extraVmArgsList)
if extraVmArgs is None:
extraVmArgs = []
extraVmArgs += j_extraVmArgsList
if not jdk and ns.jdk:
jdk = mx.get_jdk(tag=ns.jdk)
# special cases normally handled in shell script startup
if command == 'r' and len(rargs) > 0:
if rargs[0] == 'RHOME':
print _fastr_suite.dir
sys.exit(0)
elif rargs[0] == 'CMD':
print 'CMD not implemented via mx, use: bin/R CMD ...'
sys.exit(1)
return do_run_r(rargs, command, extraVmArgs=extraVmArgs, jdk=jdk, nonZeroIsFatal=nonZeroIsFatal)
开发者ID:anukat2015,项目名称:fastr,代码行数:29,代码来源:mx_fastr.py
示例9: _path_args
def _path_args(depNames=None):
"""
Gets the VM args for putting the dependencies named in `depNames` on the
class path and module path (if running on JDK9 or later).
:param names: a Dependency, str or list containing Dependency/str objects. If None,
then all registered dependencies are used.
"""
jdk = mx.get_jdk()
if jdk.javaCompliance >= '1.9':
modules = [as_java_module(dist, jdk) for dist in _suite.dists if get_java_module_info(dist)]
if modules:
# Partition resources between the class path and module path
modulepath = []
classpath = []
cpEntryToModule = {m.dist.path : m for m in modules}
for e in mx.classpath(depNames).split(os.pathsep):
if cpEntryToModule.has_key(e):
modulepath.append(cpEntryToModule[e].jarpath)
else:
classpath.append(e)
# The Truffle modules must be eagerly loaded as they could be referenced from
# the main class hence the --add-modules argument
return ['--add-modules=' + ','.join([m.name for m in modules]), '--module-path=' + os.pathsep.join(modulepath), '-cp', os.pathsep.join(classpath)]
return ['-cp', mx.classpath(depNames)]
开发者ID:graalvm,项目名称:truffle,代码行数:26,代码来源:mx_truffle.py
示例10: genInlineAssemblyParser
def genInlineAssemblyParser(args=None, out=None):
"""generate inline assembly parser and scanner if corresponding grammer is new"""
generatedParserDir = _inlineAssemblySrcDir + _inlineAssemblyPackageName.replace(".", "/") + "/"
generatedFiles = [generatedParserDir + "Parser.java", generatedParserDir + "Scanner.java"]
configFiles = [
_inlineAssemblySrcDir + "InlineAssembly.atg",
_inlineAssemblySrcDir + "Parser.frame",
_inlineAssemblySrcDir + "Scanner.frame",
_inlineAssemblySrcDir + "Copyright.frame",
]
isAllGeneratedFilesExists = all([isfile(fileName) for fileName in generatedFiles])
latestGeneratedFile = (
sorted(generatedFiles, key=os.path.getmtime, reverse=True)[0] if isAllGeneratedFilesExists else ""
)
latestConfigFile = sorted(configFiles, key=os.path.getmtime, reverse=True)[0]
# If any auto-generated file is missing or any config file is updated after last auto-generation then regenerate the files
if not isAllGeneratedFilesExists or os.path.getmtime(latestConfigFile) >= os.path.getmtime(latestGeneratedFile):
localCocoJarFile = _suite.dir + "/lib/Coco.jar"
if not isfile(localCocoJarFile):
jarFileUrls = ["https://lafo.ssw.uni-linz.ac.at/pub/sulong-deps/Coco.jar"]
mx.download(localCocoJarFile, jarFileUrls)
command = [
mx.get_jdk(tag="jvmci").java,
"-jar",
localCocoJarFile,
"-package",
_inlineAssemblyPackageName,
"-o",
generatedParserDir,
_inlineAssemblyGrammer,
]
mx.run(command)
# Files get generated in Windows file format. Convert them to avoid style check failure during regression testing
dos2unix(generatedFiles)
开发者ID:graalvm,项目名称:sulong,代码行数:34,代码来源:mx_sulong.py
示例11: _update_JDK9_STUBS_library
def _update_JDK9_STUBS_library():
"""
Sets the "path" and "sha1" attributes of the "JDK9_STUBS" library.
"""
jdk9InternalLib = _suite.suiteDict['libraries']['JDK9_STUBS']
jarInputDir = join(_suite.get_output_root(), 'jdk9-stubs')
jarPath = join(_suite.get_output_root(), 'jdk9-stubs.jar')
stubs = [
('jdk.internal.misc', 'VM', """package jdk.internal.misc;
public class VM {
public static String getSavedProperty(String key) {
throw new InternalError("should not reach here");
}
}
""")
]
if not exists(jarPath):
sourceFiles = []
for (package, className, source) in stubs:
sourceFile = join(jarInputDir, package.replace('.', os.sep), className + '.java')
mx.ensure_dir_exists(os.path.dirname(sourceFile))
with open(sourceFile, 'w') as fp:
fp.write(source)
sourceFiles.append(sourceFile)
jdk = mx.get_jdk(tag='default')
mx.run([jdk.javac, '-d', jarInputDir] + sourceFiles)
mx.run([jdk.jar, 'cf', jarPath, '.'], cwd=jarInputDir)
jdk9InternalLib['path'] = jarPath
jdk9InternalLib['sha1'] = mx.sha1OfFile(jarPath)
开发者ID:campolake,项目名称:openjdk9,代码行数:32,代码来源:mx_jvmci.py
示例12: _igvJdk
def _igvJdk():
v8u20 = mx.VersionSpec("1.8.0_20")
v8u40 = mx.VersionSpec("1.8.0_40")
v8 = mx.VersionSpec("1.8")
def _igvJdkVersionCheck(version):
return version >= v8 and (version < v8u20 or version >= v8u40)
return mx.get_jdk(_igvJdkVersionCheck, versionDescription='>= 1.8 and < 1.8.0u20 or >= 1.8.0u40', purpose="running IGV").home
开发者ID:JervenBolleman,项目名称:graal-core,代码行数:7,代码来源:mx_graal_tools.py
示例13: microbench
def microbench(self, args):
"""run JMH microbenchmark projects"""
parser = ArgumentParser(prog='mx microbench', description=microbench.__doc__,
usage="%(prog)s [command options|VM options] [-- [JMH options]]")
parser.add_argument('--jar', help='Explicitly specify micro-benchmark location')
self.add_arguments(parser)
mx.warn("`mx microbench` is deprecated! Consider moving to `mx_benchmark.JMHRunnerBenchmarkSuite`")
known_args, args = parser.parse_known_args(args)
vmArgs, jmhArgs = mx.extract_VM_args(args, useDoubleDash=True)
vmArgs = self.parseVmArgs(vmArgs)
# look for -f in JMH arguments
forking = True
for i in range(len(jmhArgs)):
arg = jmhArgs[i]
if arg.startswith('-f'):
if arg == '-f' and (i+1) < len(jmhArgs):
arg += jmhArgs[i+1]
try:
if int(arg[2:]) == 0:
forking = False
except ValueError:
pass
if known_args.jar:
# use the specified jar
args = ['-jar', known_args.jar]
if not forking:
args += vmArgs
# we do not know the compliance level of the jar - assuming 1.8
self.javaCompliance = mx.JavaCompliance('1.8')
else:
# find all projects with a direct JMH dependency
projects_dict = mx_benchmark.JMHRunnerBenchmarkSuite.get_jmh_projects_dict()
jmhProjects = projects_dict['JMH'] if 'JMH' in projects_dict else []
# get java compliance - 1.8 is minimum since we build jmh-runner with java 8
self.javaCompliance = max([p.javaCompliance for p in jmhProjects] + [mx.JavaCompliance('1.8')])
cpArgs = mx.get_runtime_jvm_args([p.name for p in jmhProjects], jdk=mx.get_jdk(self.javaCompliance))
# execute JMH runner
if forking:
args, cpVmArgs = self.filterVmArgs(cpArgs)
vmArgs += cpVmArgs
else:
args = cpArgs + vmArgs
args += ['org.openjdk.jmh.Main']
if forking:
def quoteSpace(s):
if " " in s:
return '"' + s + '"'
return s
forkedVmArgs = map(quoteSpace, self.parseForkedVmArgs(vmArgs))
args += ['--jvmArgsPrepend', ' '.join(forkedVmArgs)]
self.run_java(args + jmhArgs)
开发者ID:charig,项目名称:mx,代码行数:59,代码来源:mx_microbench.py
示例14: _unittest
def _unittest(args, annotations, prefixCp="", blacklist=None, whitelist=None, verbose=False, fail_fast=False, enable_timing=False, regex=None, color=False, eager_stacktrace=False, gc_after_test=False, suite=None):
testfile = os.environ.get('MX_TESTFILE', None)
if testfile is None:
(_, testfile) = tempfile.mkstemp(".testclasses", "mxtool")
os.close(_)
mainClass = 'com.oracle.mxtool.junit.MxJUnitWrapper'
if not exists(join(mx.project('com.oracle.mxtool.junit').output_dir(), mainClass.replace('.', os.sep) + '.class')):
mx.build(['--only', 'com.oracle.mxtool.junit'])
coreCp = mx.classpath(['com.oracle.mxtool.junit'])
coreArgs = []
if verbose:
coreArgs.append('-JUnitVerbose')
if fail_fast:
coreArgs.append('-JUnitFailFast')
if enable_timing:
coreArgs.append('-JUnitEnableTiming')
if color:
coreArgs.append('-JUnitColor')
if eager_stacktrace:
coreArgs.append('-JUnitEagerStackTrace')
if gc_after_test:
coreArgs.append('-JUnitGCAfterTest')
def harness(unittestCp, vmLauncher, vmArgs):
prefixArgs = ['-esa', '-ea']
if gc_after_test:
prefixArgs.append('-XX:-DisableExplicitGC')
with open(testfile) as fp:
testclasses = [l.rstrip() for l in fp.readlines()]
cp = prefixCp + coreCp + os.pathsep + unittestCp
# suppress menubar and dock when running on Mac
vmArgs = prefixArgs + ['-Djava.awt.headless=true'] + vmArgs + ['-cp', mx._separatedCygpathU2W(cp)]
# Execute Junit directly when one test is being run. This simplifies
# replaying the VM execution in a native debugger (e.g., gdb).
mainClassArgs = coreArgs + (testclasses if len(testclasses) == 1 else ['@' + mx._cygpathU2W(testfile)])
config = (vmArgs, mainClass, mainClassArgs)
for p in _config_participants:
config = p(config)
vmLauncher.launcher(*config)
vmLauncher = _vm_launcher
if vmLauncher is None:
jdk = mx.get_jdk()
def _run_vm(vmArgs, mainClass, mainClassArgs):
mx.run_java(vmArgs + [mainClass] + mainClassArgs, jdk=jdk)
vmLauncher = _VMLauncher('default VM launcher', _run_vm, jdk)
try:
_run_tests(args, harness, vmLauncher, annotations, testfile, blacklist, whitelist, regex, mx.suite(suite) if suite else None)
finally:
if os.environ.get('MX_TESTFILE') is None:
os.remove(testfile)
开发者ID:christhalinger,项目名称:mx,代码行数:59,代码来源:mx_unittest.py
示例15: _igvJdk
def _igvJdk():
v8u20 = mx.VersionSpec("1.8.0_20")
v8u40 = mx.VersionSpec("1.8.0_40")
v9 = mx.VersionSpec("1.9")
def _igvJdkVersionCheck(version):
# Remove v9 check once GR-3187 is resolved
return version < v9 and (version < v8u20 or version >= v8u40)
return mx.get_jdk(_igvJdkVersionCheck, versionDescription='>= 1.8 and < 1.8.0u20 or >= 1.8.0u40', purpose="running IGV").home
开发者ID:mur47x111,项目名称:graal-core,代码行数:8,代码来源:mx_graal_tools.py
示例16: _unittest_config_participant
def _unittest_config_participant(config):
"""modifies the classpath to use the Sulong distribution jars instead of the classfiles to enable the use of Java's ServiceLoader"""
(vmArgs, mainClass, mainClassArgs) = config
cpIndex, _ = mx.find_classpath_arg(vmArgs)
junitCp = mx.classpath("com.oracle.mxtool.junit")
sulongCp = ':'.join([mx.classpath(mx.distribution(distr), jdk=mx.get_jdk(tag='jvmci')) for distr in sulongDistributions])
vmArgs[cpIndex] = junitCp + ":" + sulongCp
return (vmArgs, mainClass, mainClassArgs)
开发者ID:lxp,项目名称:sulong,代码行数:8,代码来源:mx_sulong.py
示例17: _truffle_gate_runner
def _truffle_gate_runner(args, tasks):
jdk = mx.get_jdk(tag=mx.DEFAULT_JDK_TAG)
if jdk.javaCompliance < '9':
with Task('Truffle Javadoc', tasks) as t:
if t: mx.javadoc(['--unified'])
with Task('Truffle UnitTests', tasks) as t:
if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
with Task('Truffle Signature Tests', tasks) as t:
if t: sigtest(['--check', 'binary'])
开发者ID:calder,项目名称:truffle,代码行数:9,代码来源:mx_truffle.py
示例18: extraVmArgs
def extraVmArgs(self):
# find all projects with a direct JMH dependency
jmhProjects = []
for p in mx.projects_opt_limit_to_suites():
if 'JMH' in [x.name for x in p.deps]:
jmhProjects.append(p)
cp = mx.classpath([p.name for p in jmhProjects], jdk=mx.get_jdk())
return ['-cp', cp]
开发者ID:christhalinger,项目名称:mx,代码行数:9,代码来源:mx_benchmark.py
示例19: microbench
def microbench(self, args):
"""run JMH microbenchmark projects"""
parser = ArgumentParser(prog='mx microbench', description=microbench.__doc__,
usage="%(prog)s [command options|VM options] [-- [JMH options]]")
parser.add_argument('--jar', help='Explicitly specify micro-benchmark location')
self.add_arguments(parser)
known_args, args = parser.parse_known_args(args)
vmArgs, jmhArgs = mx.extract_VM_args(args, useDoubleDash=True)
vmArgs = self.parseVmArgs(vmArgs)
# look for -f in JMH arguments
forking = True
for i in range(len(jmhArgs)):
arg = jmhArgs[i]
if arg.startswith('-f'):
if arg == '-f' and (i+1) < len(jmhArgs):
arg += jmhArgs[i+1]
try:
if int(arg[2:]) == 0:
forking = False
except ValueError:
pass
if known_args.jar:
# use the specified jar
args = ['-jar', known_args.jar]
if not forking:
args += vmArgs
# we do not know the compliance level of the jar - assuming 1.8
self.javaCompliance = mx.JavaCompliance('1.8')
else:
# find all projects with a direct JMH dependency
jmhProjects = []
for p in mx.projects_opt_limit_to_suites():
if 'JMH' in [x.name for x in p.deps]:
jmhProjects.append(p)
# get java compliance - 1.8 is minimum since we build jmh-runner with java 8
self.javaCompliance = max([p.javaCompliance for p in jmhProjects] + [mx.JavaCompliance('1.8')])
cp = mx.classpath([p.name for p in jmhProjects], jdk=mx.get_jdk(self.javaCompliance))
# execute JMH runner
args = ['-cp', cp]
if not forking:
args += vmArgs
args += ['org.openjdk.jmh.Main']
if forking:
def quoteSpace(s):
if " " in s:
return '"' + s + '"'
return s
forkedVmArgs = map(quoteSpace, self.parseForkedVmArgs(vmArgs))
args += ['--jvmArgsPrepend', ' '.join(forkedVmArgs)]
self.run_java(args + jmhArgs)
开发者ID:christhalinger,项目名称:mx,代码行数:57,代码来源:mx_microbench.py
示例20: _runmake
def _runmake(args):
"""run the JDK make process
To build hotspot and import it into the JDK: "mx make hotspot import-hotspot"
{0}"""
jdkBuildDir = _get_jdk_build_dir()
if not exists(jdkBuildDir):
# JDK9 must be bootstrapped with a JDK8
compliance = mx.JavaCompliance('8')
jdk8 = mx.get_jdk(compliance.exactMatch, versionDescription=compliance.value)
cmd = ['sh', 'configure', '--with-debug-level=' + _vm.debugLevel, '--with-native-debug-symbols=external', '--disable-precompiled-headers',
'--with-jvm-variants=' + _vm.jvmVariant, '--disable-warnings-as-errors', '--with-boot-jdk=' + jdk8.home]
mx.run(cmd, cwd=_jdkSourceRoot)
cmd = [mx.gmake_cmd(), 'CONF=' + _vm.debugLevel]
if mx.get_opts().verbose:
cmd.append('LOG=debug')
cmd.extend(args)
if mx.get_opts().use_jdk_image and 'images' not in args:
cmd.append('images')
if not mx.get_opts().verbose:
mx.log('--------------- make execution ----------------------')
mx.log('Working directory: ' + _jdkSourceRoot)
mx.log('Command line: ' + ' '.join(cmd))
mx.log('-----------------------------------------------------')
mx.run(cmd, cwd=_jdkSourceRoot)
if 'images' in cmd:
jdkImageDir = join(jdkBuildDir, 'images', 'jdk')
# The OpenJDK build creates an empty cacerts file so copy one from
# the default JDK (which is assumed to be an OracleJDK)
srcCerts = join(mx.get_jdk(tag='default').home, 'lib', 'security', 'cacerts')
if not exists(srcCerts):
# Might be building with JDK8 which has cacerts under jre/
srcCerts = join(mx.get_jdk(tag='default').home, 'jre', 'lib', 'security', 'cacerts')
dstCerts = join(jdkImageDir, 'lib', 'security', 'cacerts')
if srcCerts != dstCerts:
shutil.copyfile(srcCerts, dstCerts)
_create_jdk_bundle(jdkBuildDir, _vm.debugLevel, jdkImageDir)
开发者ID:FauxFaux,项目名称:jdk9-hotspot,代码行数:43,代码来源:mx_jvmci.py
注:本文中的mx.get_jdk函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论