Mercurial > hg > truffle
comparison mx/commands.py @ 4153:38c782b84ac2
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 20 Dec 2011 15:50:25 +0100 |
parents | 527724d26036 c78bace5086a |
children | 394404b2d9bd |
comparison
equal
deleted
inserted
replaced
4152:527724d26036 | 4153:38c782b84ac2 |
---|---|
27 # ---------------------------------------------------------------------------------------------------- | 27 # ---------------------------------------------------------------------------------------------------- |
28 | 28 |
29 import os, sys, shutil, StringIO | 29 import os, sys, shutil, StringIO |
30 from os.path import join, exists, dirname, isfile, isdir, isabs | 30 from os.path import join, exists, dirname, isfile, isdir, isabs |
31 import mx | 31 import mx |
32 import sanitycheck | |
32 | 33 |
33 _graal_home = dirname(dirname(__file__)) | 34 _graal_home = dirname(dirname(__file__)) |
34 _vmbuild = 'product' | 35 _vmbuild = 'product' |
35 | 36 |
36 def clean(args): | 37 def clean(args): |
80 project, mainClass = config | 81 project, mainClass = config |
81 run_example(verbose, project, mainClass) | 82 run_example(verbose, project, mainClass) |
82 | 83 |
83 def dacapo(args): | 84 def dacapo(args): |
84 """run one or all DaCapo benchmarks""" | 85 """run one or all DaCapo benchmarks""" |
85 | |
86 benchmarks = { | |
87 'avrora': ['-n', '5'], | |
88 'batik': ['-n', '5'], | |
89 'eclipse': ['-n', '5'], | |
90 'fop': ['-n', '5'], | |
91 'h2': ['-n', '5'], | |
92 'jython': ['-n', '5'], | |
93 'luindex': ['-n', '5'], | |
94 'lusearch': ['-n', '5'], | |
95 'pmd': ['-n', '5'], | |
96 'sunflow': ['-n', '5'], | |
97 'tomcat': ['-n', '5'], | |
98 'tradebeans': ['-n', '5'], | |
99 'tradesoap': ['-n', '5'], | |
100 'xalan': ['-n', '5'], | |
101 } | |
102 | |
103 dacapo = mx.check_get_env('DACAPO_CP') | |
104 if not isfile(dacapo) or not dacapo.endswith('.jar'): | |
105 mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo) | |
106 | |
107 vmOpts = ['-Xms1g', '-Xmx2g', '-esa', '-cp', dacapo] | |
108 | |
109 runs = dict() | 86 runs = dict() |
110 while len(args) != 0 and not args[0].startswith('-'): | 87 while len(args) != 0 and not args[0].startswith('-'): |
111 bm = args[0] | 88 bm = args[0] |
112 del args[0] | 89 del args[0] |
113 config = benchmarks.get(bm) | 90 n = sanitycheck.dacapoSanityWarmup.get(bm)[sanitycheck.SanityCheckLevel.Normal] |
114 if (config is None): | 91 if (n is None): |
115 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(benchmarks.keys())) | 92 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(sanitycheck.dacapoSanityWarmup.keys())) |
116 runs[bm] = config | 93 runs[bm] = n |
117 | 94 |
118 if len(runs) == 0: | 95 if len(runs) == 0: |
119 runs = benchmarks | 96 for (key, ns) in sanitycheck.dacapoSanityWarmup.items(): |
120 | 97 runs[key] = ns[sanitycheck.SanityCheckLevel.Normal] |
121 vmOpts += args | 98 |
122 for bm in runs: | 99 for (bench, n) in runs.items(): |
123 config = benchmarks.get(bm) | 100 vm(args + sanitycheck.getDacapoCmd(bench, n=n)) |
124 vm(vmOpts + ['Harness'] + config + [bm]) | 101 |
102 def sanitychecks(args): | |
103 """runs sanity checks""" | |
104 checks = sanitycheck.getSanityChecks(sanitycheck.SanityCheckLevel.Gate) | |
105 for check in checks: | |
106 if not sanitycheck.runSanityCheck(check['cmd'], check['success']): | |
107 mx.abort("Sanity checks FAILED") | |
108 mx.log("Sanity checks PASSED") | |
125 | 109 |
126 def _jdk7(build='product', create=False): | 110 def _jdk7(build='product', create=False): |
127 jdk7 = join(_graal_home, 'jdk1.7.0') | 111 jdk7 = join(_graal_home, 'jdk1.7.0') |
128 if not exists(jdk7): | 112 if not exists(jdk7): |
129 # Assume we are running with a JDK7 | 113 # Assume we are running with a JDK7 |
198 sys.stderr.write(line + os.linesep) | 182 sys.stderr.write(line + os.linesep) |
199 | 183 |
200 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='3', ALT_BOOTDIR=jdk7, INSTALL='y') | 184 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='3', ALT_BOOTDIR=jdk7, INSTALL='y') |
201 mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage) | 185 mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage) |
202 | 186 |
203 def vm(args, vm='-graal'): | 187 def vm(args, vm='-graal', nonZeroIsFatal=True, out=None, err=None, cwd=None): |
204 """run the GraalVM""" | 188 """run the GraalVM""" |
205 | 189 |
206 build = _vmbuild | 190 build = _vmbuild |
207 if mx.java().debug: | 191 if mx.java().debug: |
208 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args | 192 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args |
209 os.environ['GRAAL'] = join(_graal_home, 'graal') | 193 os.environ['GRAAL'] = join(_graal_home, 'graal') |
210 exe = join(_jdk7(build), 'bin', mx.exe_suffix('java')) | 194 exe = join(_jdk7(build), 'bin', mx.exe_suffix('java')) |
211 return mx.run([exe, vm] + args) | 195 return mx.run([exe, vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd) |
212 | 196 |
213 def ideinit(args): | 197 def ideinit(args): |
214 """(re)generate Eclipse project configurations | 198 """(re)generate Eclipse project configurations |
215 | 199 |
216 The exit code of this command reflects how many files were updated.""" | 200 The exit code of this command reflects how many files were updated.""" |
371 'dacapo': [dacapo, '[benchmark] [VM options]'], | 355 'dacapo': [dacapo, '[benchmark] [VM options]'], |
372 'example': [example, '[-v] example names...'], | 356 'example': [example, '[-v] example names...'], |
373 'clean': [clean, ''], | 357 'clean': [clean, ''], |
374 'vm': [vm, '[-options] class [args...]'], | 358 'vm': [vm, '[-options] class [args...]'], |
375 'ideinit': [ideinit, ''], | 359 'ideinit': [ideinit, ''], |
360 'sanity' : [sanitychecks, ''], | |
376 } | 361 } |
377 mx.commands.update(commands) | 362 mx.commands.update(commands) |
378 | 363 |
379 def mx_post_parse_cmd_line(opts): | 364 def mx_post_parse_cmd_line(opts): |
380 version = mx.java().version | 365 version = mx.java().version |