comparison mx/commands.py @ 4485:c82b74db2ccd

Merge
author Andreas Woess <andreas.woess@jku.at>
date Tue, 07 Feb 2012 21:17:08 +0100
parents 58ecb156a3e8
children 8caa4f2df081 43b4e9201c29
comparison
equal deleted inserted replaced
4484:14a00ee82980 4485:c82b74db2ccd
216 if not sanitycheck.getDacapo(test, n, dacapoArgs).test('graal', opts=vmOpts): 216 if not sanitycheck.getDacapo(test, n, dacapoArgs).test('graal', opts=vmOpts):
217 failed.append(test) 217 failed.append(test)
218 218
219 if len(failed) != 0: 219 if len(failed) != 0:
220 mx.abort('DaCapo failures: ' + str(failed)) 220 mx.abort('DaCapo failures: ' + str(failed))
221
222
223 def scaladacapo(args):
224 """run one or all Scala DaCapo benchmarks
225
226 Scala DaCapo options are distinguished from VM options by a '@' prefix.
227 For example, '@--iterations @5' will pass '--iterations 5' to the
228 DaCapo harness."""
229
230 numTests = {}
231
232 if len(args) > 0:
233 level = getattr(sanitycheck.SanityCheckLevel, args[0], None)
234 if level is not None:
235 del args[0]
236 for (bench, ns) in sanitycheck.dacapoScalaSanityWarmup.items():
237 if ns[level] > 0:
238 numTests[bench] = ns[level]
239 else:
240 while len(args) != 0 and args[0][0] not in ['-', '@']:
241 n = 1
242 if args[0].isdigit():
243 n = int(args[0])
244 assert len(args) > 1 and args[1][0] not in ['-', '@'] and not args[1].isdigit()
245 bm = args[1]
246 del args[0]
247 else:
248 bm = args[0]
249
250 del args[0]
251 if bm not in sanitycheck.dacapoScalaSanityWarmup.keys():
252 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(sanitycheck.dacapoScalaSanityWarmup.keys()))
253 numTests[bm] = n
254
255 if len(numTests) is 0:
256 for bench in sanitycheck.dacapoScalaSanityWarmup.keys():
257 numTests[bench] = 1
258
259 # Extract DaCapo options
260 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')]
261
262 # The remainder are VM options
263 vmOpts = [arg for arg in args if not arg.startswith('@')]
264
265 failed = []
266 for (test, n) in numTests.items():
267 if not sanitycheck.getScalaDacapo(test, n, dacapoArgs).test('graal', opts=vmOpts):
268 failed.append(test)
269
270 if len(failed) != 0:
271 mx.abort('Scala DaCapo failures: ' + str(failed))
221 272
222 def _jdk(build='product', create=False): 273 def _jdk(build='product', create=False):
223 """ 274 """
224 Get the JDK into which Graal is installed, creating it first if necessary. 275 Get the JDK into which Graal is installed, creating it first if necessary.
225 """ 276 """
496 547
497 t = Task('BuildJava') 548 t = Task('BuildJava')
498 build(['--no-native']) 549 build(['--no-native'])
499 tasks.append(t.stop()) 550 tasks.append(t.stop())
500 551
501 for vmbuild in ['product', 'fastdebug']: 552 for vmbuild in ['fastdebug', 'product']:
502 global _vmbuild 553 global _vmbuild
503 _vmbuild = vmbuild 554 _vmbuild = vmbuild
504 555
505 t = Task('BuildHotSpot:' + vmbuild) 556 t = Task('BuildHotSpot:' + vmbuild)
506 build(['--no-java', vmbuild]) 557 build(['--no-java', vmbuild])
569 dacapos = [a[7:] for a in args if a.startswith('dacapo:')] 620 dacapos = [a[7:] for a in args if a.startswith('dacapo:')]
570 for dacapo in dacapos: 621 for dacapo in dacapos:
571 if dacapo not in sanitycheck.dacapoSanityWarmup.keys(): 622 if dacapo not in sanitycheck.dacapoSanityWarmup.keys():
572 mx.abort('Unknown dacapo : ' + dacapo) 623 mx.abort('Unknown dacapo : ' + dacapo)
573 benchmarks += [sanitycheck.getDacapo(dacapo, sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])] 624 benchmarks += [sanitycheck.getDacapo(dacapo, sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])]
625
626 if ('scaladacapo' in args or 'all' in args):
627 benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
628 else:
629 dacapos = [a[7:] for a in args if a.startswith('scaladacapo:')]
630 for dacapo in dacapos:
631 if dacapo not in sanitycheck.dacapoScalaSanityWarmup.keys():
632 mx.abort('Unknown dacapo : ' + dacapo)
633 benchmarks += [sanitycheck.getScalaDacapo(dacapo, sanitycheck.dacapoScalaSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])]
574 634
575 #Bootstrap 635 #Bootstrap
576 if ('bootstrap' in args or 'all' in args): 636 if ('bootstrap' in args or 'all' in args):
577 benchmarks += sanitycheck.getBootstraps() 637 benchmarks += sanitycheck.getBootstraps()
578 #SPECjvm2008 638 #SPECjvm2008
595 def specjvm2008(args): 655 def specjvm2008(args):
596 benchArgs = [a[1:] for a in args if a[0] == '@'] 656 benchArgs = [a[1:] for a in args if a[0] == '@']
597 vmArgs = [a for a in args if a[0] != '@'] 657 vmArgs = [a for a in args if a[0] != '@']
598 sanitycheck.getSPECjvm2008(benchArgs).bench('graal', opts=vmArgs) 658 sanitycheck.getSPECjvm2008(benchArgs).bench('graal', opts=vmArgs)
599 659
660 def hsdis(args):
661 """Installs the hsdis library
662
663 This is needed to support HotSpot's assembly dumping features.
664 By default it installs the Intel syntax version, use the 'att' argument to install AT&T syntax."""
665 flavor = 'intel'
666 if 'att' in args:
667 flavor = 'att'
668 build = _vmbuild if _vmSourcesAvailable else 'product'
669 lib = mx.lib_suffix('hsdis-amd64')
670 path = join(_jdk(build), 'jre', 'lib', 'amd64', lib)
671 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib])
672
600 def mx_init(): 673 def mx_init():
601 _vmbuild = 'product' 674 _vmbuild = 'product'
602 commands = { 675 commands = {
603 'build': [build, '[-options]'], 676 'build': [build, '[-options]'],
604 'clean': [clean, ''], 677 'clean': [clean, ''],
605 'copyrightcheck': [copyrightcheck, ''], 678 'copyrightcheck': [copyrightcheck, ''],
679 'hsdis': [hsdis, '[att]'],
606 'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'], 680 'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'],
607 'specjvm2008': [specjvm2008, ''], 681 'scaladacapo': [scaladacapo, '[[n] benchmark] [VM options|@Scala DaCapo options]'],
682 'specjvm2008': [specjvm2008, '[VM options|@specjvm2008 options]'],
608 'example': [example, '[-v] example names...'], 683 'example': [example, '[-v] example names...'],
609 'gate' : [gate, ''], 684 'gate' : [gate, ''],
610 'bench' : [bench, '[-vm vm] [-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], 685 'bench' : [bench, '[-vm vm] [-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'],
611 'unittest' : [unittest, '[filters...]'], 686 'unittest' : [unittest, '[filters...]'],
612 'vm': [vm, '[-options] class [args...]'] 687 'vm': [vm, '[-options] class [args...]']