本文整理汇总了Python中mx.abort函数的典型用法代码示例。如果您正苦于以下问题:Python abort函数的具体用法?Python abort怎么用?Python abort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了abort函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: jaotc_test
def jaotc_test(args):
"""run (acceptance) tests for the AOT compiler (jaotc)"""
all_tests = ['HelloWorld', 'java.base', 'javac']
parser = ArgumentParser(prog='mx jaotc-test')
parser.add_argument("--list", default=None, action="store_true", help="Print the list of available jaotc tests.")
parser.add_argument('tests', help='tests to run (omit to run all tests)', nargs=ZERO_OR_MORE)
args = parser.parse_args(args)
if args.list:
print "The following jaotc tests are available:\n"
for name in all_tests:
print " " + name
return
tests = args.tests or all_tests
for test in tests:
mx.log('Testing `{}`'.format(test))
if test == 'HelloWorld':
test_class(
classpath=mx.classpath('JAOTC_TEST'),
main_class='jdk.tools.jaotc.test.HelloWorld'
)
elif test == 'javac':
test_javac('jdk.tools.jaotc')
elif test == 'java.base':
test_modules(
classpath=mx.project('jdk.tools.jaotc.test').output_dir(),
main_class='jdk.tools.jaotc.test.HelloWorld',
modules=['java.base']
)
else:
mx.abort('Unknown jaotc test: {}'.format(test))
开发者ID:13768324554,项目名称:graal,代码行数:32,代码来源:mx_jaotc.py
示例2: jacocoreport
def jacocoreport(args):
"""create a JaCoCo coverage report
Creates the report from the 'jacoco.exec' file in the current directory.
Default output directory is 'coverage', but an alternative can be provided as an argument."""
jacocoreport = mx.library("JACOCOREPORT", True)
out = 'coverage'
if len(args) == 1:
out = args[0]
elif len(args) > 1:
mx.abort('jacocoreport takes only one argument : an output directory')
includes = list(_jacoco_includes)
for p in mx.projects():
projsetting = getattr(p, 'jacoco', '')
if projsetting == 'include' or projsetting == '':
includes.append(p.name)
includedirs = set()
for p in mx.projects():
projsetting = getattr(p, 'jacoco', '')
if projsetting == 'exclude':
continue
for include in includes:
if include in p.dir:
includedirs.add(p.dir)
for i in includedirs:
bindir = i + '/bin'
mx.ensure_dir_exists(bindir)
mx.run_java(['-jar', jacocoreport.get_path(True), '--in', 'jacoco.exec', '--out', out] + sorted(includedirs))
开发者ID:christianwimmer,项目名称:mx,代码行数:33,代码来源:mx_gate.py
示例3: _find_matches
def _find_matches(results, match_string, print_matches, list_file_matches, match_klass_name):
if match_klass_name:
mod = sys.modules[__name__]
match_klass = getattr(mod, match_klass_name)
if not match_klass:
mx.abort('no such function: ' + match_klass_name)
match_klass_instance = match_klass(print_matches, list_file_matches, match_string)
else:
match_klass_instance = DefaultMatchClass(print_matches, list_file_matches, match_string)
for result in results:
lines = result.rawData.split("\n")
i = 0
for line in lines:
if match_string in line:
# search backward for package install trace
j = i
pkgname = None
while j > 0:
linej = lines[j]
if 'installing *source* package' in linej:
pkgname = _extract_pkgname(line)
match_klass_instance.record(pkgname, line, str(result))
break
j = j - 1
if pkgname is None:
print 'failed to find installing trace starting at line: ' + str(i)
i = i + 1
match_klass_instance.output()
开发者ID:anukat2015,项目名称:fastr,代码行数:29,代码来源:mx_fastr_pkgtest.py
示例4: __init__
def __init__(self, title, tasks=None, disableJacoco=False):
self.tasks = tasks
self.title = title
self.skipped = False
if tasks is not None:
for t in tasks:
if t.title == title:
mx.abort('Gate task with title "' + title + '" is already defined')
if Task.startAtFilter:
assert not Task.filters
if Task.startAtFilter in title:
self.skipped = False
Task.startAtFilter = None
else:
self.skipped = True
elif Task.filters:
if Task.filtersExclude:
self.skipped = any([f in title for f in Task.filters])
else:
self.skipped = not any([f in title for f in Task.filters])
if not self.skipped:
self.start = time.time()
self.end = None
self.duration = None
self.disableJacoco = disableJacoco
mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title)
开发者ID:christianwimmer,项目名称:mx,代码行数:27,代码来源:mx_gate.py
示例5: _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
示例6: verify_jvmci_ci_versions
def verify_jvmci_ci_versions(args=None, extraVMarguments=None):
version_pattern = re.compile(r'^(?!\s*#).*jvmci-(?P<version>\d*\.\d*)')
def _grep_version(files, msg):
version = None
last = None
linenr = 0
for filename in files:
for line in open(filename):
m = version_pattern.search(line)
if m:
new_version = m.group('version')
if version and version != new_version:
mx.abort(
os.linesep.join([
"Multiple JVMCI versions found in {0} files:".format(msg),
" {0} in {1}:{2}: {3}".format(version, *last),
" {0} in {1}:{2}: {3}".format(new_version, filename, linenr, line),
]))
last = (filename, linenr, line.rstrip())
version = new_version
linenr = linenr + 1
if not version:
mx.abort("No JVMCI version found in {0} files!".format(msg))
return version
hocon_version = _grep_version(glob.glob(join(mx.primary_suite().dir, 'ci*.hocon')) + glob.glob(join(mx.primary_suite().dir, 'ci*/*.hocon')), 'ci.hocon')
travis_version = _grep_version(glob.glob('.travis.yml'), 'TravisCI')
if hocon_version != travis_version:
mx.abort("Travis and ci.hocon JVMCI versions do not match: {0} vs. {1}".format(travis_version, hocon_version))
mx.log('JVMCI versions are ok!')
开发者ID:graalvm,项目名称:graal-core,代码行数:31,代码来源:mx_graal_core.py
示例7: __init__
def __init__(self, name, args, tags, suppress=None):
self.name = name
self.args = args
self.suppress = suppress
self.tags = tags
if tags is not None and (type(tags) is not list or all(not isinstance(x, basestring) for x in tags)):
mx.abort("Gate tag argument must be a list of strings, tag argument:" + str(tags))
开发者ID:graalvm,项目名称:graal-core,代码行数:7,代码来源:mx_graal_core.py
示例8: ensureDragonEggExists
def ensureDragonEggExists():
"""downloads dragonegg if not downloaded yet"""
if not os.path.exists(dragonEggPath()):
if 'DRAGONEGG' in os.environ:
mx.abort('dragonegg not found at ' + os.environ['DRAGONEGG'])
else:
pullInstallDragonEgg()
开发者ID:SwapnilGaikwad,项目名称:sulong,代码行数:7,代码来源:mx_sulong.py
示例9: run_vm
def run_vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, debugLevel=None, vmbuild=None):
"""run a Java program by executing the java executable in a JVMCI JDK"""
jdkTag = mx.get_jdk_option().tag
if jdkTag and jdkTag != _JVMCI_JDK_TAG:
mx.abort('The "--jdk" option must have the tag "' + _JVMCI_JDK_TAG + '" when running a command requiring a JVMCI VM')
jdk = get_jvmci_jdk(debugLevel=debugLevel or _translateLegacyDebugLevel(vmbuild))
return jdk.run_java(args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
开发者ID:mearvk,项目名称:JVM,代码行数:7,代码来源:mx_jvmci.py
示例10: _run_netbeans_app
def _run_netbeans_app(app_name, env=None, args=None):
args = [] if args is None else args
dist = app_name.upper() + '_DIST'
name = app_name.lower()
extractPath = join(_suite.get_output_root())
if mx.get_os() == 'windows':
executable = join(extractPath, name, 'bin', name + '.exe')
else:
executable = join(extractPath, name, 'bin', name)
# Check whether the current installation is up-to-date
if exists(executable) and not exists(mx.library(dist).get_path(resolve=False)):
mx.log('Updating ' + app_name)
shutil.rmtree(join(extractPath, name))
archive = mx.library(dist).get_path(resolve=True)
if not exists(executable):
zf = zipfile.ZipFile(archive, 'r')
zf.extractall(extractPath)
if not exists(executable):
mx.abort(app_name + ' binary does not exist: ' + executable)
if mx.get_os() != 'windows':
# Make sure that execution is allowed. The zip file does not always specfiy that correctly
os.chmod(executable, 0777)
mx.run([executable]+args, env=env)
开发者ID:JervenBolleman,项目名称:graal-core,代码行数:28,代码来源:mx_graal_tools.py
示例11: cc
def cc(args):
_log('fastr:cc', args)
compiler = None
sulong = _sulong()
if sulong:
analyzed_args = _analyze_args(args)
if _is_linux():
rc = sulong.compileWithGCC(analyzed_args.compile_args)
if rc == 0 and analyzed_args.llvm_ir_file:
if not analyzed_args.is_link:
rc = sulong.compileWithGCC(analyzed_args.emit_llvm_args)
elif _is_darwin():
rc = sulong.compileWithClang(analyzed_args.compile_args)
if rc == 0 and analyzed_args.llvm_ir_file:
if not analyzed_args.is_link:
rc = sulong.compileWithClang(analyzed_args.emit_llvm_args)
else:
mx.abort('unsupported platform')
if rc == 0 and not analyzed_args.is_link and analyzed_args.llvm_ir_file:
rc = _mem2reg_opt(analyzed_args.llvm_ir_file)
if rc == 0:
rc = _embed_ir(analyzed_args.llvm_ir_file)
else:
if _is_linux():
compiler = 'gcc'
elif _is_darwin():
compiler = 'clang'
else:
mx.abort('unsupported platform')
rc = mx.run([compiler] + args, nonZeroIsFatal=False)
return rc
开发者ID:jjfumero,项目名称:fastr,代码行数:33,代码来源:mx_fastr_compile.py
示例12: _visit
def _visit(dep, edges):
if dep is not dist:
if dep.isJavaProject() or dep.isJARDistribution():
if dep not in moduledeps:
moduledeps.append(dep)
else:
mx.abort('modules can (currently) only include JAR distributions and Java projects: ' + str(dep), context=dist)
开发者ID:graalvm,项目名称:mx,代码行数:7,代码来源:mx_javamodules.py
示例13: 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
示例14: _grep_version
def _grep_version(files, msg):
version = None
dev = None
last = None
linenr = 0
for filename in files:
for line in open(filename):
m = version_pattern.search(line)
if m:
new_version = m.group('version')
new_dev = bool(m.group('dev'))
if (version and version != new_version) or (dev is not None and dev != new_dev):
mx.abort(
os.linesep.join([
"Multiple JVMCI versions found in {0} files:".format(msg),
" {0} in {1}:{2}: {3}".format(version + ('-dev' if dev else ''), *last),
" {0} in {1}:{2}: {3}".format(new_version + ('-dev' if new_dev else ''), filename, linenr, line),
]))
last = (filename, linenr, line.rstrip())
version = new_version
dev = new_dev
linenr += 1
if not version:
mx.abort("No JVMCI version found in {0} files!".format(msg))
return version, dev
开发者ID:mur47x111,项目名称:graal-core,代码行数:25,代码来源:mx_graal_core.py
示例15: get_java_module_info
def get_java_module_info(dist, fatalIfNotModule=False):
"""
Gets the metadata for the module derived from `dist`.
:param JARDistribution dist: a distribution possibly defining a module
:param bool fatalIfNotModule: specifies whether to abort if `dist` does not define a module
:return: None if `dist` does not define a module otherwise a tuple containing
the name of the module, the directory in which the class files
(including module-info.class) for the module are staged and finally
the path to the jar file containing the built module
"""
if dist.suite.getMxCompatibility().moduleDepsEqualDistDeps():
moduleName = getattr(dist, 'moduleName', None)
if not moduleName:
if fatalIfNotModule:
mx.abort('Distribution ' + dist.name + ' does not define a module')
return None
assert len(moduleName) > 0, '"moduleName" attribute of distribution ' + dist.name + ' cannot be empty'
else:
if not get_module_deps(dist):
if fatalIfNotModule:
mx.abort('Module for distribution ' + dist.name + ' would be empty')
return None
moduleName = dist.name.replace('_', '.').lower()
modulesDir = mx.ensure_dir_exists(join(dist.suite.get_output_root(), 'modules'))
moduleDir = mx.ensure_dir_exists(join(modulesDir, moduleName))
moduleJar = join(modulesDir, moduleName + '.jar')
return moduleName, moduleDir, moduleJar
开发者ID:graalvm,项目名称:mx,代码行数:29,代码来源:mx_javamodules.py
示例16: js_image_test
def js_image_test(binary, bench_location, name, warmup_iterations, iterations, timeout=None, bin_args=None):
bin_args = bin_args if bin_args is not None else []
jsruncmd = [binary] + bin_args + [join(bench_location, 'harness.js'), '--', join(bench_location, name + '.js'),
'--', '--warmup-iterations=' + str(warmup_iterations),
'--iterations=' + str(iterations)]
mx.log(' '.join(jsruncmd))
passing = []
stdoutdata = []
def stdout_collector(x):
stdoutdata.append(x)
mx.log(x.rstrip())
stderrdata = []
def stderr_collector(x):
stderrdata.append(x)
mx.warn(x.rstrip())
returncode = mx.run(jsruncmd, cwd=bench_location, out=stdout_collector, err=stderr_collector, nonZeroIsFatal=False, timeout=timeout)
if returncode == mx.ERROR_TIMEOUT:
print('INFO: TIMEOUT (> %d): %s' % (timeout, name))
elif returncode >= 0:
matches = 0
for line in stdoutdata:
if re.match(r'^\S+: *\d+(\.\d+)?\s*$', line):
matches += 1
if matches > 0:
passing = stdoutdata
if not passing:
mx.abort('JS benchmark ' + name + ' failed')
开发者ID:charig,项目名称:truffle,代码行数:32,代码来源:mx_substratevm.py
示例17: c1visualizer
def c1visualizer(args):
"""run the Cl Compiler Visualizer"""
libpath = join(_suite.dir, 'lib')
if mx.get_os() == 'windows':
executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer.exe')
else:
executable = join(libpath, 'c1visualizer', 'bin', 'c1visualizer')
# Check whether the current C1Visualizer installation is the up-to-date
if exists(executable) and not exists(mx.library('C1VISUALIZER_DIST').get_path(resolve=False)):
mx.log('Updating C1Visualizer')
shutil.rmtree(join(libpath, 'c1visualizer'))
archive = mx.library('C1VISUALIZER_DIST').get_path(resolve=True)
if not exists(executable):
zf = zipfile.ZipFile(archive, 'r')
zf.extractall(libpath)
if not exists(executable):
mx.abort('C1Visualizer binary does not exist: ' + executable)
if mx.get_os() != 'windows':
# Make sure that execution is allowed. The zip file does not always specfiy that correctly
os.chmod(executable, 0777)
mx.run([executable])
开发者ID:mearvk,项目名称:JVM,代码行数:27,代码来源:mx_jvmci.py
示例18: igv
def igv(args):
"""run the Ideal Graph Visualizer"""
logFile = '.ideal_graph_visualizer.log'
with open(join(_suite.dir, logFile), 'w') as fp:
mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']')
nbplatform = join(_suite.dir, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform')
# Remove NetBeans platform if it is earlier than the current supported version
if exists(nbplatform):
updateTrackingFile = join(nbplatform, 'platform', 'update_tracking', 'org-netbeans-core.xml')
if not exists(updateTrackingFile):
mx.log('Could not find \'' + updateTrackingFile + '\', removing NetBeans platform')
shutil.rmtree(nbplatform)
else:
dom = xml.dom.minidom.parse(updateTrackingFile)
currentVersion = mx.VersionSpec(dom.getElementsByTagName('module_version')[0].getAttribute('specification_version'))
supportedVersion = mx.VersionSpec('3.43.1')
if currentVersion < supportedVersion:
mx.log('Replacing NetBeans platform version ' + str(currentVersion) + ' with version ' + str(supportedVersion))
shutil.rmtree(nbplatform)
elif supportedVersion < currentVersion:
mx.log('Supported NetBeans version in igv command should be updated to ' + str(currentVersion))
if not exists(nbplatform):
mx.logv('[This execution may take a while as the NetBeans platform needs to be downloaded]')
env = _igvBuildEnv()
# make the jar for Batik 1.7 available.
env['IGV_BATIK_JAR'] = mx.library('BATIK').get_path(True)
if mx.run(['ant', '-f', mx._cygpathU2W(join(_suite.dir, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')), '-l', mx._cygpathU2W(fp.name), 'run'], env=env, nonZeroIsFatal=False):
mx.abort("IGV ant build & launch failed. Check '" + logFile + "'. You can also try to delete 'src/share/tools/IdealGraphVisualizer/nbplatform'.")
开发者ID:mearvk,项目名称:JVM,代码行数:31,代码来源:mx_jvmci.py
示例19: getDacapo
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))
开发者ID:woess,项目名称:graal-core,代码行数:25,代码来源:sanitycheck.py
示例20: jmhJAR
def jmhJAR(self):
if self.jmh_jar is None:
mx.abort("Please use the --jmh-jar benchmark suite argument to set the JMH jar file.")
jmh_jar = os.path.expanduser(self.jmh_jar)
if not os.path.exists(jmh_jar):
mx.abort("The --jmh-jar argument points to a non-existing file: " + jmh_jar)
return jmh_jar
开发者ID:christhalinger,项目名称:mx,代码行数:7,代码来源:mx_benchmark.py
注:本文中的mx.abort函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论