comparison mx/commands.py @ 11296:4e943a311d9c

mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416) added prompt to build missing VM the first time it is executed cleaner support using 'with' statement for switching the configured VM within a scope
author Doug Simon <doug.simon@oracle.com>
date Tue, 13 Aug 2013 14:23:58 +0200
parents a09587890e58
children fcb4cf14a3c3
comparison
equal deleted inserted replaced
11295:bb70a309a7cf 11296:4e943a311d9c
37 _graal_home = dirname(dirname(__file__)) 37 _graal_home = dirname(dirname(__file__))
38 38
39 """ Used to distinguish an exported GraalVM (see 'mx export'). """ 39 """ Used to distinguish an exported GraalVM (see 'mx export'). """
40 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) 40 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src'))
41 41
42 """ The VMs that can be built and run - default is first in list """ 42 """ The VMs that can be built and run along with an optional description. Only VMs with a
43 _vmChoices = ['graal', 'server', 'client', 'server-nograal', 'client-nograal', 'original'] 43 description are listed in the dialogue for setting the default VM (see _get_vm()). """
44 _vmChoices = {
45 'graal' : 'All compilation is performed with Graal. This includes bootstrapping Graal itself unless -XX:-BootstrapGraal is used.',
46 'server' : 'Normal compilation is performed with the tiered system (i.e., client + server), Truffle compilation is performed with Graal. Use this for optimal Truffle performance.',
47 'client' : None, # normal compilation with client compiler, explicit compilation (e.g., by Truffle) with Graal
48 'server-nograal' : None, # all compilation with tiered system (i.e., client + server), Graal omitted
49 'client-nograal' : None, # all compilation with client compiler, Graal omitted
50 'original' : None, # default VM copied from bootstrap JDK
51 }
44 52
45 """ The VM that will be run by the 'vm' command and built by default by the 'build' command. 53 """ The VM that will be run by the 'vm' command and built by default by the 'build' command.
46 This can be set via the global '--vm' option. """ 54 This can be set via the global '--vm' option or the DEFAULT_VM environment variable.
47 _vm = _vmChoices[0] 55 It can also be temporarily set by using of a VM context manager object in a 'with' statement. """
56 _vm = None
48 57
49 """ The VM builds that will be run by the 'vm' command - default is first in list """ 58 """ The VM builds that will be run by the 'vm' command - default is first in list """
50 _vmbuildChoices = ['product', 'fastdebug', 'debug', 'optimized'] 59 _vmbuildChoices = ['product', 'fastdebug', 'debug', 'optimized']
51 60
52 """ The VM build that will be run by the 'vm' command. 61 """ The VM build that will be run by the 'vm' command.
53 This can be set via the global '--product', '--fastdebug' and '--debug' options. """ 62 This can be set via the global '--product', '--fastdebug' and '--debug' options.
63 It can also be temporarily set by using of a VM context manager object in a 'with' statement. """
54 _vmbuild = _vmbuildChoices[0] 64 _vmbuild = _vmbuildChoices[0]
55 65
56 _jacoco = 'off' 66 _jacoco = 'off'
57 67
58 _workdir = None 68 _workdir = None
63 73
64 _make_eclipse_launch = False 74 _make_eclipse_launch = False
65 75
66 _minVersion = mx.JavaVersion('1.7.0_04') 76 _minVersion = mx.JavaVersion('1.7.0_04')
67 77
78 def _get_vm():
79 """
80 Gets the configured VM, presenting a dialogue if there is no currently configured VM.
81 """
82 global _vm
83 if _vm:
84 return _vm
85 vm = mx.get_env('DEFAULT_VM')
86 if vm is None:
87 if not sys.stdout.isatty():
88 mx.abort('Need to specify VM with --vm option or DEFAULT_VM environment variable')
89 envPath = join(_graal_home, 'mx', 'env')
90 mx.log('Please select the VM to be executed from the following: ')
91 items = [k for k in _vmChoices.keys() if _vmChoices[k] is not None]
92 descriptions = [_vmChoices[k] for k in _vmChoices.keys() if _vmChoices[k] is not None]
93 vm = mx.select_items(items, descriptions, allowMultiple=False)
94 answer = raw_input('Persist this choice by adding "DEFAULT_VM=' + vm + '" to ' + envPath + '? [Yn]: ')
95 if not answer.lower().startswith('n'):
96 with open(envPath, 'a') as fp:
97 print >> fp, 'DEFAULT_VM=' + vm
98 _vm = vm
99 return vm
100
101 """
102 A context manager that can be used with the 'with' statement to set the VM
103 used by all VM executions within the scope of the 'with' statement. For example:
104
105 with VM('server'):
106 dacapo(['pmd'])
107 """
108 class VM:
109 def __init__(self, vm=None, build=None):
110 assert vm is None or vm in _vmChoices.keys()
111 assert build is None or build in _vmbuildChoices
112 self.vm = vm if vm else _vm
113 self.build = build if build else _vmbuild
114 self.previousVm = _vm
115 self.previousBuild = _vmbuild
116
117 def __enter__(self):
118 global _vm, _vmbuild
119 _vm = self.vm
120 _vmbuild = self.build
121
122 def __exit__(self, exc_type, exc_value, traceback):
123 global _vm, _vmbuild
124 _vm = self.previousVm
125 _vmbuild = self.previousBuild
126
68 def _chmodDir(chmodFlags, dirname, fnames): 127 def _chmodDir(chmodFlags, dirname, fnames):
69 os.chmod(dirname, chmodFlags) 128 os.chmod(dirname, chmodFlags)
70 for name in fnames: 129 for name in fnames:
71 os.chmod(os.path.join(dirname, name), chmodFlags) 130 os.chmod(os.path.join(dirname, name), chmodFlags)
72 131
170 # Extract DaCapo options 229 # Extract DaCapo options
171 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')] 230 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')]
172 231
173 # The remainder are VM options 232 # The remainder are VM options
174 vmOpts = [arg for arg in args if not arg.startswith('@')] 233 vmOpts = [arg for arg in args if not arg.startswith('@')]
175 vm = _vm 234 vm = _get_vm()
176 235
177 failed = [] 236 failed = []
178 for (test, n) in numTests.items(): 237 for (test, n) in numTests.items():
179 if not sanitycheck.getDacapo(test, n, dacapoArgs).test(vm, opts=vmOpts): 238 if not sanitycheck.getDacapo(test, n, dacapoArgs).test(vm, opts=vmOpts):
180 failed.append(test) 239 failed.append(test)
221 # Extract DaCapo options 280 # Extract DaCapo options
222 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')] 281 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')]
223 282
224 # The remainder are VM options 283 # The remainder are VM options
225 vmOpts = [arg for arg in args if not arg.startswith('@')] 284 vmOpts = [arg for arg in args if not arg.startswith('@')]
226 vm = _vm; 285 vm = _get_vm()
227 286
228 failed = [] 287 failed = []
229 for (test, n) in numTests.items(): 288 for (test, n) in numTests.items():
230 if not sanitycheck.getScalaDacapo(test, n, dacapoArgs).test(vm, opts=vmOpts): 289 if not sanitycheck.getScalaDacapo(test, n, dacapoArgs).test(vm, opts=vmOpts):
231 failed.append(test) 290 failed.append(test)
268 return join(jdk, 'jre', 'lib', _arch(), 'jvm.cfg') 327 return join(jdk, 'jre', 'lib', _arch(), 'jvm.cfg')
269 return join(_vmLibDirInJdk(jdk), 'jvm.cfg') 328 return join(_vmLibDirInJdk(jdk), 'jvm.cfg')
270 329
271 def _jdksDir(): 330 def _jdksDir():
272 return os.path.abspath(join(_vmdir if _vmdir else _graal_home, 'jdk' + str(mx.java().version))) 331 return os.path.abspath(join(_vmdir if _vmdir else _graal_home, 'jdk' + str(mx.java().version)))
332
333 def _handle_missing_VM(bld, vm):
334 mx.log('The ' + bld + ' ' + vm + ' VM has not been created')
335 if sys.stdout.isatty():
336 answer = raw_input('Build it now? [Yn]: ')
337 if not answer.lower().startswith('n'):
338 build([bld], vm=vm)
339 return
340 mx.abort('You need to run "mx --vm ' + vm + ' build ' + bld + '" to build the selected VM')
273 341
274 def _jdk(build='product', vmToCheck=None, create=False, installGraalJar=True): 342 def _jdk(build='product', vmToCheck=None, create=False, installGraalJar=True):
275 """ 343 """
276 Get the JDK into which Graal is installed, creating it first if necessary. 344 Get the JDK into which Graal is installed, creating it first if necessary.
277 """ 345 """
328 hsdis([], copyToDir=_vmLibDirInJdk(jdk)) 396 hsdis([], copyToDir=_vmLibDirInJdk(jdk))
329 except SystemExit: 397 except SystemExit:
330 pass 398 pass
331 else: 399 else:
332 if not exists(jdk): 400 if not exists(jdk):
333 vmOption = ' --vm ' + vmToCheck if vmToCheck else '' 401 _handle_missing_VM(build, vmToCheck if vmToCheck else 'graal')
334 mx.abort('The ' + build + ' VM has not been created - run "mx' + vmOption + ' build ' + build + '"')
335 402
336 if installGraalJar: 403 if installGraalJar:
337 _installGraalJarInJdks(mx.distribution('GRAAL')) 404 _installGraalJarInJdks(mx.distribution('GRAAL'))
338 405
339 if vmToCheck is not None: 406 if vmToCheck is not None:
343 for line in f: 410 for line in f:
344 if line.strip() == '-' + vmToCheck + ' KNOWN': 411 if line.strip() == '-' + vmToCheck + ' KNOWN':
345 found = True 412 found = True
346 break 413 break
347 if not found: 414 if not found:
348 mx.abort('The ' + build + ' ' + vmToCheck + ' VM has not been created - run "mx --vm ' + vmToCheck + ' build ' + build + '"') 415 _handle_missing_VM(build, vmToCheck)
349 416
350 return jdk 417 return jdk
351 418
352 def _installGraalJarInJdks(graalDist): 419 def _installGraalJarInJdks(graalDist):
353 graalJar = graalDist.path 420 graalJar = graalDist.path
481 builds = opts2.remainder 548 builds = opts2.remainder
482 if len(builds) == 0: 549 if len(builds) == 0:
483 builds = ['product'] 550 builds = ['product']
484 551
485 if vm is None: 552 if vm is None:
486 vm = _vm 553 vm = _get_vm()
487 554
488 if vm == 'original': 555 if vm == 'original':
489 pass 556 pass
490 elif vm.startswith('server'): 557 elif vm.startswith('server'):
491 buildSuffix = '' 558 buildSuffix = ''
647 714
648 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): 715 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None):
649 """run the VM selected by the '--vm' option""" 716 """run the VM selected by the '--vm' option"""
650 717
651 if vm is None: 718 if vm is None:
652 vm = _vm 719 vm = _get_vm()
653 720
654 if cwd is None: 721 if cwd is None:
655 cwd = _workdir 722 cwd = _workdir
656 elif _workdir is not None: 723 elif _workdir is not None:
657 mx.abort("conflicting working directories: do not set --workdir for this command") 724 mx.abort("conflicting working directories: do not set --workdir for this command")
757 os.close(_) 824 os.close(_)
758 825
759 def harness(projectscp, vmArgs): 826 def harness(projectscp, vmArgs):
760 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource): 827 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource):
761 subprocess.check_call([mx.java().javac, '-cp', projectscp, '-d', mxdir, javaSource]) 828 subprocess.check_call([mx.java().javac, '-cp', projectscp, '-d', mxdir, javaSource])
762 if not isGraalEnabled(_vm): 829 if not isGraalEnabled(_get_vm()):
763 prefixArgs = ['-esa', '-ea'] 830 prefixArgs = ['-esa', '-ea']
764 else: 831 else:
765 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] 832 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea']
766 with open(testfile) as fp: 833 with open(testfile) as fp:
767 testclasses = [l.rstrip() for l in fp.readlines()] 834 testclasses = [l.rstrip() for l in fp.readlines()]
822 _unittest(args, ['@LongTest', '@Parameters']) 889 _unittest(args, ['@LongTest', '@Parameters'])
823 890
824 def buildvms(args): 891 def buildvms(args):
825 """build one or more VMs in various configurations""" 892 """build one or more VMs in various configurations"""
826 893
827 vmsDefault = ','.join(_vmChoices) 894 vmsDefault = ','.join(_vmChoices.keys())
828 vmbuildsDefault = ','.join(_vmbuildChoices) 895 vmbuildsDefault = ','.join(_vmbuildChoices)
829 896
830 parser = ArgumentParser(prog='mx buildvms'); 897 parser = ArgumentParser(prog='mx buildvms');
831 parser.add_argument('--vms', help='a comma separated list of VMs to build (default: ' + vmsDefault + ')', metavar='<args>', default=vmsDefault) 898 parser.add_argument('--vms', help='a comma separated list of VMs to build (default: ' + vmsDefault + ')', metavar='<args>', default=vmsDefault)
832 parser.add_argument('--builds', help='a comma separated list of build types (default: ' + vmbuildsDefault + ')', metavar='<args>', default=vmbuildsDefault) 899 parser.add_argument('--builds', help='a comma separated list of build types (default: ' + vmbuildsDefault + ')', metavar='<args>', default=vmbuildsDefault)
850 # Run as subprocess so that output can be directed to a file 917 # Run as subprocess so that output can be directed to a file
851 subprocess.check_call([sys.executable, '-u', join('mxtool', 'mx.py'), '--vm', v, 'build', vmbuild], cwd=_graal_home, stdout=log, stderr=subprocess.STDOUT) 918 subprocess.check_call([sys.executable, '-u', join('mxtool', 'mx.py'), '--vm', v, 'build', vmbuild], cwd=_graal_home, stdout=log, stderr=subprocess.STDOUT)
852 duration = datetime.timedelta(seconds=time.time() - start) 919 duration = datetime.timedelta(seconds=time.time() - start)
853 mx.log('END: ' + v + '-' + vmbuild + '\t[' + str(duration) + ']') 920 mx.log('END: ' + v + '-' + vmbuild + '\t[' + str(duration) + ']')
854 else: 921 else:
855 global _vm 922 with VM(v):
856 _vm = v 923 build([vmbuild])
857 build([vmbuild])
858 if not args.no_check: 924 if not args.no_check:
859 vmargs = ['-version'] 925 vmargs = ['-version']
860 if v == 'graal': 926 if v == 'graal':
861 vmargs.insert(0, '-XX:-BootstrapGraal') 927 vmargs.insert(0, '-XX:-BootstrapGraal')
862 vm(vmargs, vm=v, vmbuild=vmbuild) 928 vm(vmargs, vm=v, vmbuild=vmbuild)
894 parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM') 960 parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM')
895 parser.add_argument('--jacocout', help='specify the output directory for jacoco report') 961 parser.add_argument('--jacocout', help='specify the output directory for jacoco report')
896 962
897 args = parser.parse_args(args) 963 args = parser.parse_args(args)
898 964
899 global _vmbuild
900 global _vm
901 global _jacoco 965 global _jacoco
902 966
903 tasks = [] 967 tasks = []
904 total = Task('Gate') 968 total = Task('Gate')
905 try: 969 try:
950 1014
951 t = Task('BuildHotSpotGraal: fastdebug,product') 1015 t = Task('BuildHotSpotGraal: fastdebug,product')
952 buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product']) 1016 buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product'])
953 tasks.append(t.stop()) 1017 tasks.append(t.stop())
954 1018
955 _vmbuild = 'fastdebug' 1019 with VM('graal', 'fastdebug'):
956 t = Task('BootstrapWithSystemAssertions:fastdebug') 1020 t = Task('BootstrapWithSystemAssertions:fastdebug')
957 vm(['-esa', '-version']) 1021 vm(['-esa', '-version'])
958 tasks.append(t.stop()) 1022 tasks.append(t.stop())
959 1023
960 _vmbuild = 'product' 1024 with VM('graal', 'product'):
961 t = Task('BootstrapWithGCVerification:product') 1025 t = Task('BootstrapWithGCVerification:product')
962 vm(['-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version']) 1026 vm(['-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'])
963 tasks.append(t.stop()) 1027 tasks.append(t.stop())
964 1028
965 _vmbuild = 'product' 1029 with VM('graal', 'product'):
966 t = Task('BootstrapWithG1GCVerification:product') 1030 t = Task('BootstrapWithG1GCVerification:product')
967 vm(['-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC','-XX:+UseG1GC','-XX:+UseNewCode','-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version']) 1031 vm(['-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC','-XX:+UseG1GC','-XX:+UseNewCode','-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'])
968 tasks.append(t.stop()) 1032 tasks.append(t.stop())
969 1033
970 _vmbuild = 'product' 1034 with VM('graal', 'product'):
971 t = Task('BootstrapWithRegisterPressure:product') 1035 t = Task('BootstrapWithRegisterPressure:product')
972 vm(['-G:RegisterPressure=rbx,r11,r10,r14,xmm3,xmm11,xmm14', '-esa', '-version']) 1036 vm(['-G:RegisterPressure=rbx,r11,r10,r14,xmm3,xmm11,xmm14', '-esa', '-version'])
973 tasks.append(t.stop()) 1037 tasks.append(t.stop())
974 1038
975 _vmbuild = 'product' 1039 with VM('graal', 'product'):
976 t = Task('BootstrapWithAOTConfiguration:product') 1040 t = Task('BootstrapWithAOTConfiguration:product')
977 vm(['-G:+AOTCompilation', '-G:+VerifyPhases', '-esa', '-version']) 1041 vm(['-G:+AOTCompilation', '-G:+VerifyPhases', '-esa', '-version'])
978 tasks.append(t.stop()) 1042 tasks.append(t.stop())
979 1043
980 originalVm = _vm 1044 with VM('server', 'product'): # hosted mode
981 _vm = 'server' # hosted mode 1045 t = Task('UnitTests:hosted-product')
982 t = Task('UnitTests:hosted-product') 1046 unittest([])
983 unittest([]) 1047 tasks.append(t.stop())
984 tasks.append(t.stop())
985 _vm = originalVm
986 1048
987 for vmbuild in ['fastdebug', 'product']: 1049 for vmbuild in ['fastdebug', 'product']:
988 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): 1050 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild):
989 t = Task(str(test) + ':' + vmbuild) 1051 t = Task(str(test) + ':' + vmbuild)
990 if not test.test('graal'): 1052 if not test.test('graal'):
1007 buildvms(['--vms', 'server-nograal', '--builds', 'product']) 1069 buildvms(['--vms', 'server-nograal', '--builds', 'product'])
1008 buildvms(['--vms', 'server-nograal', '--builds', 'optimized']) 1070 buildvms(['--vms', 'server-nograal', '--builds', 'optimized'])
1009 tasks.append(t.stop()) 1071 tasks.append(t.stop())
1010 1072
1011 for vmbuild in ['product', 'fastdebug']: 1073 for vmbuild in ['product', 'fastdebug']:
1012 _vmbuild = vmbuild
1013 for theVm in ['client', 'server']: 1074 for theVm in ['client', 'server']:
1014 _vm = theVm 1075 with VM(theVm, vmbuild):
1015 1076 t = Task('DaCapo_pmd:' + theVm + ':' + vmbuild)
1016 t = Task('DaCapo_pmd:' + theVm + ':' + vmbuild) 1077 dacapo(['pmd'])
1017 dacapo(['pmd']) 1078 tasks.append(t.stop())
1018 tasks.append(t.stop()) 1079
1019 1080 t = Task('UnitTests:' + theVm + ':' + vmbuild)
1020 t = Task('UnitTests:' + theVm + ':' + vmbuild) 1081 unittest(['@-XX:CompileCommand=exclude,*::run*', 'graal.api'])
1021 unittest(['@-XX:CompileCommand=exclude,*::run*', 'graal.api']) 1082 tasks.append(t.stop())
1022 tasks.append(t.stop())
1023 1083
1024 except KeyboardInterrupt: 1084 except KeyboardInterrupt:
1025 total.abort(1) 1085 total.abort(1)
1026 1086
1027 except BaseException as e: 1087 except BaseException as e:
1084 resultFile = args[index + 1] 1144 resultFile = args[index + 1]
1085 del args[index] 1145 del args[index]
1086 del args[index] 1146 del args[index]
1087 else: 1147 else:
1088 mx.abort('-resultfile must be followed by a file name') 1148 mx.abort('-resultfile must be followed by a file name')
1089 vm = _vm 1149 vm = _get_vm()
1090 if len(args) is 0: 1150 if len(args) is 0:
1091 args = ['all'] 1151 args = ['all']
1092 1152
1093 vmArgs = [arg for arg in args if arg.startswith('-')] 1153 vmArgs = [arg for arg in args if arg.startswith('-')]
1094 1154
1188 it = int(args[itIdx+1]) 1248 it = int(args[itIdx+1])
1189 except: 1249 except:
1190 mx.abort('-it (Iteration time) needs a numeric value (seconds)') 1250 mx.abort('-it (Iteration time) needs a numeric value (seconds)')
1191 vmArgs.remove('-it') 1251 vmArgs.remove('-it')
1192 benchArgs.remove(args[itIdx+1]) 1252 benchArgs.remove(args[itIdx+1])
1193 vm = _vm; 1253 vm = _get_vm();
1194 sanitycheck.getSPECjvm2008(benchArgs, skipCheck, skipValid, wt, it).bench(vm, opts=vmArgs) 1254 sanitycheck.getSPECjvm2008(benchArgs, skipCheck, skipValid, wt, it).bench(vm, opts=vmArgs)
1195 1255
1196 def specjbb2013(args): 1256 def specjbb2013(args):
1197 """runs the composite SPECjbb2013 benchmark 1257 """runs the composite SPECjbb2013 benchmark
1198 1258
1199 All options begining with - will be passed to the vm""" 1259 All options begining with - will be passed to the vm"""
1200 benchArgs = [a for a in args if a[0] != '-'] 1260 benchArgs = [a for a in args if a[0] != '-']
1201 vmArgs = [a for a in args if a[0] == '-'] 1261 vmArgs = [a for a in args if a[0] == '-']
1202 vm = _vm; 1262 vm = _get_vm();
1203 sanitycheck.getSPECjbb2013(benchArgs).bench(vm, opts=vmArgs) 1263 sanitycheck.getSPECjbb2013(benchArgs).bench(vm, opts=vmArgs)
1204 1264
1205 def specjbb2005(args): 1265 def specjbb2005(args):
1206 """runs the composite SPECjbb2005 benchmark 1266 """runs the composite SPECjbb2005 benchmark
1207 1267
1208 All options begining with - will be passed to the vm""" 1268 All options begining with - will be passed to the vm"""
1209 benchArgs = [a for a in args if a[0] != '-'] 1269 benchArgs = [a for a in args if a[0] != '-']
1210 vmArgs = [a for a in args if a[0] == '-'] 1270 vmArgs = [a for a in args if a[0] == '-']
1211 vm = _vm; 1271 vm = _get_vm();
1212 sanitycheck.getSPECjbb2005(benchArgs).bench(vm, opts=vmArgs) 1272 sanitycheck.getSPECjbb2005(benchArgs).bench(vm, opts=vmArgs)
1213 1273
1214 def hsdis(args, copyToDir=None): 1274 def hsdis(args, copyToDir=None):
1215 """download the hsdis library 1275 """download the hsdis library
1216 1276
1337 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append']) 1397 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append'])
1338 mx.add_argument('--workdir', help='runs the VM in the given directory', default=None) 1398 mx.add_argument('--workdir', help='runs the VM in the given directory', default=None)
1339 mx.add_argument('--vmdir', help='specify where the directory in which the vms should be', default=None) 1399 mx.add_argument('--vmdir', help='specify where the directory in which the vms should be', default=None)
1340 1400
1341 if (_vmSourcesAvailable): 1401 if (_vmSourcesAvailable):
1342 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=_vmChoices, help='the VM to build/run (default: ' + _vmChoices[0] + ')') 1402 mx.add_argument('--vm', action='store', dest='vm', choices=_vmChoices.keys(), help='the VM to build/run')
1343 for c in _vmbuildChoices: 1403 for c in _vmbuildChoices:
1344 mx.add_argument('--' + c, action='store_const', dest='vmbuild', const=c, help='select the ' + c + ' build of the VM') 1404 mx.add_argument('--' + c, action='store_const', dest='vmbuild', const=c, help='select the ' + c + ' build of the VM')
1345 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse') 1405 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse')
1346 mx.add_argument('--native-dbg', action='store', dest='native_dbg', help='Start the vm inside a debugger', metavar='<debugger>') 1406 mx.add_argument('--native-dbg', action='store', dest='native_dbg', help='Start the vm inside a debugger', metavar='<debugger>')
1347 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='native_dbg', help='alias for --native-dbg /usr/bin/gdb --args') 1407 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='native_dbg', help='alias for --native-dbg /usr/bin/gdb --args')