Mercurial > hg > graal-jvmci-8
comparison mx/mx_graal.py @ 13951:392b6ac8da36
Allow using run_java without the arguments from -J -Ja -Jp. Factor out the argument processing of mx_graal.vm and use it to pass tested-vm args down through the jmh harness
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Thu, 13 Feb 2014 17:59:27 +0100 |
parents | f694daada5bf |
children | b076b5c13c3f |
comparison
equal
deleted
inserted
replaced
13950:35783e78eaef | 13951:392b6ac8da36 |
---|---|
710 | 710 |
711 def vmfg(args): | 711 def vmfg(args): |
712 """run the fastdebug build of VM selected by the '--vm' option""" | 712 """run the fastdebug build of VM selected by the '--vm' option""" |
713 return vm(args, vmbuild='fastdebug') | 713 return vm(args, vmbuild='fastdebug') |
714 | 714 |
715 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): | 715 def _parseVmArgs(args, vm=None, cwd=None, vmbuild=None): |
716 """run the VM selected by the '--vm' option""" | 716 """run the VM selected by the '--vm' option""" |
717 | 717 |
718 if vm is None: | 718 if vm is None: |
719 vm = _get_vm() | 719 vm = _get_vm() |
720 | 720 |
759 if '-version' in args: | 759 if '-version' in args: |
760 ignoredArgs = args[args.index('-version') + 1:] | 760 ignoredArgs = args[args.index('-version') + 1:] |
761 if len(ignoredArgs) > 0: | 761 if len(ignoredArgs) > 0: |
762 mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs)) | 762 mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs)) |
763 | 763 |
764 return mx.run(pfx + [exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) | 764 return (pfx, exe, vm, args, cwd) |
765 | |
766 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): | |
767 (pfx_, exe_, vm_, args_, cwd) = _parseVmArgs(args, vm, cwd, vmbuild) | |
768 return mx.run(pfx_ + [exe_, '-' + vm_] + args_, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) | |
765 | 769 |
766 def _find_classes_with_annotations(p, pkgRoot, annotations, includeInnerClasses=False): | 770 def _find_classes_with_annotations(p, pkgRoot, annotations, includeInnerClasses=False): |
767 """ | 771 """ |
768 Scan the sources of project 'p' for Java source files containing a line starting with 'annotation' | 772 Scan the sources of project 'p' for Java source files containing a line starting with 'annotation' |
769 (ignoring preceding whitespace) and return the fully qualified class name for each Java | 773 (ignoring preceding whitespace) and return the fully qualified class name for each Java |
1291 continue | 1295 continue |
1292 | 1296 |
1293 microJar = os.path.join(absoluteMicro, "target", "microbenchmarks.jar") | 1297 microJar = os.path.join(absoluteMicro, "target", "microbenchmarks.jar") |
1294 if not exists(microJar): | 1298 if not exists(microJar): |
1295 mx.logv('JMH: ignored ' + absoluteMicro + " because it doesn't contain the expected jar file ('" + microJar + "')") | 1299 mx.logv('JMH: ignored ' + absoluteMicro + " because it doesn't contain the expected jar file ('" + microJar + "')") |
1296 continue | 1300 continue |
1297 if benchmarks: | 1301 if benchmarks: |
1298 def _addBenchmark(x): | 1302 def _addBenchmark(x): |
1299 if x.startswith("Benchmark:"): | 1303 if x.startswith("Benchmark:"): |
1300 return | 1304 return |
1301 match = False | 1305 match = False |
1304 | 1308 |
1305 if match: | 1309 if match: |
1306 numBench[0] += 1 | 1310 numBench[0] += 1 |
1307 matchedSuites.add(micros) | 1311 matchedSuites.add(micros) |
1308 | 1312 |
1309 | 1313 mx.run_java(['-jar', microJar, "-l"], cwd = jmhPath, out = _addBenchmark, addDefaultArgs = False) |
1310 mx.run_java(['-jar', microJar, "-l"], cwd = jmhPath, out = _addBenchmark) | |
1311 else: | 1314 else: |
1312 matchedSuites.add(micros) | 1315 matchedSuites.add(micros) |
1313 | 1316 |
1314 mx.logv("matchedSuites: " + str(matchedSuites)) | 1317 mx.logv("matchedSuites: " + str(matchedSuites)) |
1315 plural = 's' if not benchmarks or numBench[0] > 1 else '' | 1318 plural = 's' if not benchmarks or numBench[0] > 1 else '' |
1320 if benchmarks: | 1323 if benchmarks: |
1321 regex.append(r".*(" + "|".join(benchmarks) + ").*") | 1324 regex.append(r".*(" + "|".join(benchmarks) + ").*") |
1322 | 1325 |
1323 for suite in matchedSuites: | 1326 for suite in matchedSuites: |
1324 absoluteMicro = os.path.join(jmhPath, suite) | 1327 absoluteMicro = os.path.join(jmhPath, suite) |
1325 vm(['-jar', os.path.join(absoluteMicro, "target", "microbenchmarks.jar"), | 1328 (pfx, exe, vm, forkedVmArgs, _) = _parseVmArgs(vmArgs) |
1329 if pfx: | |
1330 mx.warn("JMH ignores prefix: \"" + pfx + "\"") | |
1331 mx.run_java( | |
1332 ['-jar', os.path.join(absoluteMicro, "target", "microbenchmarks.jar"), | |
1326 "-f", "1", | 1333 "-f", "1", |
1327 "-i", "10", "-wi", "10", | 1334 "-i", "10", "-wi", "10", |
1328 "--jvmArgs", " ".join(["-" + _get_vm()] + vmArgs)] + regex, | 1335 "--jvm", exe, |
1329 vm = 'original', | 1336 "--jvmArgs", " ".join(["-" + vm] + forkedVmArgs)] + regex, |
1337 addDefaultArgs = False, | |
1330 cwd = jmhPath) | 1338 cwd = jmhPath) |
1331 | 1339 |
1332 | 1340 |
1333 def specjvm2008(args): | 1341 def specjvm2008(args): |
1334 """run one or more SPECjvm2008 benchmarks""" | 1342 """run one or more SPECjvm2008 benchmarks""" |