Mercurial > hg > graal-compiler
annotate mx/commands.py @ 9116:e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 15 Apr 2013 12:55:46 +0200 |
parents | d766fd8eede0 |
children | cbfcb1054619 |
rev | line source |
---|---|
3718 | 1 # |
4225
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
2 # commands.py - the GraalVM specific commands |
3718 | 3 # |
4 # ---------------------------------------------------------------------------------------------------- | |
5 # | |
4187
ac5c2bdfcca2
Disabled copyright check in the gate until the CheckCopyright tools supports the HotSpot copyright notice format.
Doug Simon <doug.simon@oracle.com>
parents:
4185
diff
changeset
|
6 # Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. |
3718 | 7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8 # | |
9 # This code is free software; you can redistribute it and/or modify it | |
10 # under the terms of the GNU General Public License version 2 only, as | |
11 # published by the Free Software Foundation. | |
12 # | |
13 # This code is distributed in the hope that it will be useful, but WITHOUT | |
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 # version 2 for more details (a copy is included in the LICENSE file that | |
17 # accompanied this code). | |
18 # | |
19 # You should have received a copy of the GNU General Public License version | |
20 # 2 along with this work; if not, write to the Free Software Foundation, | |
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
22 # | |
23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
24 # or visit www.oracle.com if you need additional information or have any | |
25 # questions. | |
26 # | |
27 # ---------------------------------------------------------------------------------------------------- | |
28 | |
7509 | 29 import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, multiprocessing |
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
30 from os.path import join, exists, dirname, basename, getmtime |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
31 from argparse import ArgumentParser, REMAINDER |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
32 import mx |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
33 import sanitycheck |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
34 import json, textwrap |
3718 | 35 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
36 _graal_home = dirname(dirname(__file__)) |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
37 |
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
38 """ Used to distinguish an exported GraalVM (see 'mx export'). """ |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
39 _vmSourcesAvailable = exists(join(_graal_home, 'make')) and exists(join(_graal_home, 'src')) |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
40 |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
41 """ The VMs that can be built and run - default is first in list """ |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
42 _vmChoices = ['graal', 'server', 'client', 'server-nograal', 'client-nograal', 'boot'] |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
43 |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
44 """ The VM that will be run by the 'vm' command and built by default by the 'build' command. |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
45 This can be set via the global '--vm' option. """ |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
46 _vm = _vmChoices[0] |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
47 |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
48 """ The VM builds that will be run by the 'vm' command - default is first in list """ |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
49 _vmbuildChoices = ['product', 'fastdebug', 'debug'] |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
50 |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
51 """ The VM build that will be run by the 'vm' command. |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
52 This can be set via the global '--product', '--fastdebug' and '--debug' options. """ |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
53 _vmbuild = _vmbuildChoices[0] |
3718 | 54 |
5024
7ccdae96e98a
Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5016
diff
changeset
|
55 _jacoco = 'off' |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
56 |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5871
diff
changeset
|
57 _native_dbg = None |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5871
diff
changeset
|
58 |
5194
a6eceb5efb0e
added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents:
5189
diff
changeset
|
59 _make_eclipse_launch = False |
a6eceb5efb0e
added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents:
5189
diff
changeset
|
60 |
7916
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
61 _minVersion = mx.JavaVersion('1.7.0_04') |
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
62 |
6705
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
63 def _chmodDir(chmodFlags, dirname, fnames): |
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
64 os.chmod(dirname, chmodFlags) |
7509 | 65 for name in fnames: |
66 os.chmod(os.path.join(dirname, name), chmodFlags) | |
6705
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
67 |
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
68 def chmodRecursive(dirname, chmodFlags): |
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
69 os.path.walk(dirname, _chmodDir, chmodFlags) |
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
70 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
71 def clean(args): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
72 """clean the GraalVM source tree""" |
4247
3f6c6e61614e
Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents:
4244
diff
changeset
|
73 opts = mx.clean(args, parser=ArgumentParser(prog='mx clean')) |
4226
e03ff10d4bfc
Made the gate clean the Java projects only.
Doug Simon <doug.simon@oracle.com>
parents:
4225
diff
changeset
|
74 if opts.native: |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
75 def rmIfExists(name): |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
76 if os.path.isdir(name): |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
77 shutil.rmtree(name) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
78 elif os.path.isfile(name): |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
79 os.unlink(name) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
80 |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
81 rmIfExists(join(_graal_home, 'build')) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
82 rmIfExists(join(_graal_home, 'build-nograal')) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
83 rmIfExists(join(_graal_home, 'jdk' + str(mx.java().version))) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
84 rmIfExists(mx.distribution('GRAAL').path) |
3718 | 85 |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
86 def export(args): |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
87 """create a GraalVM zip file for distribution""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
88 |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
89 parser = ArgumentParser(prog='mx export'); |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
90 parser.add_argument('--omit-vm-build', action='store_false', dest='vmbuild', help='omit VM build step') |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
91 parser.add_argument('--omit-dist-init', action='store_false', dest='distInit', help='omit class files and IDE configurations from distribution') |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
92 parser.add_argument('zipfile', nargs=REMAINDER, metavar='zipfile') |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
93 |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
94 args = parser.parse_args(args) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
95 |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
96 tmp = tempfile.mkdtemp(prefix='tmp', dir=_graal_home) |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
97 if args.vmbuild: |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
98 # Make sure the product VM binary is up to date |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
99 build(['product']) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
100 |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
101 mx.log('Copying Java sources and mx files...') |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
102 mx.run(('hg archive -I graal -I mx -I mxtool -I mx.sh ' + tmp).split()) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
103 |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
104 # Copy the GraalVM JDK |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
105 mx.log('Copying GraalVM JDK...') |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
106 src = _jdk() |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
107 dst = join(tmp, basename(src)) |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
108 shutil.copytree(src, dst) |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
109 zfName = join(_graal_home, 'graalvm-' + mx.get_os() + '.zip') |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
110 zf = zipfile.ZipFile(zfName, 'w') |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
111 for root, _, files in os.walk(tmp): |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
112 for f in files: |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
113 name = join(root, f) |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
114 arcname = name[len(tmp) + 1:] |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
115 zf.write(join(tmp, name), arcname) |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
116 |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
117 # create class files and IDE configurations |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
118 if args.distInit: |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
119 mx.log('Creating class files...') |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
120 mx.run('mx build'.split(), cwd=tmp) |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
121 mx.log('Creating IDE configurations...') |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
122 mx.run('mx ideinit'.split(), cwd=tmp) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
123 |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
124 # clean up temp directory |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
125 mx.log('Cleaning up...') |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
126 shutil.rmtree(tmp) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
127 |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
128 mx.log('Created distribution in ' + zfName) |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
129 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
130 def example(args): |
3718 | 131 """run some or all Graal examples""" |
132 examples = { | |
5064
8a88c903e381
Updated mx commands.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5047
diff
changeset
|
133 'safeadd': ['com.oracle.graal.examples.safeadd', 'com.oracle.graal.examples.safeadd.Main'], |
8a88c903e381
Updated mx commands.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5047
diff
changeset
|
134 'vectorlib': ['com.oracle.graal.examples.vectorlib', 'com.oracle.graal.examples.vectorlib.Main'], |
3718 | 135 } |
136 | |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
137 def run_example(verbose, project, mainClass): |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
138 cp = mx.classpath(project) |
3718 | 139 sharedArgs = ['-Xcomp', '-XX:CompileOnly=Main', mainClass] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
140 |
3718 | 141 res = [] |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
142 mx.log("=== Server VM ===") |
3718 | 143 printArg = '-XX:+PrintCompilation' if verbose else '-XX:-PrintCompilation' |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
144 res.append(vm(['-cp', cp, printArg] + sharedArgs, vm='server')) |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
145 mx.log("=== Graal VM ===") |
3718 | 146 printArg = '-G:+PrintCompilation' if verbose else '-G:-PrintCompilation' |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
147 res.append(vm(['-cp', cp, printArg, '-G:-Extend', '-G:-Inline'] + sharedArgs)) |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
148 mx.log("=== Graal VM with extensions ===") |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
149 res.append(vm(['-cp', cp, printArg, '-G:+Extend', '-G:-Inline'] + sharedArgs)) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
150 |
3718 | 151 if len([x for x in res if x != 0]) != 0: |
152 return 1 | |
153 return 0 | |
154 | |
155 verbose = False | |
156 if '-v' in args: | |
157 verbose = True | |
158 args = [a for a in args if a != '-v'] | |
159 | |
160 if len(args) == 0: | |
161 args = examples.keys() | |
162 for a in args: | |
163 config = examples.get(a) | |
164 if config is None: | |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
165 mx.log('unknown example: ' + a + ' {available examples = ' + str(examples.keys()) + '}') |
3718 | 166 else: |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
167 mx.log('--------- ' + a + ' ------------') |
3718 | 168 project, mainClass = config |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
169 run_example(verbose, project, mainClass) |
3718 | 170 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
171 def dacapo(args): |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
172 """run one or all DaCapo benchmarks |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
173 |
4244
a69889e5a8a5
Made the DaCapo library be downloaded only on demand.
Doug Simon <doug.simon@oracle.com>
parents:
4240
diff
changeset
|
174 DaCapo options are distinguished from VM options by a '@' prefix. |
5649
14505f3e6b4c
modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents:
5596
diff
changeset
|
175 For example, '@-n @5' will pass '-n 5' to the |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
176 DaCapo harness.""" |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
177 |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
178 numTests = {} |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
179 if len(args) > 0: |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
180 level = getattr(sanitycheck.SanityCheckLevel, args[0], None) |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
181 if level is not None: |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
182 del args[0] |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
183 for (bench, ns) in sanitycheck.dacapoSanityWarmup.items(): |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
184 if ns[level] > 0: |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
185 numTests[bench] = ns[level] |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
186 else: |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
187 while len(args) != 0 and args[0][0] not in ['-', '@']: |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
188 n = 1 |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
189 if args[0].isdigit(): |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
190 n = int(args[0]) |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
191 assert len(args) > 1 and args[1][0] not in ['-', '@'] and not args[1].isdigit() |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
192 bm = args[1] |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
193 del args[0] |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
194 else: |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
195 bm = args[0] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
196 |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
197 del args[0] |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
198 if bm not in sanitycheck.dacapoSanityWarmup.keys(): |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
199 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(sanitycheck.dacapoSanityWarmup.keys())) |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
200 numTests[bm] = n |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
201 |
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
202 if len(numTests) is 0: |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
203 for bench in sanitycheck.dacapoSanityWarmup.keys(): |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
204 numTests[bench] = 1 |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
205 |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
206 # Extract DaCapo options |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
207 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
208 |
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
209 # The remainder are VM options |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
210 vmOpts = [arg for arg in args if not arg.startswith('@')] |
5229
ce6cb3a1eb44
mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5197
diff
changeset
|
211 vm = _vm |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
212 |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
213 failed = [] |
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
214 for (test, n) in numTests.items(): |
5229
ce6cb3a1eb44
mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5197
diff
changeset
|
215 if not sanitycheck.getDacapo(test, n, dacapoArgs).test(vm, opts=vmOpts): |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
216 failed.append(test) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
217 |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
218 if len(failed) != 0: |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
219 mx.abort('DaCapo failures: ' + str(failed)) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
220 |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
221 def scaladacapo(args): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
222 """run one or all Scala DaCapo benchmarks |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
223 |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
224 Scala DaCapo options are distinguished from VM options by a '@' prefix. |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
225 For example, '@--iterations @5' will pass '--iterations 5' to the |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
226 DaCapo harness.""" |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
227 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
228 numTests = {} |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
229 |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
230 if len(args) > 0: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
231 level = getattr(sanitycheck.SanityCheckLevel, args[0], None) |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
232 if level is not None: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
233 del args[0] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
234 for (bench, ns) in sanitycheck.dacapoScalaSanityWarmup.items(): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
235 if ns[level] > 0: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
236 numTests[bench] = ns[level] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
237 else: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
238 while len(args) != 0 and args[0][0] not in ['-', '@']: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
239 n = 1 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
240 if args[0].isdigit(): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
241 n = int(args[0]) |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
242 assert len(args) > 1 and args[1][0] not in ['-', '@'] and not args[1].isdigit() |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
243 bm = args[1] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
244 del args[0] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
245 else: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
246 bm = args[0] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
247 |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
248 del args[0] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
249 if bm not in sanitycheck.dacapoScalaSanityWarmup.keys(): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
250 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(sanitycheck.dacapoScalaSanityWarmup.keys())) |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
251 numTests[bm] = n |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
252 |
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
253 if len(numTests) is 0: |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
254 for bench in sanitycheck.dacapoScalaSanityWarmup.keys(): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
255 numTests[bench] = 1 |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
256 |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
257 # Extract DaCapo options |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
258 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
259 |
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
260 # The remainder are VM options |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
261 vmOpts = [arg for arg in args if not arg.startswith('@')] |
5229
ce6cb3a1eb44
mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5197
diff
changeset
|
262 vm = _vm; |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
263 |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
264 failed = [] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
265 for (test, n) in numTests.items(): |
5229
ce6cb3a1eb44
mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5197
diff
changeset
|
266 if not sanitycheck.getScalaDacapo(test, n, dacapoArgs).test(vm, opts=vmOpts): |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
267 failed.append(test) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
268 |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
269 if len(failed) != 0: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
270 mx.abort('Scala DaCapo failures: ' + str(failed)) |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
271 |
6495
75f130f2b30f
moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents:
6340
diff
changeset
|
272 def _arch(): |
6512
edea9ba7ac7b
Windows-specific fix for mx.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6506
diff
changeset
|
273 machine = platform.uname()[4] |
6558
0a6d8857306d
arch is i86pc on solaris x64 boxes.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6512
diff
changeset
|
274 if machine in ['amd64', 'AMD64', 'x86_64', 'i86pc']: |
6495
75f130f2b30f
moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents:
6340
diff
changeset
|
275 return 'amd64' |
6566
ef48be91f5fd
fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents:
6558
diff
changeset
|
276 if machine == 'i386' and mx.get_os() == 'darwin': |
ef48be91f5fd
fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents:
6558
diff
changeset
|
277 try: |
ef48be91f5fd
fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents:
6558
diff
changeset
|
278 # Support for Snow Leopard and earlier version of MacOSX |
ef48be91f5fd
fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents:
6558
diff
changeset
|
279 if subprocess.check_output(['sysctl', '-n', 'hw.cpu64bit_capable']).strip() == '1': |
ef48be91f5fd
fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents:
6558
diff
changeset
|
280 return 'amd64' |
ef48be91f5fd
fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents:
6558
diff
changeset
|
281 except OSError: |
ef48be91f5fd
fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents:
6558
diff
changeset
|
282 # sysctl is not available |
ef48be91f5fd
fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents:
6558
diff
changeset
|
283 pass |
ef48be91f5fd
fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents:
6558
diff
changeset
|
284 mx.abort('unknown or unsupported architecture: os=' + mx.get_os() + ', machine=' + machine) |
6495
75f130f2b30f
moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents:
6340
diff
changeset
|
285 |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
286 def _vmLibDirInJdk(jdk): |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
287 """ |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
288 Get the directory within a JDK where the server and client |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
289 subdirectories are located. |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
290 """ |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
291 if platform.system() == 'Darwin': |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
292 return join(jdk, 'jre', 'lib') |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
293 if platform.system() == 'Windows': |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
294 return join(jdk, 'jre', 'bin') |
6495
75f130f2b30f
moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents:
6340
diff
changeset
|
295 return join(jdk, 'jre', 'lib', _arch()) |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
296 |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
297 def _vmCfgInJdk(jdk): |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
298 """ |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
299 Get the jvm.cfg file. |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
300 """ |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
301 if platform.system() == 'Windows': |
6495
75f130f2b30f
moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents:
6340
diff
changeset
|
302 return join(jdk, 'jre', 'lib', _arch(), 'jvm.cfg') |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
303 return join(_vmLibDirInJdk(jdk), 'jvm.cfg') |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
304 |
8261
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
305 def _jdk(build='product', vmToCheck=None, create=False): |
4155
394404b2d9bd
Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents:
4153
diff
changeset
|
306 """ |
394404b2d9bd
Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents:
4153
diff
changeset
|
307 Get the JDK into which Graal is installed, creating it first if necessary. |
394404b2d9bd
Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
Doug Simon <doug.simon@oracle.com>
parents:
4153
diff
changeset
|
308 """ |
7916
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
309 jdk = join(_graal_home, 'jdk' + str(mx.java().version), build) |
8885
4877c7dfe6d6
Fix jdk creation check if db an man exist in source jdk not in the one we are creating
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8884
diff
changeset
|
310 srcJdk = mx.java().jdk |
5870
d84a26dc32f5
Make 'db' directory from JDK optional since it does not exists in all OpenJDK-based JDKs (cf. Icedtea)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5868
diff
changeset
|
311 jdkContents = ['bin', 'include', 'jre', 'lib'] |
8885
4877c7dfe6d6
Fix jdk creation check if db an man exist in source jdk not in the one we are creating
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8884
diff
changeset
|
312 if exists(join(srcJdk, 'db')): |
5870
d84a26dc32f5
Make 'db' directory from JDK optional since it does not exists in all OpenJDK-based JDKs (cf. Icedtea)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5868
diff
changeset
|
313 jdkContents.append('db') |
8885
4877c7dfe6d6
Fix jdk creation check if db an man exist in source jdk not in the one we are creating
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8884
diff
changeset
|
314 if mx.get_os() != 'windows' and exists(join(srcJdk, 'man')): |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
315 jdkContents.append('man') |
4582
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
316 if create: |
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
317 if not exists(jdk): |
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
318 mx.log('Creating ' + jdk + ' from ' + srcJdk) |
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
319 os.makedirs(jdk) |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
320 for d in jdkContents: |
4582
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
321 src = join(srcJdk, d) |
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
322 dst = join(jdk, d) |
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
323 if not exists(src): |
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
324 mx.abort('Host JDK directory is missing: ' + src) |
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
325 shutil.copytree(src, dst) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
326 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
327 # Make a copy of the default VM so that this JDK can be |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
328 # reliably used as the bootstrap for a HotSpot build. |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
329 jvmCfg = _vmCfgInJdk(jdk) |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
330 if not exists(jvmCfg): |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
331 mx.abort(jvmCfg + ' does not exist') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
332 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
333 defaultVM = None |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
334 jvmCfgLines = [] |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
335 with open(jvmCfg) as f: |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
336 for line in f: |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
337 if line.startswith('-') and defaultVM is None: |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
338 parts = line.split() |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
339 assert len(parts) == 2, parts |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
340 assert parts[1] == 'KNOWN', parts[1] |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
341 defaultVM = parts[0][1:] |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
342 jvmCfgLines += ['# boot VM is a copy of the unmodified ' + defaultVM + ' VM\n'] |
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
343 jvmCfgLines += ['-boot KNOWN\n'] |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
344 else: |
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
345 jvmCfgLines += [line] |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
346 |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
347 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg |
6687
a9a50f21e000
Added change to copied directory's protection when source JDK directories are read-only.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6566
diff
changeset
|
348 if mx.get_os() != 'windows': |
6705
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
349 chmodRecursive(jdk, 0755) |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
350 shutil.move(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), 'boot')) |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
351 |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
352 |
8261
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
353 with open(jvmCfg, 'w') as fp: |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
354 for line in jvmCfgLines: |
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
355 fp.write(line) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
356 |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
357 # Install a copy of the disassembler library |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
358 try: |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
359 hsdis([], copyToDir=_vmLibDirInJdk(jdk)) |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
360 except SystemExit: |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
361 pass |
3718 | 362 else: |
4582
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
363 if not exists(jdk): |
8261
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
364 mx.abort('The ' + build + ' VM has not been created - run "mx build ' + build + '"') |
8134
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
365 |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
366 _installGraalJarInJdks(mx.distribution('GRAAL')) |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
367 |
8261
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
368 if vmToCheck is not None: |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
369 jvmCfg = _vmCfgInJdk(jdk) |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
370 found = False |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
371 with open(jvmCfg) as f: |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
372 for line in f: |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
373 if line.strip() == '-' + vmToCheck + ' KNOWN': |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
374 found = True |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
375 break |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
376 if not found: |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
377 mx.abort('The ' + build + ' ' + vmToCheck + ' VM has not been created - run "mx --vm ' + vmToCheck + ' build ' + build + '"') |
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
378 |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
379 return jdk |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
380 |
8134
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
381 def _installGraalJarInJdks(graalDist): |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
382 graalJar = graalDist.path |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
383 jdks = join(_graal_home, 'jdk' + str(mx.java().version)) |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
384 if exists(jdks): |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
385 for e in os.listdir(jdks): |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
386 jreLibDir = join(jdks, e, 'jre', 'lib') |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
387 if exists(jreLibDir): |
8180
0934903d28f3
use shutil.move to make concurrent updating/replacement of graal.jar atomic
Doug Simon <doug.simon@oracle.com>
parents:
8135
diff
changeset
|
388 # do a copy and then a move to get atomic updating (on Unix) of graal.jar in the JRE |
8183
4b11a0983557
fixed issue with deleting temp files on Windows
Doug Simon <doug.simon@oracle.com>
parents:
8182
diff
changeset
|
389 fd, tmp = tempfile.mkstemp(suffix='', prefix='graal.jar', dir=jreLibDir) |
8180
0934903d28f3
use shutil.move to make concurrent updating/replacement of graal.jar atomic
Doug Simon <doug.simon@oracle.com>
parents:
8135
diff
changeset
|
390 shutil.copyfile(graalJar, tmp) |
8183
4b11a0983557
fixed issue with deleting temp files on Windows
Doug Simon <doug.simon@oracle.com>
parents:
8182
diff
changeset
|
391 os.close(fd) |
8180
0934903d28f3
use shutil.move to make concurrent updating/replacement of graal.jar atomic
Doug Simon <doug.simon@oracle.com>
parents:
8135
diff
changeset
|
392 shutil.move(tmp, join(jreLibDir, 'graal.jar')) |
8134
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
393 |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
394 # run a command in the windows SDK Debug Shell |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
395 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}): |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
396 newLine = os.linesep |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
397 STARTTOKEN = 'RUNINDEBUGSHELL_STARTSEQUENCE' |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
398 ENDTOKEN = 'RUNINDEBUGSHELL_ENDSEQUENCE' |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
399 |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
400 winSDK = mx.get_env('WIN_SDK', 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\') |
6306
2a819543cc45
Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6294
diff
changeset
|
401 |
2a819543cc45
Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6294
diff
changeset
|
402 if not exists(winSDK): |
2a819543cc45
Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6294
diff
changeset
|
403 mx.abort("Could not find Windows SDK : '" + winSDK + "' does not exist") |
2a819543cc45
Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6294
diff
changeset
|
404 |
2a819543cc45
Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6294
diff
changeset
|
405 if not exists(join(winSDK, 'Bin', 'SetEnv.cmd')): |
2a819543cc45
Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6294
diff
changeset
|
406 mx.abort("Invalid Windows SDK path (" + winSDK + ") : could not find Bin/SetEnv.cmd (you can use the WIN_SDK environment variable to specify an other path)") |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
407 |
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
408 p = subprocess.Popen('cmd.exe /E:ON /V:ON /K ""' + winSDK + '/Bin/SetEnv.cmd" & echo ' + STARTTOKEN + '"', \ |
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
409 shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP) |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
410 stdout = p.stdout |
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
411 stdin = p.stdin |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
412 if logFile: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
413 log = open(logFile, 'w') |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
414 ret = False |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
415 while True: |
7291
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
416 |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
417 # encoding may be None on windows plattforms |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
418 if sys.stdout.encoding is None: |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
419 encoding = 'utf-8' |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
420 else: |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
421 encoding = sys.stdout.encoding |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
422 |
a748e4d44694
Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents:
7290
diff
changeset
|
423 line = stdout.readline().decode(encoding) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
424 if logFile: |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
425 log.write(line.encode('utf-8')) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
426 line = line.strip() |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
427 mx.log(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
428 if line == STARTTOKEN: |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
429 stdin.write('cd /D ' + workingDir + ' & ' + cmd + ' & echo ' + ENDTOKEN + newLine) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
430 for regex in respondTo.keys(): |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
431 match = regex.search(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
432 if match: |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
433 stdin.write(respondTo[regex] + newLine) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
434 if findInOutput: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
435 match = findInOutput.search(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
436 if match: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
437 ret = True |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
438 if line == ENDTOKEN: |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
439 if not findInOutput: |
5868
a10e72af4dc5
Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5782
diff
changeset
|
440 stdin.write('echo ERRXXX%errorlevel%' + newLine) |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
441 else: |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
442 break |
5868
a10e72af4dc5
Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5782
diff
changeset
|
443 if line.startswith('ERRXXX'): |
a10e72af4dc5
Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5782
diff
changeset
|
444 if line == 'ERRXXX0': |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
445 ret = True |
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
446 break; |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
447 stdin.write('exit' + newLine) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
448 if logFile: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
449 log.close() |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
450 return ret |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
451 |
5103
276e14614531
Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents:
5094
diff
changeset
|
452 def jdkhome(args, vm=None): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
453 """print the JDK directory selected for the 'vm' command""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
454 |
5103
276e14614531
Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents:
5094
diff
changeset
|
455 build = _vmbuild if _vmSourcesAvailable else 'product' |
7916
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
456 print join(_graal_home, 'jdk' + str(mx.java().version), build) |
5103
276e14614531
Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents:
5094
diff
changeset
|
457 |
8302
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
458 def initantbuild(args): |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
459 """(re)generates an ant build file for producing graal.jar""" |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
460 parser=ArgumentParser(prog='mx initantbuild') |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
461 parser.add_argument('-f', '--buildfile', help='file to generate', default=join(_graal_home, 'make', 'build-graal.xml')) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
462 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
463 args = parser.parse_args(args) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
464 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
465 out = mx.XMLDoc() |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
466 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
467 out.comment(""" |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
468 Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
469 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
470 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
471 This code is free software; you can redistribute it and/or modify it |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
472 under the terms of the GNU General Public License version 2 only, as |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
473 published by the Free Software Foundation. Oracle designates this |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
474 particular file as subject to the "Classpath" exception as provided |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
475 by Oracle in the LICENSE file that accompanied this code. |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
476 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
477 This code is distributed in the hope that it will be useful, but WITHOUT |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
478 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
479 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
480 version 2 for more details (a copy is included in the LICENSE file that |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
481 accompanied this code). |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
482 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
483 You should have received a copy of the GNU General Public License version |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
484 2 along with this work; if not, write to the Free Software Foundation, |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
485 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
486 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
487 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
488 or visit www.oracle.com if you need additional information or have any |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
489 questions. |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
490 """) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
491 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
492 out.open('project', {'name' : 'graal', 'default' : 'main', 'basedir' : '.'}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
493 out.element('property', {'name' : 'src.dir', 'value' : '${gamma.dir}/graal'}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
494 out.element('property', {'name' : 'classes.dir', 'value' : '${shared.dir}/graal'}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
495 out.element('property', {'name' : 'jar.dir', 'value' : '${shared.dir}'}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
496 out.element('property', {'name' : 'jar.file', 'value' : '${jar.dir}/graal.jar'}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
497 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
498 out.element('target', {'name' : 'main', 'depends' : 'jar'}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
499 |
8890
a33b6378cb76
delete build/linux/shared/graal before compile in build-graal.xml to handle stale class files left behind after refactoring in Eclipse
Doug Simon <doug.simon@oracle.com>
parents:
8889
diff
changeset
|
500 out.open('target', {'name' : 'compile', 'depends' : 'cleanclasses'}) |
8302
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
501 out.element('mkdir', {'dir' : '${classes.dir}'}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
502 out.open('javac', {'destdir' : '${classes.dir}', 'debug' : 'on', 'includeantruntime' : 'false', }) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
503 for p in mx.sorted_deps(mx.distribution('GRAAL').deps): |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
504 out.element('src', {'path' : '${src.dir}/' + p.name}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
505 out.element('compilerarg', {'value' : '-XDignore.symbol.file'}) |
8317
3d515bfc1677
Fixed build-graal.xml generation was out of sync with build-graal.xml.
Christian Humer <christian.humer@gmail.com>
parents:
8302
diff
changeset
|
506 |
3d515bfc1677
Fixed build-graal.xml generation was out of sync with build-graal.xml.
Christian Humer <christian.humer@gmail.com>
parents:
8302
diff
changeset
|
507 out.open('classpath') |
3d515bfc1677
Fixed build-graal.xml generation was out of sync with build-graal.xml.
Christian Humer <christian.humer@gmail.com>
parents:
8302
diff
changeset
|
508 out.open('fileset', {'dir' : '${java.home}/../lib'}) |
3d515bfc1677
Fixed build-graal.xml generation was out of sync with build-graal.xml.
Christian Humer <christian.humer@gmail.com>
parents:
8302
diff
changeset
|
509 out.element('include', {'name' : 'tools.jar'}) |
3d515bfc1677
Fixed build-graal.xml generation was out of sync with build-graal.xml.
Christian Humer <christian.humer@gmail.com>
parents:
8302
diff
changeset
|
510 out.close('fileset') |
3d515bfc1677
Fixed build-graal.xml generation was out of sync with build-graal.xml.
Christian Humer <christian.humer@gmail.com>
parents:
8302
diff
changeset
|
511 out.close('classpath') |
3d515bfc1677
Fixed build-graal.xml generation was out of sync with build-graal.xml.
Christian Humer <christian.humer@gmail.com>
parents:
8302
diff
changeset
|
512 |
8302
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
513 out.close('javac') |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
514 out.close('target') |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
515 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
516 out.open('target', {'name' : 'jar', 'depends' : 'compile'}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
517 out.element('mkdir', {'dir' : '${jar.dir}'}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
518 out.element('jar', {'destfile' : '${jar.file}', 'basedir' : '${classes.dir}'}) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
519 out.close('target') |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
520 |
8890
a33b6378cb76
delete build/linux/shared/graal before compile in build-graal.xml to handle stale class files left behind after refactoring in Eclipse
Doug Simon <doug.simon@oracle.com>
parents:
8889
diff
changeset
|
521 out.open('target', {'name' : 'cleanclasses'}) |
8302
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
522 out.element('delete', {'dir' : '${classes.dir}'}) |
8890
a33b6378cb76
delete build/linux/shared/graal before compile in build-graal.xml to handle stale class files left behind after refactoring in Eclipse
Doug Simon <doug.simon@oracle.com>
parents:
8889
diff
changeset
|
523 out.close('target') |
a33b6378cb76
delete build/linux/shared/graal before compile in build-graal.xml to handle stale class files left behind after refactoring in Eclipse
Doug Simon <doug.simon@oracle.com>
parents:
8889
diff
changeset
|
524 |
a33b6378cb76
delete build/linux/shared/graal before compile in build-graal.xml to handle stale class files left behind after refactoring in Eclipse
Doug Simon <doug.simon@oracle.com>
parents:
8889
diff
changeset
|
525 out.open('target', {'name' : 'clean', 'depends' : 'cleanclasses'}) |
a33b6378cb76
delete build/linux/shared/graal before compile in build-graal.xml to handle stale class files left behind after refactoring in Eclipse
Doug Simon <doug.simon@oracle.com>
parents:
8889
diff
changeset
|
526 out.element('delete', {'file' : '${jar.file}'}) |
8302
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
527 out.close('target') |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
528 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
529 out.close('project') |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
530 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
531 mx.update_file(args.buildfile, out.xml(indent=' ', newl='\n')) |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
532 |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
533 def buildvars(args): |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
534 """Describes the variables that can be set by the -D option to the 'mx build' commmand""" |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
535 |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
536 buildVars = { |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
537 'ALT_BOOTDIR' : 'The location of the bootstrap JDK installation (default: ' + mx.java().jdk + ')', |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
538 'ALT_OUTPUTDIR' : 'Build directory', |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
539 'HOTSPOT_BUILD_JOBS' : 'Number of CPUs used by make (default: ' + str(multiprocessing.cpu_count()) + ')', |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
540 'INSTALL' : 'Install the built VM into the JDK? (default: y)', |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
541 'ZIP_DEBUGINFO_FILES' : 'Install zipped debug symbols file? (default: 0)', |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
542 'TEST_IN_BUILD' : 'Run the Queens test as part of build (default: false)' |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
543 } |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
544 |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
545 mx.log('HotSpot build variables that can be set by the -D option to "mx build":') |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
546 mx.log('') |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
547 for n in sorted(buildVars.iterkeys()): |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
548 mx.log(n) |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
549 mx.log(textwrap.fill(buildVars[n], initial_indent=' ', subsequent_indent=' ', width=200)) |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
550 |
4577
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
551 def build(args, vm=None): |
4575
ccb5369481a2
Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents:
4572
diff
changeset
|
552 """build the VM binary |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
553 |
4575
ccb5369481a2
Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents:
4572
diff
changeset
|
554 The global '--vm' option selects which VM to build. This command also |
ccb5369481a2
Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents:
4572
diff
changeset
|
555 compiles the Graal classes irrespective of what VM is being built. |
ccb5369481a2
Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents:
4572
diff
changeset
|
556 The optional last argument specifies what build level is to be used |
ccb5369481a2
Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents:
4572
diff
changeset
|
557 for the VM binary.""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
558 |
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
559 # Call mx.build to compile the Java sources |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
560 parser=ArgumentParser(prog='mx build') |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
561 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value') |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
562 opts2 = mx.build(['--source', '1.7'] + args, parser=parser) |
4145
9aee7df31417
Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents:
4144
diff
changeset
|
563 |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
564 if not _vmSourcesAvailable or not opts2.native: |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
565 return |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
566 |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
567 builds = opts2.remainder |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
568 if len(builds) == 0: |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
569 builds = ['product'] |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
570 |
4577
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
571 if vm is None: |
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
572 vm = _vm |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
573 |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
574 if vm.startswith('server') or vm == 'boot': |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
575 buildSuffix = '' |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
576 elif vm.startswith('client'): |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
577 buildSuffix = '1' |
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
578 else: |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
579 assert vm == 'graal', vm |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
580 buildSuffix = 'graal' |
8302
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
581 |
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
582 initantbuild([]) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
583 |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
584 for build in builds: |
5094
d3f547b08304
added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents:
5090
diff
changeset
|
585 if build == 'ide-build-target': |
d3f547b08304
added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents:
5090
diff
changeset
|
586 build = os.environ.get('IDE_BUILD_TARGET', 'product') |
d3f547b08304
added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents:
5090
diff
changeset
|
587 if len(build) == 0: |
d3f547b08304
added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents:
5090
diff
changeset
|
588 mx.log('[skipping build from IDE as IDE_BUILD_TARGET environment variable is ""]') |
d3f547b08304
added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents:
5090
diff
changeset
|
589 continue |
d3f547b08304
added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents:
5090
diff
changeset
|
590 |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
591 jdk = _jdk(build, create=True) |
8647
5f8299106dd9
A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8646
diff
changeset
|
592 |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
593 if vm == 'boot': |
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
594 if build != 'product': |
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
595 mx.log('only product build of boot VM exists') |
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
596 continue |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
597 |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
598 vmDir = join(_vmLibDirInJdk(jdk), vm) |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
599 if not exists(vmDir): |
6687
a9a50f21e000
Added change to copied directory's protection when source JDK directories are read-only.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6566
diff
changeset
|
600 if mx.get_os() != 'windows': |
6705
0cb1ac637dd0
Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6702
diff
changeset
|
601 chmodRecursive(jdk, 0755) |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
602 mx.log('Creating VM directory in JDK7: ' + vmDir) |
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
603 os.makedirs(vmDir) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
604 |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
605 def filterXusage(line): |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
606 if not 'Xusage.txt' in line: |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
607 sys.stderr.write(line + os.linesep) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
608 |
5239
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
609 # Check if a build really needs to be done |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
610 timestampFile = join(vmDir, '.build-timestamp') |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
611 if opts2.force or not exists(timestampFile): |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
612 mustBuild = True |
5239
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
613 else: |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
614 mustBuild = False |
5239
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
615 timestamp = os.path.getmtime(timestampFile) |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
616 sources = [] |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
617 for d in ['src', 'make']: |
5244
55ff4ba8d7b1
ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents:
5239
diff
changeset
|
618 for root, dirnames, files in os.walk(join(_graal_home, d)): |
5239
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
619 # ignore <graal>/src/share/tools |
5244
55ff4ba8d7b1
ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents:
5239
diff
changeset
|
620 if root == join(_graal_home, 'src', 'share'): |
55ff4ba8d7b1
ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents:
5239
diff
changeset
|
621 dirnames.remove('tools') |
55ff4ba8d7b1
ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents:
5239
diff
changeset
|
622 sources += [join(root, name) for name in files] |
5239
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
623 for f in sources: |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
624 if len(f) != 0 and os.path.getmtime(f) > timestamp: |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
625 mustBuild = True |
5244
55ff4ba8d7b1
ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents:
5239
diff
changeset
|
626 break |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
627 |
5239
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
628 if not mustBuild: |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
629 mx.log('[all files in src and make directories are older than ' + timestampFile[len(_graal_home) + 1:] + ' - skipping native build]') |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
630 continue |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
631 |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
632 if platform.system() == 'Windows': |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
633 compilelogfile = _graal_home + '/graalCompile.log' |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
634 mksHome = mx.get_env('MKS_HOME', 'C:\\cygwin\\bin') |
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
635 |
4572
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4559
diff
changeset
|
636 variant = {'client': 'compiler1', 'server': 'compiler2'}.get(vm, vm) |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4559
diff
changeset
|
637 project_config = variant + '_' + build |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4559
diff
changeset
|
638 _runInDebugShell('msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=' + project_config + ' /target:clean', _graal_home) |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4559
diff
changeset
|
639 winCompileCmd = r'set HotSpotMksHome=' + mksHome + r'& set OUT_DIR=' + jdk + r'& set JAVA_HOME=' + jdk + r'& set path=%JAVA_HOME%\bin;%path%;%HotSpotMksHome%& cd /D "' +_graal_home + r'\make\windows"& call create.bat ' + _graal_home |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
640 print(winCompileCmd) |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
641 winCompileSuccess = re.compile(r"^Writing \.vcxproj file:") |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
642 if not _runInDebugShell(winCompileCmd, _graal_home, compilelogfile, winCompileSuccess): |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
643 mx.log('Error executing create command') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
644 return |
4572
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4559
diff
changeset
|
645 winBuildCmd = 'msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=' + project_config + ' /p:Platform=x64' |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
646 if not _runInDebugShell(winBuildCmd, _graal_home, compilelogfile): |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
647 mx.log('Error building project') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
648 return |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
649 else: |
4582
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
650 cpus = multiprocessing.cpu_count() |
6718
cce59a7ee92c
Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6705
diff
changeset
|
651 runCmd = [mx.gmake_cmd()] |
4572
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4559
diff
changeset
|
652 if build == 'debug': |
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4559
diff
changeset
|
653 build = 'jvmg' |
6718
cce59a7ee92c
Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6705
diff
changeset
|
654 runCmd.append(build + buildSuffix) |
8884
51a8368d0231
Adapt to changes in hotspot makefiles : pass our JAVA_HOME as ALT_BOOTDIR (so that things are built with a 'safe' jdk) and our jdk copy as JAVA_HOME (so that the jvm gets installed there)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8647
diff
changeset
|
655 env = os.environ.copy() |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
656 |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
657 if opts2.D: |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
658 for nv in opts2.D: |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
659 name, value = nv.split('=', 1) |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
660 env[name.strip()] = value |
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
661 |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
662 env.setdefault('ARCH_DATA_MODEL', '64') |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
663 env.setdefault('LANG', 'C') |
4582
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
664 env.setdefault('HOTSPOT_BUILD_JOBS', str(cpus)) |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
665 env.setdefault('ALT_BOOTDIR', mx.java().jdk) |
8884
51a8368d0231
Adapt to changes in hotspot makefiles : pass our JAVA_HOME as ALT_BOOTDIR (so that things are built with a 'safe' jdk) and our jdk copy as JAVA_HOME (so that the jvm gets installed there)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8647
diff
changeset
|
666 env['JAVA_HOME'] = jdk |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
667 if vm.endswith('nograal'): |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
668 env['OMIT_GRAAL'] = 'true' |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
669 env.setdefault('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os())) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
670 else: |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
6958
diff
changeset
|
671 env['GRAAL'] = join(_graal_home, 'graal') # needed for TEST_IN_BUILD |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
672 env.setdefault('INSTALL', 'y') |
6702
602ee4d1db61
added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6701
diff
changeset
|
673 if mx.get_os() == 'solaris' : |
602ee4d1db61
added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6701
diff
changeset
|
674 # If using sparcWorks, setup flags to avoid make complaining about CC version |
602ee4d1db61
added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6701
diff
changeset
|
675 cCompilerVersion = subprocess.Popen('CC -V', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stderr.readlines()[0] |
602ee4d1db61
added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6701
diff
changeset
|
676 if cCompilerVersion.startswith('CC: Sun C++') : |
602ee4d1db61
added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6701
diff
changeset
|
677 compilerRev = cCompilerVersion.split(' ')[3] |
6718
cce59a7ee92c
Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6705
diff
changeset
|
678 env.setdefault('ENFORCE_COMPILER_REV', compilerRev) |
cce59a7ee92c
Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6705
diff
changeset
|
679 env.setdefault('ENFORCE_CC_COMPILER_REV', compilerRev) |
cce59a7ee92c
Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6705
diff
changeset
|
680 if build == 'jvmg': |
cce59a7ee92c
Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6705
diff
changeset
|
681 # I want ALL the symbols when I'm debugging on Solaris |
cce59a7ee92c
Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6705
diff
changeset
|
682 # Some Makefile variable are overloaded by environment variable so we need to explicitely |
cce59a7ee92c
Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6705
diff
changeset
|
683 # pass them down in the command line. This one is an example of that. |
cce59a7ee92c
Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6705
diff
changeset
|
684 runCmd.append('STRIP_POLICY=no_strip') |
6276
03c4c25ae726
disabled zipping of lib*.debuginfo files to simplify debugging with gdb
Doug Simon <doug.simon@oracle.com>
parents:
5881
diff
changeset
|
685 # This removes the need to unzip the *.diz files before debugging in gdb |
03c4c25ae726
disabled zipping of lib*.debuginfo files to simplify debugging with gdb
Doug Simon <doug.simon@oracle.com>
parents:
5881
diff
changeset
|
686 env.setdefault('ZIP_DEBUGINFO_FILES', '0') |
03c4c25ae726
disabled zipping of lib*.debuginfo files to simplify debugging with gdb
Doug Simon <doug.simon@oracle.com>
parents:
5881
diff
changeset
|
687 |
7548
a8b0476270cf
disabled running of Queens test (i.e., test_gamma) in normal HotSpot builds
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
688 # We don't need to run the Queens test (i.e. test_gamma) |
a8b0476270cf
disabled running of Queens test (i.e., test_gamma) in normal HotSpot builds
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
689 env.setdefault('TEST_IN_BUILD', 'false') |
a8b0476270cf
disabled running of Queens test (i.e., test_gamma) in normal HotSpot builds
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
690 |
4582
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
691 # Clear these 2 variables as having them set can cause very confusing build problems |
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
692 env.pop('LD_LIBRARY_PATH', None) |
b24386206122
Made all vm builds go into subdirectories, even product builds to simplify building the various types of VMs (server, client and graal).
Doug Simon <doug.simon@oracle.com>
parents:
4577
diff
changeset
|
693 env.pop('CLASSPATH', None) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
694 |
8884
51a8368d0231
Adapt to changes in hotspot makefiles : pass our JAVA_HOME as ALT_BOOTDIR (so that things are built with a 'safe' jdk) and our jdk copy as JAVA_HOME (so that the jvm gets installed there)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8647
diff
changeset
|
695 mx.run(runCmd, cwd=join(_graal_home, 'make'), err=filterXusage, env=env) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
696 |
5680
87fc13b59258
Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5649
diff
changeset
|
697 jvmCfg = _vmCfgInJdk(jdk) |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
698 if not exists(jvmCfg): |
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
699 mx.abort(jvmCfg + ' does not exist') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
700 |
8901
8ddaac81cb21
Be more careful while updating jvm.cfg (fixes a bug where the -server configuration would overwrite the -server0 one)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8900
diff
changeset
|
701 prefix = '-' + vm + ' ' |
8ddaac81cb21
Be more careful while updating jvm.cfg (fixes a bug where the -server configuration would overwrite the -server0 one)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8900
diff
changeset
|
702 vmKnown = prefix + 'KNOWN\n' |
8889
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
703 lines = [] |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
704 found = False |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
705 with open(jvmCfg) as f: |
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
706 for line in f: |
8889
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
707 if line.strip() == vmKnown.strip(): |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
708 found = True |
8889
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
709 lines.append(line) |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
710 |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
711 if not found: |
8901
8ddaac81cb21
Be more careful while updating jvm.cfg (fixes a bug where the -server configuration would overwrite the -server0 one)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8900
diff
changeset
|
712 mx.log('Appending "' + prefix + 'KNOWN" to ' + jvmCfg) |
6688
806821a1c0a8
Make sure files in copy of JDK has write-protection unset before modifying it.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6687
diff
changeset
|
713 if mx.get_os() != 'windows': |
806821a1c0a8
Make sure files in copy of JDK has write-protection unset before modifying it.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6687
diff
changeset
|
714 os.chmod(jvmCfg, 0755) |
8889
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
715 with open(jvmCfg, 'w') as f: |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
716 for line in lines: |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
717 if line.startswith(prefix): |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
718 line = vmKnown |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
719 found = True |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
720 f.write(line) |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
721 if not found: |
c669e8e621a1
Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8887
diff
changeset
|
722 f.write(vmKnown) |
5194
a6eceb5efb0e
added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents:
5189
diff
changeset
|
723 |
5239
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
724 if exists(timestampFile): |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
725 os.utime(timestampFile, None) |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
726 else: |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
727 file(timestampFile, 'a') |
b9db4fee6eb2
skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents:
5234
diff
changeset
|
728 |
5257
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
729 def vmg(args): |
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
730 """run the debug build of VM selected by the '--vm' option""" |
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
731 return vm(args, vmbuild='debug') |
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
732 |
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
733 def vmfg(args): |
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
734 """run the fastdebug build of VM selected by the '--vm' option""" |
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
735 return vm(args, vmbuild='fastdebug') |
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
736 |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
737 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): |
4575
ccb5369481a2
Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents:
4572
diff
changeset
|
738 """run the VM selected by the '--vm' option""" |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
739 |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
740 if vm is None: |
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
741 vm = _vm |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
742 |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
743 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' |
8261
2237260c6fdb
the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents:
8223
diff
changeset
|
744 jdk = _jdk(build, vmToCheck=vm) |
5189
6fbf12b8e572
automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents:
5153
diff
changeset
|
745 mx.expand_project_in_args(args) |
5194
a6eceb5efb0e
added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents:
5189
diff
changeset
|
746 if _make_eclipse_launch: |
a6eceb5efb0e
added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents:
5189
diff
changeset
|
747 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True)) |
5189
6fbf12b8e572
automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents:
5153
diff
changeset
|
748 if len([a for a in args if 'PrintAssembly' in a]) != 0: |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
749 hsdis([], copyToDir=_vmLibDirInJdk(jdk)) |
5032
e2de9649f0a9
Integrated mxtool updates from Maxine project.
Doug Simon <doug.simon@oracle.com>
parents:
5024
diff
changeset
|
750 if mx.java().debug_port is not None: |
e2de9649f0a9
Integrated mxtool updates from Maxine project.
Doug Simon <doug.simon@oracle.com>
parents:
5024
diff
changeset
|
751 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(mx.java().debug_port)] + args |
5024
7ccdae96e98a
Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5016
diff
changeset
|
752 if _jacoco == 'on' or _jacoco == 'append': |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
753 jacocoagent = mx.library("JACOCOAGENT", True) |
5366
67e63e8dcbd2
build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents:
5295
diff
changeset
|
754 # Exclude all compiler tests and snippets |
5881
472a648769e4
better JaCoCo : only include com.oracle.graal.* and com.oracle.max.*, exclude com.oracle.graal.jtt.*
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5878
diff
changeset
|
755 excludes = ['com.oracle.graal.compiler.tests.*', 'com.oracle.graal.jtt.*'] |
5366
67e63e8dcbd2
build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents:
5295
diff
changeset
|
756 for p in mx.projects(): |
8607
c7672a325faf
search for classes containing annotations returns source file as well as class name
Doug Simon <doug.simon@oracle.com>
parents:
8554
diff
changeset
|
757 excludes += _find_classes_with_annotations(p, None, ['@Snippet', '@ClassSubstitution', '@Test'], includeInnerClasses=True).keys() |
c7672a325faf
search for classes containing annotations returns source file as well as class name
Doug Simon <doug.simon@oracle.com>
parents:
8554
diff
changeset
|
758 excludes += p.find_classes_with_matching_source_line(None, lambda line: 'JaCoCo Exclude' in line, includeInnerClasses=True).keys() |
5762
b30cced39597
generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5729
diff
changeset
|
759 |
5881
472a648769e4
better JaCoCo : only include com.oracle.graal.* and com.oracle.max.*, exclude com.oracle.graal.jtt.*
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5878
diff
changeset
|
760 includes = ['com.oracle.graal.*', 'com.oracle.max.*'] |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
761 agentOptions = { |
5024
7ccdae96e98a
Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5016
diff
changeset
|
762 'append' : 'true' if _jacoco == 'append' else 'false', |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
763 'bootclasspath' : 'true', |
5881
472a648769e4
better JaCoCo : only include com.oracle.graal.* and com.oracle.max.*, exclude com.oracle.graal.jtt.*
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5878
diff
changeset
|
764 'includes' : ':'.join(includes), |
5878
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
765 'excludes' : ':'.join(excludes), |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
766 'destfile' : 'jacoco.exec' |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
767 } |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
768 args = ['-javaagent:' + jacocoagent.get_path(True) + '=' + ','.join([k + '=' + v for k, v in agentOptions.items()])] + args |
6691
9611d0ccb4ec
Automatically add -d64 vm options when running graal
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6688
diff
changeset
|
769 if '-d64' not in args: |
9611d0ccb4ec
Automatically add -d64 vm options when running graal
Laurent Daynes <Laurent.Daynes@oracle.com>
parents:
6688
diff
changeset
|
770 args = ['-d64'] + args |
8132
394f685c1502
prepend -XX:GraalClassPath option if graal.jar exists (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
7925
diff
changeset
|
771 |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
772 exe = join(jdk, 'bin', mx.exe_suffix('java')) |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5871
diff
changeset
|
773 dbg = _native_dbg.split() if _native_dbg is not None else [] |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5871
diff
changeset
|
774 return mx.run(dbg + [exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) |
3718 | 775 |
5762
b30cced39597
generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5729
diff
changeset
|
776 def _find_classes_with_annotations(p, pkgRoot, annotations, includeInnerClasses=False): |
5366
67e63e8dcbd2
build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents:
5295
diff
changeset
|
777 """ |
5482
9f4783c0269e
folded -G:+CheckcastCounters functionality into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5438
diff
changeset
|
778 Scan the sources of project 'p' for Java source files containing a line starting with 'annotation' |
5762
b30cced39597
generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5729
diff
changeset
|
779 (ignoring preceding whitespace) and return the fully qualified class name for each Java |
b30cced39597
generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5729
diff
changeset
|
780 source file matched in a list. |
5366
67e63e8dcbd2
build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents:
5295
diff
changeset
|
781 """ |
5762
b30cced39597
generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5729
diff
changeset
|
782 |
b30cced39597
generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5729
diff
changeset
|
783 matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 |
b30cced39597
generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5729
diff
changeset
|
784 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) |
5366
67e63e8dcbd2
build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents:
5295
diff
changeset
|
785 |
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
786 def _run_tests(args, harness, annotations, testfile): |
4630
ef0ff914c10f
Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4602
diff
changeset
|
787 pos = [a for a in args if a[0] != '-' and a[0] != '@' ] |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
788 neg = [a[1:] for a in args if a[0] == '-'] |
4630
ef0ff914c10f
Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4602
diff
changeset
|
789 vmArgs = [a[1:] for a in args if a[0] == '@'] |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
790 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
791 def containsAny(c, substrings): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
792 for s in substrings: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
793 if s in c: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
794 return True |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
795 return False |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
796 |
8343
a3c30d467f96
unittest: just do a single JVM call
Bernhard Urban <bernhard.urban@jku.at>
parents:
8340
diff
changeset
|
797 classes = [] |
5649
14505f3e6b4c
modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents:
5596
diff
changeset
|
798 for p in mx.projects(): |
8607
c7672a325faf
search for classes containing annotations returns source file as well as class name
Doug Simon <doug.simon@oracle.com>
parents:
8554
diff
changeset
|
799 classes += _find_classes_with_annotations(p, None, annotations).keys() |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
800 |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
801 if len(pos) != 0: |
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
802 classes = [c for c in classes if containsAny(c, pos)] |
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
803 if len(neg) != 0: |
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
804 classes = [c for c in classes if not containsAny(c, neg)] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
805 |
8343
a3c30d467f96
unittest: just do a single JVM call
Bernhard Urban <bernhard.urban@jku.at>
parents:
8340
diff
changeset
|
806 projectscp = mx.classpath([pcp.name for pcp in mx.projects()]) |
a3c30d467f96
unittest: just do a single JVM call
Bernhard Urban <bernhard.urban@jku.at>
parents:
8340
diff
changeset
|
807 |
a3c30d467f96
unittest: just do a single JVM call
Bernhard Urban <bernhard.urban@jku.at>
parents:
8340
diff
changeset
|
808 if len(classes) != 0: |
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
809 f_testfile = open(testfile, 'w') |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
810 for c in classes: |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
811 f_testfile.write(c + '\n') |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
812 f_testfile.close() |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
813 harness(projectscp, vmArgs) |
5649
14505f3e6b4c
modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents:
5596
diff
changeset
|
814 |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
815 def _unittest(args, annotations): |
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
816 mxdir = dirname(__file__) |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
817 name = 'JUnitWrapper' |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
818 javaSource = join(mxdir, name + '.java') |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
819 javaClass = join(mxdir, name + '.class') |
9010
08a16c26907f
MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents:
8901
diff
changeset
|
820 testfile = os.environ.get('MX_TESTFILE', None) |
08a16c26907f
MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents:
8901
diff
changeset
|
821 if testfile is None: |
08a16c26907f
MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents:
8901
diff
changeset
|
822 (_, testfile) = tempfile.mkstemp(".testclasses", "graal") |
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
823 |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
824 def harness(projectscp, vmArgs): |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
825 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource): |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
826 subprocess.check_call([mx.java().javac, '-cp', projectscp, '-d', mxdir, javaSource]) |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
827 if _vm == 'boot' or _vm.endswith('nograal'): |
8440
2d0160c35f8f
Fix unittest on server0.
Roland Schatz <roland.schatz@oracle.com>
parents:
8433
diff
changeset
|
828 prefixArgs = ['-esa', '-ea'] |
2d0160c35f8f
Fix unittest on server0.
Roland Schatz <roland.schatz@oracle.com>
parents:
8433
diff
changeset
|
829 else: |
2d0160c35f8f
Fix unittest on server0.
Roland Schatz <roland.schatz@oracle.com>
parents:
8433
diff
changeset
|
830 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea'] |
8619
c1c0ca020d98
mx/unittest: make it more portable across systems
Bernhard Urban <bernhard.urban@jku.at>
parents:
8607
diff
changeset
|
831 vm(prefixArgs + vmArgs + ['-cp', projectscp + os.pathsep + mxdir, name] + [testfile]) |
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
8343
diff
changeset
|
832 |
8433
87346100d7a5
temporary file is removed when unittests fail
Doug Simon <doug.simon@oracle.com>
parents:
8406
diff
changeset
|
833 try: |
87346100d7a5
temporary file is removed when unittests fail
Doug Simon <doug.simon@oracle.com>
parents:
8406
diff
changeset
|
834 _run_tests(args, harness, annotations, testfile) |
87346100d7a5
temporary file is removed when unittests fail
Doug Simon <doug.simon@oracle.com>
parents:
8406
diff
changeset
|
835 finally: |
9010
08a16c26907f
MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents:
8901
diff
changeset
|
836 if os.environ.get('MX_TESTFILE') is None: |
08a16c26907f
MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents:
8901
diff
changeset
|
837 os.remove(testfile) |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
838 |
5649
14505f3e6b4c
modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents:
5596
diff
changeset
|
839 def unittest(args): |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
840 """run the JUnit tests (all testcases) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
841 |
5649
14505f3e6b4c
modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents:
5596
diff
changeset
|
842 If filters are supplied, only tests whose fully qualified name |
14505f3e6b4c
modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents:
5596
diff
changeset
|
843 include a filter as a substring are run. Negative filters are |
14505f3e6b4c
modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents:
5596
diff
changeset
|
844 those with a '-' prefix. VM args should have a @ prefix.""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
845 |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
846 _unittest(args, ['@Test', '@LongTest']) |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
847 |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
848 def shortunittest(args): |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
849 """run the JUnit tests (short testcases only) |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
850 |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
851 If filters are supplied, only tests whose fully qualified name |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
852 include a filter as a substring are run. Negative filters are |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
853 those with a '-' prefix. VM args should have a @ prefix.""" |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
854 |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
855 _unittest(args, ['@Test']) |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
856 |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
857 def longunittest(args): |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
858 """run the JUnit tests (long testcases only) |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
859 |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
860 If filters are supplied, only tests whose fully qualified name |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
861 include a filter as a substring are run. Negative filters are |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
862 those with a '-' prefix. VM args should have a @ prefix.""" |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
863 |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
864 _unittest(args, ['@LongTest']) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
865 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
866 def buildvms(args): |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
867 """build one or more VMs in various configurations""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
868 |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
869 vmsDefault = ','.join(_vmChoices) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
870 vmbuildsDefault = ','.join(_vmbuildChoices) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
871 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
872 parser = ArgumentParser(prog='mx buildvms'); |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
873 parser.add_argument('--vms', help='a comma separated list of VMs to build (default: ' + vmsDefault + ')', metavar='<args>', default=vmsDefault) |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
874 parser.add_argument('--builds', help='a comma separated list of build types (default: ' + vmbuildsDefault + ')', metavar='<args>', default=vmbuildsDefault) |
9096
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
875 parser.add_argument('-n', '--no-check', action='store_true', help='omit running "java -version" after each build') |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
876 parser.add_argument('-c', '--console', action='store_true', help='send build output to console instead of log file') |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
877 |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
878 args = parser.parse_args(args) |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
879 vms = args.vms.split(',') |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
880 builds = args.builds.split(',') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
881 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
882 allStart = time.time() |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
883 for v in vms: |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
884 for vmbuild in builds: |
9098
d766fd8eede0
VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents:
9097
diff
changeset
|
885 if v == 'boot' and vmbuild != 'product': |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
886 continue |
9097
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
887 if not args.console: |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
888 logFile = join(v + '-' + vmbuild + '.log') |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
889 log = open(join(_graal_home, logFile), 'wb') |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
890 start = time.time() |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
891 mx.log('BEGIN: ' + v + '-' + vmbuild + '\t(see: ' + logFile + ')') |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
892 # Run as subprocess so that output can be directed to a file |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
893 subprocess.check_call([sys.executable, '-u', join('mxtool', 'mx.py'), '--vm', v, 'build', vmbuild], cwd=_graal_home, stdout=log, stderr=subprocess.STDOUT) |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
894 duration = datetime.timedelta(seconds=time.time() - start) |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
895 mx.log('END: ' + v + '-' + vmbuild + '\t[' + str(duration) + ']') |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
896 else: |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
897 global _vm |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
898 _vm = v |
a0ab945fb95f
build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents:
9096
diff
changeset
|
899 build([vmbuild]) |
9096
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
900 if not args.no_check: |
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
901 vmargs = ['-version'] |
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
902 if v == 'graal': |
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
903 vmargs.insert(0, '-XX:-BootstrapGraal') |
d4b868ed9cfb
buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents:
9095
diff
changeset
|
904 vm(vmargs, vm=v, vmbuild=vmbuild) |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
905 allDuration = datetime.timedelta(seconds=time.time() - allStart) |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
906 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']') |
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
907 |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
908 def gate(args): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
909 """run the tests used to validate a push |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
910 |
4438
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
911 If this command exits with a 0 exit code, then the source code is in |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
912 a state that would be accepted for integration into the main repository.""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
913 |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
914 class Task: |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
915 def __init__(self, title): |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
916 self.start = time.time() |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
917 self.title = title |
4438
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
918 self.end = None |
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
919 self.duration = None |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
920 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title) |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
921 def stop(self): |
4438
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
922 self.end = time.time() |
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
923 self.duration = datetime.timedelta(seconds=self.end - self.start) |
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
924 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: END: ') + self.title + ' [' + str(self.duration) + ']') |
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
925 return self |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
926 def abort(self, codeOrMessage): |
4438
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
927 self.end = time.time() |
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
928 self.duration = datetime.timedelta(seconds=self.end - self.start) |
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
929 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: ABORT: ') + self.title + ' [' + str(self.duration) + ']') |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
930 mx.abort(codeOrMessage) |
4438
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
931 return self |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
932 |
4601
ade18666f2be
Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents:
4584
diff
changeset
|
933 parser = ArgumentParser(prog='mx gate'); |
5232
c005ca943790
added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents:
5197
diff
changeset
|
934 parser.add_argument('-j', '--omit-java-clean', action='store_false', dest='cleanJava', help='omit cleaning Java native code') |
5750
30876d0bb92d
In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5729
diff
changeset
|
935 parser.add_argument('-n', '--omit-native-clean', action='store_false', dest='cleanNative', help='omit cleaning and building native code') |
4608
05a33fabcfe6
Added -g option to 'mx gate' to omit the server and client builds (i.e. -g == graal only).
Doug Simon <doug.simon@oracle.com>
parents:
4607
diff
changeset
|
936 parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM') |
5033
d7ecce178ad2
Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5032
diff
changeset
|
937 parser.add_argument('--jacocout', help='specify the output directory for jacoco report') |
4601
ade18666f2be
Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents:
4584
diff
changeset
|
938 |
ade18666f2be
Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents:
4584
diff
changeset
|
939 args = parser.parse_args(args) |
ade18666f2be
Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents:
4584
diff
changeset
|
940 |
5431
0bd1ba69db2a
removed double declaration of _vmbuild global variable in gate command
Doug Simon <doug.simon@oracle.com>
parents:
5430
diff
changeset
|
941 global _vmbuild |
0bd1ba69db2a
removed double declaration of _vmbuild global variable in gate command
Doug Simon <doug.simon@oracle.com>
parents:
5430
diff
changeset
|
942 global _vm |
0bd1ba69db2a
removed double declaration of _vmbuild global variable in gate command
Doug Simon <doug.simon@oracle.com>
parents:
5430
diff
changeset
|
943 global _jacoco |
5878
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
944 |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
945 tasks = [] |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
946 total = Task('Gate') |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
947 try: |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
948 |
4438
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
949 t = Task('Clean') |
5232
c005ca943790
added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents:
5197
diff
changeset
|
950 cleanArgs = [] |
5750
30876d0bb92d
In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5729
diff
changeset
|
951 if not args.cleanNative: |
5232
c005ca943790
added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents:
5197
diff
changeset
|
952 cleanArgs.append('--no-native') |
c005ca943790
added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents:
5197
diff
changeset
|
953 if not args.cleanJava: |
c005ca943790
added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents:
5197
diff
changeset
|
954 cleanArgs.append('--no-java') |
c005ca943790
added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents:
5197
diff
changeset
|
955 clean(cleanArgs) |
4438
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
956 tasks.append(t.stop()) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
957 |
7533
29b0768b7ba6
added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
958 eclipse_exe = os.environ.get('ECLIPSE_EXE') |
29b0768b7ba6
added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
959 if eclipse_exe is not None: |
29b0768b7ba6
added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
960 t = Task('CodeFormatCheck') |
29b0768b7ba6
added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
961 if mx.eclipseformat(['-e', eclipse_exe]) != 0: |
29b0768b7ba6
added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
962 t.abort('Formatter modified files - run "mx eclipseformat", check in changes and repush') |
29b0768b7ba6
added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
963 tasks.append(t.stop()) |
8211
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
964 |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
965 t = Task('Canonicalization Check') |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
966 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
967 if mx.canonicalizeprojects([]) != 0: |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
968 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
969 tasks.append(t.stop()) |
7533
29b0768b7ba6
added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7509
diff
changeset
|
970 |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
971 t = Task('BuildJava') |
7748
2d57a3bd82ab
Make gate fail on warnings
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7730
diff
changeset
|
972 build(['--no-native', '--jdt-warning-as-error']) |
4438
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
973 tasks.append(t.stop()) |
5878
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
974 |
8211
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
975 t = Task('Checkstyle') |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
976 if mx.checkstyle([]) != 0: |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
977 t.abort('Checkstyle warnings were found') |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
978 tasks.append(t.stop()) |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
979 |
5878
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
980 if exists('jacoco.exec'): |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
981 os.unlink('jacoco.exec') |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
982 |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
983 if args.jacocout is not None: |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
984 _jacoco = 'append' |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
985 else: |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
986 _jacoco = 'off' |
6319
0a0d0dfd83bc
Gate : do not run tradesoap in fastdebug mode, do not run sunflow in product mode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6306
diff
changeset
|
987 |
0a0d0dfd83bc
Gate : do not run tradesoap in fastdebug mode, do not run sunflow in product mode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6306
diff
changeset
|
988 t = Task('BuildHotSpotGraal: fastdebug,product') |
8211
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
989 buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product']) |
6319
0a0d0dfd83bc
Gate : do not run tradesoap in fastdebug mode, do not run sunflow in product mode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6306
diff
changeset
|
990 tasks.append(t.stop()) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
991 |
6319
0a0d0dfd83bc
Gate : do not run tradesoap in fastdebug mode, do not run sunflow in product mode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6306
diff
changeset
|
992 _vmbuild = 'fastdebug' |
0a0d0dfd83bc
Gate : do not run tradesoap in fastdebug mode, do not run sunflow in product mode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6306
diff
changeset
|
993 t = Task('BootstrapWithSystemAssertions:fastdebug') |
0a0d0dfd83bc
Gate : do not run tradesoap in fastdebug mode, do not run sunflow in product mode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6306
diff
changeset
|
994 vm(['-esa', '-version']) |
0a0d0dfd83bc
Gate : do not run tradesoap in fastdebug mode, do not run sunflow in product mode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6306
diff
changeset
|
995 tasks.append(t.stop()) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
996 |
6319
0a0d0dfd83bc
Gate : do not run tradesoap in fastdebug mode, do not run sunflow in product mode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6306
diff
changeset
|
997 _vmbuild = 'product' |
8223
b9eb0d939e60
Add bootstrap with register pressure to gate tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
8211
diff
changeset
|
998 t = Task('BootstrapWithRegisterPressure:product') |
b9eb0d939e60
Add bootstrap with register pressure to gate tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
8211
diff
changeset
|
999 vm(['-G:RegisterPressure=rbx,r11,r14,xmm3,xmm11,xmm14', '-esa', '-version']) |
b9eb0d939e60
Add bootstrap with register pressure to gate tests.
Roland Schatz <roland.schatz@oracle.com>
parents:
8211
diff
changeset
|
1000 tasks.append(t.stop()) |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1001 |
8211
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
1002 originalVm = _vm |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
1003 _vm = 'server' # hosted mode |
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
1004 t = Task('UnitTests:hosted-product') |
7289
d1aa5ffac560
Remove CompileCommand that excluses run* for unittests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7287
diff
changeset
|
1005 unittest([]) |
6319
0a0d0dfd83bc
Gate : do not run tradesoap in fastdebug mode, do not run sunflow in product mode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6306
diff
changeset
|
1006 tasks.append(t.stop()) |
8211
74896b25297a
Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8183
diff
changeset
|
1007 _vm = originalVm |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1008 |
6319
0a0d0dfd83bc
Gate : do not run tradesoap in fastdebug mode, do not run sunflow in product mode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6306
diff
changeset
|
1009 for vmbuild in ['fastdebug', 'product']: |
4240
394424b7df1a
Disabled certain DaCapo tests for fastdebug testing in the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4238
diff
changeset
|
1010 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): |
4238
e0d09e05aa9b
Made the gate time each DaCapo test individually.
Doug Simon <doug.simon@oracle.com>
parents:
4235
diff
changeset
|
1011 t = Task(str(test) + ':' + vmbuild) |
4417
648a7873cea2
Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents:
4407
diff
changeset
|
1012 if not test.test('graal'): |
5244
55ff4ba8d7b1
ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents:
5239
diff
changeset
|
1013 t.abort(test.name + ' Failed') |
4438
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
1014 tasks.append(t.stop()) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1015 |
5033
d7ecce178ad2
Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5032
diff
changeset
|
1016 if args.jacocout is not None: |
d7ecce178ad2
Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5032
diff
changeset
|
1017 jacocoreport([args.jacocout]) |
5878
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
1018 |
191e08da4de4
Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5877
diff
changeset
|
1019 _jacoco = 'off' |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1020 |
5016
c142a64141a8
Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4684
diff
changeset
|
1021 t = Task('CleanAndBuildGraalVisualizer') |
c142a64141a8
Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4684
diff
changeset
|
1022 mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-q', 'clean', 'build']) |
c142a64141a8
Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4684
diff
changeset
|
1023 tasks.append(t.stop()) |
c142a64141a8
Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4684
diff
changeset
|
1024 |
c142a64141a8
Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4684
diff
changeset
|
1025 # Prevent Graal modifications from breaking the standard builds |
5750
30876d0bb92d
In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5729
diff
changeset
|
1026 if args.buildNonGraal: |
5016
c142a64141a8
Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4684
diff
changeset
|
1027 t = Task('BuildHotSpotVarieties') |
c142a64141a8
Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4684
diff
changeset
|
1028 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) |
c142a64141a8
Reorder gate checks to do the important stuff first
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4684
diff
changeset
|
1029 tasks.append(t.stop()) |
5430
27536e9982fa
added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents:
5410
diff
changeset
|
1030 |
27536e9982fa
added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents:
5410
diff
changeset
|
1031 for vmbuild in ['product', 'fastdebug']: |
27536e9982fa
added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents:
5410
diff
changeset
|
1032 _vmbuild = vmbuild |
27536e9982fa
added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents:
5410
diff
changeset
|
1033 for theVm in ['client', 'server']: |
27536e9982fa
added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents:
5410
diff
changeset
|
1034 _vm = theVm |
27536e9982fa
added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents:
5410
diff
changeset
|
1035 |
27536e9982fa
added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents:
5410
diff
changeset
|
1036 t = Task('DaCapo_pmd:' + theVm + ':' + vmbuild) |
27536e9982fa
added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents:
5410
diff
changeset
|
1037 dacapo(['pmd']) |
27536e9982fa
added execution of DaCapo_pmd by [server|client]+[product|fastdebug] to the gate
Doug Simon <doug.simon@oracle.com>
parents:
5410
diff
changeset
|
1038 tasks.append(t.stop()) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1039 |
7155
c356cab093bc
added execution of the Graal API unittest with non-GraalVM HotSpot builds to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
1040 t = Task('UnitTests:' + theVm + ':' + vmbuild) |
c356cab093bc
added execution of the Graal API unittest with non-GraalVM HotSpot builds to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
1041 unittest(['@-XX:CompileCommand=exclude,*::run*', 'graal.api']) |
c356cab093bc
added execution of the Graal API unittest with non-GraalVM HotSpot builds to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
1042 tasks.append(t.stop()) |
c356cab093bc
added execution of the Graal API unittest with non-GraalVM HotSpot builds to the gate
Doug Simon <doug.simon@oracle.com>
parents:
7154
diff
changeset
|
1043 |
4247
3f6c6e61614e
Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents:
4244
diff
changeset
|
1044 except KeyboardInterrupt: |
3f6c6e61614e
Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents:
4244
diff
changeset
|
1045 total.abort(1) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1046 |
4584
7e5d8d1c74a1
Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents:
4582
diff
changeset
|
1047 except BaseException as e: |
4247
3f6c6e61614e
Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents:
4244
diff
changeset
|
1048 import traceback |
3f6c6e61614e
Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents:
4244
diff
changeset
|
1049 traceback.print_exc() |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
1050 total.abort(str(e)) |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
1051 |
4234
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
1052 total.stop() |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1053 |
4438
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
1054 mx.log('Gate task times:') |
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
1055 for t in tasks: |
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
1056 mx.log(' ' + str(t.duration) + '\t' + t.title) |
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
1057 mx.log(' =======') |
0312460af9fc
Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents:
4417
diff
changeset
|
1058 mx.log(' ' + str(total.duration)) |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1059 |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1060 def deoptalot(args): |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1061 """Bootstrap a fastdebug Graal VM with DeoptimizeALot and VerifyOops on |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1062 |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1063 If the first argument is a number, the process will be repeated |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1064 this number of times. All other arguments are passed to the VM.""" |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1065 count = 1 |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1066 if len(args) > 0 and args[0].isdigit(): |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1067 count = int(args[0]) |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1068 del args[0] |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1069 |
7509 | 1070 for _ in range(count): |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1071 if not vm(['-XX:+DeoptimizeALot', '-XX:+VerifyOops'] + args + ['-version'], vmbuild='fastdebug') == 0: |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1072 mx.abort("Failed") |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1073 |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1074 def longtests(args): |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1075 |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1076 deoptalot(['15', '-Xmx48m']) |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1077 |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1078 dacapo(['100', 'eclipse', '-esa']) |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
1079 |
4536
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
1080 def gv(args): |
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
1081 """run the Graal Visualizer""" |
5047
6bc165b0fdcd
Added 'intro' command to mx that runs a simple 'hello world' program and visualizes its compilation in the Graal Visualizer.
Doug Simon <doug.simon@oracle.com>
parents:
5034
diff
changeset
|
1082 with open(join(_graal_home, '.graal_visualizer.log'), 'w') as fp: |
5089
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1083 mx.log('[Graal Visualizer log is in ' + fp.name + ']') |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1084 if not exists(join(_graal_home, 'visualizer', 'build.xml')): |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1085 mx.log('[This initial execution may take a while as the NetBeans platform needs to be downloaded]') |
5047
6bc165b0fdcd
Added 'intro' command to mx that runs a simple 'hello world' program and visualizes its compilation in the Graal Visualizer.
Doug Simon <doug.simon@oracle.com>
parents:
5034
diff
changeset
|
1086 mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-l', fp.name, 'run']) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1087 |
5089
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1088 def igv(args): |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1089 """run the Ideal Graph Visualizer""" |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1090 with open(join(_graal_home, '.ideal_graph_visualizer.log'), 'w') as fp: |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1091 mx.log('[Ideal Graph Visualizer log is in ' + fp.name + ']') |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1092 if not exists(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform')): |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1093 mx.log('[This initial execution may take a while as the NetBeans platform needs to be downloaded]') |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1094 mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-l', fp.name, 'run']) |
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1095 |
4215
a2caa019ba3a
Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4187
diff
changeset
|
1096 def bench(args): |
4324
b0aa4a52b89c
Added support for project specs in classpath.
Doug Simon <doug.simon@oracle.com>
parents:
4294
diff
changeset
|
1097 """run benchmarks and parse their output for results |
4282
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1098 |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1099 Results are JSON formated : {group : {benchmark : score}}.""" |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1100 resultFile = None |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1101 if '-resultfile' in args: |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1102 index = args.index('-resultfile') |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1103 if index + 1 < len(args): |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1104 resultFile = args[index + 1] |
4293
d4906ea4255b
Handle SIGTERM : killing mx will properly kill subprocesses
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4288
diff
changeset
|
1105 del args[index] |
d4906ea4255b
Handle SIGTERM : killing mx will properly kill subprocesses
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4288
diff
changeset
|
1106 del args[index] |
4282
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1107 else: |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1108 mx.abort('-resultfile must be followed by a file name') |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
1109 vm = _vm |
4282
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1110 if len(args) is 0: |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1111 args = ['all'] |
8554
676a85b65481
allow Graal options to be passed to "mx bench"
Lukas Stadler <lukas.stadler@jku.at>
parents:
8515
diff
changeset
|
1112 |
8459
3393f870e6a4
Allow vm arguments in mx bench
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8440
diff
changeset
|
1113 vmArgs = [arg for arg in args if arg.startswith('-')] |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1114 |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1115 def benchmarks_in_group(group): |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1116 prefix = group + ':' |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1117 return [a[len(prefix):] for a in args if a.startswith(prefix)] |
4282
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1118 |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
1119 results = {} |
4282
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1120 benchmarks = [] |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
1121 #DaCapo |
4282
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1122 if ('dacapo' in args or 'all' in args): |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1123 benchmarks += sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark) |
4335
0d661161fa24
Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4330
diff
changeset
|
1124 else: |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1125 dacapos = benchmarks_in_group('dacapo') |
4335
0d661161fa24
Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4330
diff
changeset
|
1126 for dacapo in dacapos: |
0d661161fa24
Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4330
diff
changeset
|
1127 if dacapo not in sanitycheck.dacapoSanityWarmup.keys(): |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1128 mx.abort('Unknown DaCapo : ' + dacapo) |
8891
ca82d06ec93a
mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8890
diff
changeset
|
1129 iterations = sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark] |
ca82d06ec93a
mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8890
diff
changeset
|
1130 if (iterations > 0): |
ca82d06ec93a
mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8890
diff
changeset
|
1131 benchmarks += [sanitycheck.getDacapo(dacapo, iterations)] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1132 |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
1133 if ('scaladacapo' in args or 'all' in args): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
1134 benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark) |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
1135 else: |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1136 scaladacapos = benchmarks_in_group('scaladacapo') |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1137 for scaladacapo in scaladacapos: |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1138 if scaladacapo not in sanitycheck.dacapoScalaSanityWarmup.keys(): |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1139 mx.abort('Unknown Scala DaCapo : ' + scaladacapo) |
8891
ca82d06ec93a
mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8890
diff
changeset
|
1140 iterations = sanitycheck.dacapoScalaSanityWarmup[scaladacapo][sanitycheck.SanityCheckLevel.Benchmark] |
ca82d06ec93a
mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8890
diff
changeset
|
1141 if (iterations > 0): |
ca82d06ec93a
mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8890
diff
changeset
|
1142 benchmarks += [sanitycheck.getScalaDacapo(scaladacapo, iterations)] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1143 |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
1144 #Bootstrap |
4282
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1145 if ('bootstrap' in args or 'all' in args): |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1146 benchmarks += sanitycheck.getBootstraps() |
4230
b780ecb920c9
Add SPECjvm2008 to benchmarks, use dacapos defined in sanitycheck for the gate
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4228
diff
changeset
|
1147 #SPECjvm2008 |
4282
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1148 if ('specjvm2008' in args or 'all' in args): |
7345
dd903cdfe708
Add possibility for -ict option to SPECjvm2008 benchmark execution.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7299
diff
changeset
|
1149 benchmarks += [sanitycheck.getSPECjvm2008([], False, True, 120, 120)] |
4335
0d661161fa24
Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4330
diff
changeset
|
1150 else: |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1151 specjvms = benchmarks_in_group('specjvm2008') |
4335
0d661161fa24
Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4330
diff
changeset
|
1152 for specjvm in specjvms: |
7345
dd903cdfe708
Add possibility for -ict option to SPECjvm2008 benchmark execution.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7299
diff
changeset
|
1153 benchmarks += [sanitycheck.getSPECjvm2008([specjvm], False, True, 120, 120)] |
5877
0e54d9bb922d
Add SPECjbb2005 to the benchmarks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5875
diff
changeset
|
1154 |
0e54d9bb922d
Add SPECjbb2005 to the benchmarks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5875
diff
changeset
|
1155 if ('specjbb2005' in args or 'all' in args): |
0e54d9bb922d
Add SPECjbb2005 to the benchmarks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5875
diff
changeset
|
1156 benchmarks += [sanitycheck.getSPECjbb2005()] |
7565 | 1157 |
7730
cf27135ccf5b
Remove SPECjbb2013 from default benchmarks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7565
diff
changeset
|
1158 if ('specjbb2013' in args): # or 'all' in args //currently not in default set |
7565 | 1159 benchmarks += [sanitycheck.getSPECjbb2013()] |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1160 |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
1161 for test in benchmarks: |
8459
3393f870e6a4
Allow vm arguments in mx bench
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8440
diff
changeset
|
1162 for (groupName, res) in test.bench(vm, opts=vmArgs).items(): |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1163 group = results.setdefault(groupName, {}) |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
7552
diff
changeset
|
1164 group.update(res) |
4282
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1165 mx.log(json.dumps(results)) |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1166 if resultFile: |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1167 with open(resultFile, 'w') as f: |
063ea022532c
mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4276
diff
changeset
|
1168 f.write(json.dumps(results)) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1169 |
4228
e872562f95f8
add a simple specjvm2008 command, fail a benchmark if one of the failureRE matches
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4227
diff
changeset
|
1170 def specjvm2008(args): |
4537
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1171 """run one or all SPECjvm2008 benchmarks |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1172 |
7345
dd903cdfe708
Add possibility for -ict option to SPECjvm2008 benchmark execution.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7299
diff
changeset
|
1173 All options begining with - will be passed to the vm except for -ikv -ict -wt and -it. |
4537
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1174 Other options are supposed to be benchmark names and will be passed to SPECjvm2008.""" |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1175 benchArgs = [a for a in args if a[0] != '-'] |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1176 vmArgs = [a for a in args if a[0] == '-'] |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1177 wt = None |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1178 it = None |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1179 skipValid = False |
7345
dd903cdfe708
Add possibility for -ict option to SPECjvm2008 benchmark execution.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7299
diff
changeset
|
1180 skipCheck = False |
5295
31fc6b6c0425
Pass -v argument to SPECjvm2008 harness
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5269
diff
changeset
|
1181 if '-v' in vmArgs: |
31fc6b6c0425
Pass -v argument to SPECjvm2008 harness
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5269
diff
changeset
|
1182 vmArgs.remove('-v') |
31fc6b6c0425
Pass -v argument to SPECjvm2008 harness
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5269
diff
changeset
|
1183 benchArgs.append('-v') |
7345
dd903cdfe708
Add possibility for -ict option to SPECjvm2008 benchmark execution.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7299
diff
changeset
|
1184 if '-ict' in vmArgs: |
dd903cdfe708
Add possibility for -ict option to SPECjvm2008 benchmark execution.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7299
diff
changeset
|
1185 skipCheck = True |
dd903cdfe708
Add possibility for -ict option to SPECjvm2008 benchmark execution.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7299
diff
changeset
|
1186 vmArgs.remove('-ict') |
4537
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1187 if '-ikv' in vmArgs: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1188 skipValid = True |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1189 vmArgs.remove('-ikv') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1190 if '-wt' in vmArgs: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1191 wtIdx = args.index('-wt') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1192 try: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1193 wt = int(args[wtIdx+1]) |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1194 except: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1195 mx.abort('-wt (Warmup time) needs a numeric value (seconds)') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1196 vmArgs.remove('-wt') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1197 benchArgs.remove(args[wtIdx+1]) |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1198 if '-it' in vmArgs: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1199 itIdx = args.index('-it') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1200 try: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1201 it = int(args[itIdx+1]) |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1202 except: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1203 mx.abort('-it (Iteration time) needs a numeric value (seconds)') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1204 vmArgs.remove('-it') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
1205 benchArgs.remove(args[itIdx+1]) |
5229
ce6cb3a1eb44
mx dacapo, mx scaladacapo and mx specjvm2008 should use the specified vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5197
diff
changeset
|
1206 vm = _vm; |
7345
dd903cdfe708
Add possibility for -ict option to SPECjvm2008 benchmark execution.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7299
diff
changeset
|
1207 sanitycheck.getSPECjvm2008(benchArgs, skipCheck, skipValid, wt, it).bench(vm, opts=vmArgs) |
8147
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1208 |
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1209 def specjbb2013(args): |
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1210 """runs the composite SPECjbb2013 benchmark |
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1211 |
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1212 All options begining with - will be passed to the vm""" |
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1213 benchArgs = [a for a in args if a[0] != '-'] |
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1214 vmArgs = [a for a in args if a[0] == '-'] |
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1215 vm = _vm; |
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1216 sanitycheck.getSPECjbb2013(benchArgs).bench(vm, opts=vmArgs) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1217 |
8506
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
1218 def specjbb2005(args): |
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
1219 """runs the composite SPECjbb2005 benchmark |
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
1220 |
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
1221 All options begining with - will be passed to the vm""" |
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
1222 benchArgs = [a for a in args if a[0] != '-'] |
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
1223 vmArgs = [a for a in args if a[0] == '-'] |
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
1224 vm = _vm; |
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
1225 sanitycheck.getSPECjbb2005(benchArgs).bench(vm, opts=vmArgs) |
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
1226 |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
1227 def hsdis(args, copyToDir=None): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
1228 """download the hsdis library |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1229 |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1230 This is needed to support HotSpot's assembly dumping features. |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
1231 By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax.""" |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1232 flavor = 'intel' |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1233 if 'att' in args: |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1234 flavor = 'att' |
6495
75f130f2b30f
moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents:
6340
diff
changeset
|
1235 lib = mx.lib_suffix('hsdis-' + _arch()) |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
1236 path = join(_graal_home, 'lib', lib) |
5189
6fbf12b8e572
automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents:
5153
diff
changeset
|
1237 if not exists(path): |
6fbf12b8e572
automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents:
5153
diff
changeset
|
1238 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib]) |
5596
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
1239 if copyToDir is not None and exists(copyToDir): |
e4b1bc5e29e0
hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents:
5517
diff
changeset
|
1240 shutil.copy(path, copyToDir) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1241 |
5245 | 1242 def hcfdis(args): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
1243 """disassemble HexCodeFiles embedded in text files |
5245 | 1244 |
1245 Run a tool over the input files to convert all embedded HexCodeFiles | |
1246 to a disassembled format.""" | |
6958
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1247 |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1248 parser = ArgumentParser(prog='mx hcfdis'); |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1249 parser.add_argument('-m', '--map', help='address to symbol map applied to disassembler output') |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1250 parser.add_argument('files', nargs=REMAINDER, metavar='files...') |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1251 |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1252 args = parser.parse_args(args) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1253 |
6278
4f9574b2893e
removed dependence on private java.lang.String internals in HexCodeFile
Doug Simon <doug.simon@oracle.com>
parents:
6276
diff
changeset
|
1254 path = join(_graal_home, 'lib', 'hcfdis-1.jar') |
5245 | 1255 if not exists(path): |
6278
4f9574b2893e
removed dependence on private java.lang.String internals in HexCodeFile
Doug Simon <doug.simon@oracle.com>
parents:
6276
diff
changeset
|
1256 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hcfdis-1.jar']) |
6958
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1257 mx.run_java(['-jar', path] + args.files) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1258 |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1259 if args.map is not None: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1260 addressRE = re.compile(r'0[xX]([A-Fa-f0-9]+)') |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1261 with open(args.map) as fp: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1262 lines = fp.read().splitlines() |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1263 symbols = dict() |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1264 for l in lines: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1265 addressAndSymbol = l.split(' ', 1) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1266 if len(addressAndSymbol) == 2: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1267 address, symbol = addressAndSymbol; |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1268 if address.startswith('0x'): |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1269 address = long(address, 16) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1270 symbols[address] = symbol |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1271 for f in args.files: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1272 with open(f) as fp: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1273 lines = fp.read().splitlines() |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1274 updated = False |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1275 for i in range(0, len(lines)): |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1276 l = lines[i] |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1277 for m in addressRE.finditer(l): |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1278 sval = m.group(0) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1279 val = long(sval, 16) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1280 sym = symbols.get(val) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1281 if sym: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1282 l = l.replace(sval, sym) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1283 updated = True |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1284 lines[i] = l |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1285 if updated: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1286 mx.log('updating ' + f) |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1287 with open('new_' + f, "w") as fp: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1288 for l in lines: |
abbe4faaf0c1
added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents:
6718
diff
changeset
|
1289 print >> fp, l |
5245 | 1290 |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1291 def jacocoreport(args): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
1292 """create a JaCoCo coverage report |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1293 |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1294 Creates the report from the 'jacoco.exec' file in the current directory. |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1295 Default output directory is 'coverage', but an alternative can be provided as an argument.""" |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1296 jacocoreport = mx.library("JACOCOREPORT", True) |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1297 out = 'coverage' |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1298 if len(args) == 1: |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1299 out = args[0] |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1300 elif len(args) > 1: |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1301 mx.abort('jacocoreport takes only one argument : an output directory') |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1302 mx.run_java(['-jar', jacocoreport.get_path(True), '-in', 'jacoco.exec', '-g', join(_graal_home, 'graal'), out]) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1303 |
5700
12a34d1bcaa2
added site command to generate a javadoc-based website
Doug Simon <doug.simon@oracle.com>
parents:
5688
diff
changeset
|
1304 def site(args): |
6291
633136426f26
consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents:
6278
diff
changeset
|
1305 """create a website containing javadoc and the project dependency graph""" |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1306 |
5771
613a3ddb9a71
moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5764
diff
changeset
|
1307 return mx.site(['--name', 'Graal', |
5782
488864d5069a
added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents:
5771
diff
changeset
|
1308 '--jd', '@-tag', '--jd', '@test:X', |
488864d5069a
added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents:
5771
diff
changeset
|
1309 '--jd', '@-tag', '--jd', '@run:X', |
488864d5069a
added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents:
5771
diff
changeset
|
1310 '--jd', '@-tag', '--jd', '@bug:X', |
488864d5069a
added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents:
5771
diff
changeset
|
1311 '--jd', '@-tag', '--jd', '@summary:X', |
488864d5069a
added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents:
5771
diff
changeset
|
1312 '--jd', '@-tag', '--jd', '@vmoption:X', |
5771
613a3ddb9a71
moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5764
diff
changeset
|
1313 '--overview', join(_graal_home, 'graal', 'overview.html'), |
613a3ddb9a71
moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents:
5764
diff
changeset
|
1314 '--title', 'Graal OpenJDK Project Documentation', |
6506
305b9166b455
added projects table to the top level javadoc page generated by the site command
Doug Simon <doug.simon@oracle.com>
parents:
6495
diff
changeset
|
1315 '--dot-output-base', 'projects'] + args) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1316 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
1317 def mx_init(): |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
1318 _vmbuild = 'product' |
3718 | 1319 commands = { |
4226
e03ff10d4bfc
Made the gate clean the Java projects only.
Doug Simon <doug.simon@oracle.com>
parents:
4225
diff
changeset
|
1320 'build': [build, '[-options]'], |
9116
e2dae636732a
added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents:
9098
diff
changeset
|
1321 'buildvars': [buildvars, ''], |
4601
ade18666f2be
Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents:
4584
diff
changeset
|
1322 'buildvms': [buildvms, '[-options]'], |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
1323 'clean': [clean, ''], |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
1324 'hsdis': [hsdis, '[att]'], |
5245 | 1325 'hcfdis': [hcfdis, ''], |
8302
b246434a3e4a
made build-graal.xml be generated by mx
Doug Simon <doug.simon@oracle.com>
parents:
8261
diff
changeset
|
1326 'initantbuild' : [initantbuild, '[-options]'], |
5089
206e68bb66c6
Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents:
5064
diff
changeset
|
1327 'igv' : [igv, ''], |
5103
276e14614531
Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents:
5094
diff
changeset
|
1328 'jdkhome': [jdkhome, ''], |
4228
e872562f95f8
add a simple specjvm2008 command, fail a benchmark if one of the failureRE matches
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4227
diff
changeset
|
1329 'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'], |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
1330 'scaladacapo': [scaladacapo, '[[n] benchmark] [VM options|@Scala DaCapo options]'], |
8147
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1331 'specjvm2008': [specjvm2008, '[VM options|specjvm2008 options (-v, -ikv, -ict, -wt, -it)]'], |
9786ac8fff61
Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8135
diff
changeset
|
1332 'specjbb2013': [specjbb2013, '[VM options]'], |
8506
c3657d00e343
-Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
8406
diff
changeset
|
1333 'specjbb2005': [specjbb2005, '[VM options]'], |
5090
0a1e5b876667
Disabled 'examples' command until the examples are revived.
Doug Simon <doug.simon@oracle.com>
parents:
5089
diff
changeset
|
1334 #'example': [example, '[-v] example names...'], |
4601
ade18666f2be
Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents:
4584
diff
changeset
|
1335 'gate' : [gate, '[-options]'], |
4536
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
1336 'gv' : [gv, ''], |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
1337 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
1338 'unittest' : [unittest, '[filters...]'], |
8340
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1339 'longunittest' : [longunittest, '[filters...]'], |
d9d883aeb96f
unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents:
8317
diff
changeset
|
1340 'shortunittest' : [shortunittest, '[filters...]'], |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
1341 'jacocoreport' : [jacocoreport, '[output directory]'], |
5700
12a34d1bcaa2
added site command to generate a javadoc-based website
Doug Simon <doug.simon@oracle.com>
parents:
5688
diff
changeset
|
1342 'site' : [site, '[-options]'], |
5257
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
1343 'vm': [vm, '[-options] class [args...]'], |
a549662f6c6f
added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents:
5245
diff
changeset
|
1344 'vmg': [vmg, '[-options] class [args...]'], |
6340
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1345 'vmfg': [vmfg, '[-options] class [args...]'], |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1346 'deoptalot' : [deoptalot, '[n]'], |
74560fdffd51
Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
6319
diff
changeset
|
1347 'longtests' : [longtests, ''] |
3718 | 1348 } |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1349 |
5064
8a88c903e381
Updated mx commands.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5047
diff
changeset
|
1350 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append']) |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
1351 |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
1352 if (_vmSourcesAvailable): |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1353 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=_vmChoices, help='the VM to build/run (default: ' + _vmChoices[0] + ')') |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1354 for c in _vmbuildChoices: |
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1355 mx.add_argument('--' + c, action='store_const', dest='vmbuild', const=c, help='select the ' + c + ' build of the VM') |
5194
a6eceb5efb0e
added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents:
5189
diff
changeset
|
1356 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse') |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5871
diff
changeset
|
1357 mx.add_argument('--native-dbg', action='store', dest='native_dbg', help='Start the vm inside a debugger', metavar='<debugger>') |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5871
diff
changeset
|
1358 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='native_dbg', help='alias for --native-dbg /usr/bin/gdb -- args') |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1359 |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
1360 commands.update({ |
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
1361 'export': [export, '[-options] [zipfile]'], |
9095
d538dce8f403
support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents:
9010
diff
changeset
|
1362 'build': [build, '[-options] [' + '|'.join(_vmbuildChoices) + ']...'] |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
1363 }) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1364 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
1365 mx.commands.update(commands) |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
1366 |
7916
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
1367 def mx_post_parse_cmd_line(opts):# |
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
1368 # TODO _minVersion check could probably be part of a Suite in mx? |
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
1369 if (mx.java().version < _minVersion) : |
9bff64f43299
Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
7788
diff
changeset
|
1370 mx.abort('Requires Java version ' + str(_minVersion) + ' or greater, got version ' + str(mx.java().version)) |
5729
dab877fe7c31
prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents:
5708
diff
changeset
|
1371 |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
1372 if (_vmSourcesAvailable): |
4559
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
1373 if hasattr(opts, 'vm') and opts.vm is not None: |
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
1374 global _vm |
723df37192d6
Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4540
diff
changeset
|
1375 _vm = opts.vm |
4216
a13d61d3910e
fix for when no vm build is explicitely selected
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4215
diff
changeset
|
1376 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None: |
4178
d1b26c17910a
Add the Dacapo benchmarks to the "lib" folder instead of using the environment variable. Fixed an issue in the downloader.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4177
diff
changeset
|
1377 global _vmbuild |
4156
843c8d6720da
Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents:
4155
diff
changeset
|
1378 _vmbuild = opts.vmbuild |
5194
a6eceb5efb0e
added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents:
5189
diff
changeset
|
1379 global _make_eclipse_launch |
a6eceb5efb0e
added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents:
5189
diff
changeset
|
1380 _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False) |
5024
7ccdae96e98a
Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5016
diff
changeset
|
1381 global _jacoco |
7ccdae96e98a
Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5016
diff
changeset
|
1382 _jacoco = opts.jacoco |
5875
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5871
diff
changeset
|
1383 global _native_dbg |
000fb0550afe
Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5871
diff
changeset
|
1384 _native_dbg = opts.native_dbg |
8134
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
1385 |
6e3ebc6fd5a4
graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents:
8132
diff
changeset
|
1386 mx.distribution('GRAAL').add_update_listener(_installGraalJarInJdks) |