Mercurial > hg > truffle
annotate mx/commands.py @ 5013:25a46490146e
Use context instead of individual dump calls to pass helper objects to CFG printer
author | Christian Wimmer <Christian.Wimmer@Oracle.com> |
---|---|
date | Fri, 02 Mar 2012 09:17:59 -0800 |
parents | e136f2d0d002 |
children | c142a64141a8 |
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 | |
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
|
29 import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, multiprocessing |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
30 from os.path import join, exists, dirname, basename |
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 |
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
|
34 import json |
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'). """ |
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
|
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 |
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
|
41 """ The VM that will be run by the 'vm' command: graal(default), client or server. |
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
|
42 This can be set via the global '--vm' option. """ |
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
|
43 _vm = 'graal' |
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
|
44 |
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 """ The VM build that will be run by the 'vm' command: product(default), fastdebug or debug. |
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
|
46 This can be set via the global '--fastdebug' and '--debug' options. """ |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
47 _vmbuild = 'product' |
3718 | 48 |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
49 _jacoco = False |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
50 |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
51 _jacocoExcludes = ['com.oracle.max.graal.hotspot.snippets.ArrayCopySnippets', |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
52 'com.oracle.max.graal.snippets.DoubleSnippets', |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
53 'com.oracle.max.graal.snippets.FloatSnippets', |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
54 'com.oracle.max.graal.snippets.MathSnippetsX86', |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
55 'com.oracle.max.graal.snippets.NodeClassSnippets', |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
56 'com.oracle.max.graal.hotspot.snippets.SystemSnippets', |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
57 'com.oracle.max.graal.hotspot.snippets.UnsafeSnippets'] |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
58 |
4276
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
59 _copyrightTemplate = """/* |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
60 * Copyright (c) {0}, Oracle and/or its affiliates. All rights reserved. |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
61 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
62 * |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
63 * This code is free software; you can redistribute it and/or modify it |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
64 * under the terms of the GNU General Public License version 2 only, as |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
65 * published by the Free Software Foundation. |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
66 * |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
67 * This code is distributed in the hope that it will be useful, but WITHOUT |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
68 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
69 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
70 * version 2 for more details (a copy is included in the LICENSE file that |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
71 * accompanied this code). |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
72 * |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
73 * You should have received a copy of the GNU General Public License version |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
74 * 2 along with this work; if not, write to the Free Software Foundation, |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
75 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
76 * |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
77 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
78 * or visit www.oracle.com if you need additional information or have any |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
79 * questions. |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
80 */ |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
81 |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
82 """ |
f8f262212aa4
Modified 'mx build' to update graal_paths.hpp (if necessary).
Doug Simon <doug.simon@oracle.com>
parents:
4269
diff
changeset
|
83 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
84 def clean(args): |
3718 | 85 """cleans 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
|
86 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
|
87 if opts.native: |
e03ff10d4bfc
Made the gate clean the Java projects only.
Doug Simon <doug.simon@oracle.com>
parents:
4225
diff
changeset
|
88 os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='16') |
e03ff10d4bfc
Made the gate clean the Java projects only.
Doug Simon <doug.simon@oracle.com>
parents:
4225
diff
changeset
|
89 mx.run([mx.gmake_cmd(), 'clean'], cwd=join(_graal_home, 'make')) |
3718 | 90 |
4184
fa6b78681c54
Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4178
diff
changeset
|
91 def copyrightcheck(args): |
fa6b78681c54
Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4178
diff
changeset
|
92 """run copyright check on the Mercurial controlled source files""" |
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
|
93 res = mx.run_java(['-cp', mx.classpath('com.oracle.max.base', resolve=False), 'com.sun.max.tools.CheckCopyright', '-cfp=' + join(mx.project('com.oracle.max.base').dir, '.copyright.regex')] + args) |
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
|
94 mx.log("copyright check result = " + str(res)) |
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
|
95 return res |
4184
fa6b78681c54
Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4178
diff
changeset
|
96 |
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
|
97 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
|
98 """create a GraalVM zip file for 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
|
99 |
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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 |
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 args = parser.parse_args(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
|
106 |
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 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
|
108 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
|
109 # 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
|
110 build(['product']) |
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 |
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 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
|
113 mx.run(('hg archive -I graal -I mx -I mxtool -I mx.sh ' + tmp).split()) |
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 |
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 # 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 |
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 # 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
|
129 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
|
130 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
|
131 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
|
132 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
|
133 mx.run('mx ideinit'.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
|
134 |
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
|
135 # 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
|
136 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
|
137 shutil.rmtree(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
|
138 |
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
|
139 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
|
140 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
141 def example(args): |
3718 | 142 """run some or all Graal examples""" |
143 examples = { | |
144 'safeadd': ['com.oracle.max.graal.examples.safeadd', 'com.oracle.max.graal.examples.safeadd.Main'], | |
145 'vectorlib': ['com.oracle.max.graal.examples.vectorlib', 'com.oracle.max.graal.examples.vectorlib.Main'], | |
146 } | |
147 | |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
148 def run_example(verbose, project, mainClass): |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
149 cp = mx.classpath(project) |
3718 | 150 sharedArgs = ['-Xcomp', '-XX:CompileOnly=Main', mainClass] |
151 | |
152 res = [] | |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
153 mx.log("=== Server VM ===") |
3718 | 154 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
|
155 res.append(vm(['-cp', cp, printArg] + sharedArgs, vm='server')) |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
156 mx.log("=== Graal VM ===") |
3718 | 157 printArg = '-G:+PrintCompilation' if verbose else '-G:-PrintCompilation' |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
158 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
|
159 mx.log("=== Graal VM with extensions ===") |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
160 res.append(vm(['-cp', cp, printArg, '-G:+Extend', '-G:-Inline'] + sharedArgs)) |
3718 | 161 |
162 if len([x for x in res if x != 0]) != 0: | |
163 return 1 | |
164 return 0 | |
165 | |
166 verbose = False | |
167 if '-v' in args: | |
168 verbose = True | |
169 args = [a for a in args if a != '-v'] | |
170 | |
171 if len(args) == 0: | |
172 args = examples.keys() | |
173 for a in args: | |
174 config = examples.get(a) | |
175 if config is None: | |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
176 mx.log('unknown example: ' + a + ' {available examples = ' + str(examples.keys()) + '}') |
3718 | 177 else: |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
178 mx.log('--------- ' + a + ' ------------') |
3718 | 179 project, mainClass = config |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
180 run_example(verbose, project, mainClass) |
3718 | 181 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
182 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
|
183 """run one or all DaCapo benchmarks |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
184 |
4244
a69889e5a8a5
Made the DaCapo library be downloaded only on demand.
Doug Simon <doug.simon@oracle.com>
parents:
4240
diff
changeset
|
185 DaCapo options are distinguished from VM options by a '@' prefix. |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
186 For example, '@--iterations @5' will pass '--iterations 5' to the |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
187 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
|
188 |
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 numTests = {} |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
190 |
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
|
191 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
|
192 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
|
193 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 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
|
203 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
|
204 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
|
205 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
|
206 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
|
207 bm = 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
|
208 |
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
|
209 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
|
210 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
|
211 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
|
212 numTests[bm] = n |
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
|
213 |
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
|
214 if len(numTests) is 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
|
215 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
|
216 numTests[bench] = 1 |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
217 |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
218 # 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
|
219 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')] |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
220 |
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
221 # 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
|
222 vmOpts = [arg for arg in args if not arg.startswith('@')] |
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
|
223 |
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
|
224 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
|
225 for (test, n) in numTests.items(): |
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
|
226 if not sanitycheck.getDacapo(test, n, dacapoArgs).test('graal', 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
|
227 failed.append(test) |
3718 | 228 |
4157
b26279781d95
Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents:
4156
diff
changeset
|
229 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
|
230 mx.abort('DaCapo failures: ' + str(failed)) |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
231 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
232 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
233 def scaladacapo(args): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
234 """run one or all Scala DaCapo benchmarks |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
235 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
236 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
|
237 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
|
238 DaCapo harness.""" |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
239 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
240 numTests = {} |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
241 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
242 if len(args) > 0: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
243 level = getattr(sanitycheck.SanityCheckLevel, args[0], None) |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
244 if level is not None: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
245 del args[0] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
246 for (bench, ns) in sanitycheck.dacapoScalaSanityWarmup.items(): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
247 if ns[level] > 0: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
248 numTests[bench] = ns[level] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
249 else: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
250 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
|
251 n = 1 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
252 if args[0].isdigit(): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
253 n = int(args[0]) |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
254 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
|
255 bm = args[1] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
256 del args[0] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
257 else: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
258 bm = args[0] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
259 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
260 del args[0] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
261 if bm not in sanitycheck.dacapoScalaSanityWarmup.keys(): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
262 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
|
263 numTests[bm] = n |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
264 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
265 if len(numTests) is 0: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
266 for bench in sanitycheck.dacapoScalaSanityWarmup.keys(): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
267 numTests[bench] = 1 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
268 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
269 # Extract DaCapo options |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
270 dacapoArgs = [(arg[1:]) for arg in args if arg.startswith('@')] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
271 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
272 # The remainder are VM options |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
273 vmOpts = [arg for arg in args if not arg.startswith('@')] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
274 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
275 failed = [] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
276 for (test, n) in numTests.items(): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
277 if not sanitycheck.getScalaDacapo(test, n, dacapoArgs).test('graal', opts=vmOpts): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
278 failed.append(test) |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
279 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
280 if len(failed) != 0: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
281 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
|
282 |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
283 def _vmLibDirInJdk(jdk): |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
284 """ |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
285 Get the directory within a JDK where jvm.cfg file and the server |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
286 and client subdirectories are located. |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
287 """ |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
288 if platform.system() == 'Darwin': |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
289 return join(jdk, 'jre', 'lib') |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
290 return join(jdk, 'jre', 'lib', 'amd64') |
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
291 |
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
|
292 def _jdk(build='product', create=False): |
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
|
293 """ |
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
|
294 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
|
295 """ |
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
|
296 jdk = join(_graal_home, 'jdk' + mx.java().version, build) |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
297 jdkContents = ['bin', 'db', 'include', 'jre', 'lib'] |
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
298 if mx.get_os() != 'windows': |
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
299 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
|
300 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
|
301 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
|
302 srcJdk = mx.java().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
|
303 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
|
304 os.makedirs(jdk) |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
305 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
|
306 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
|
307 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
|
308 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
|
309 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
|
310 shutil.copytree(src, dst) |
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
|
311 |
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
|
312 # Make a copy of the default VM so that this JDK can be |
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
|
313 # reliably used as the bootstrap for a HotSpot build. |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
314 jvmCfg = join(_vmLibDirInJdk(jdk), 'jvm.cfg') |
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
|
315 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
|
316 mx.abort(jvmCfg + ' does not exist') |
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
|
317 |
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
|
318 lines = [] |
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
|
319 defaultVM = 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 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
|
325 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
|
326 defaultVM = parts[0][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
|
327 lines.append('-' + defaultVM + '0 KNOWN\n') |
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
|
328 lines.append(line) |
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
|
329 |
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 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
331 shutil.copytree(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), defaultVM + '0')) |
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
|
332 |
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 with open(jvmCfg, 'w') 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
|
334 for line in lines: |
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 f.write(line) |
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 |
3718 | 337 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
|
338 if not exists(jdk): |
4587
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
339 mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx build ' + build + '\'') |
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
|
340 return jdk |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
341 |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
342 # 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
|
343 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
|
344 newLine = os.linesep |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
345 STARTTOKEN = 'RUNINDEBUGSHELL_STARTSEQUENCE' |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
346 ENDTOKEN = 'RUNINDEBUGSHELL_ENDSEQUENCE' |
4252
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
347 |
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
348 winSDK = mx.get_env('WIN_SDK', 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\') |
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
349 |
67e88b7624d5
Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents:
4247
diff
changeset
|
350 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
|
351 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
|
352 stdout = p.stdout |
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
353 stdin = p.stdin |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
354 if logFile: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
355 log = open(logFile, 'w') |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
356 ret = False |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
357 while True: |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
358 line = stdout.readline().decode() |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
359 if logFile: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
360 log.write(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
361 line = line.strip() |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
362 mx.log(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
363 if line == STARTTOKEN: |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
364 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
|
365 for regex in respondTo.keys(): |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
366 match = regex.search(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
367 if match: |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
368 stdin.write(respondTo[regex] + newLine) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
369 if findInOutput: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
370 match = findInOutput.search(line) |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
371 if match: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
372 ret = True |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
373 if line == ENDTOKEN: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
374 break |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
375 stdin.write('exit' + newLine) |
4177
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
376 if logFile: |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
377 log.close() |
c843578c269d
Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4163
diff
changeset
|
378 return ret |
3718 | 379 |
4577
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
380 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
|
381 """build the VM binary |
3721
71b1204a74b4
Automated creation of debug, fastdebug and optimized subdirectories of the JDK.
Doug Simon <doug.simon@oracle.com>
parents:
3718
diff
changeset
|
382 |
4575
ccb5369481a2
Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents:
4572
diff
changeset
|
383 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
|
384 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
|
385 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
|
386 for the VM binary.""" |
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
|
387 |
4146 | 388 # Call mx.build to compile the Java sources |
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
|
389 opts2 = mx.build(['--source', '1.7'] + args, parser=ArgumentParser(prog='mx build')) |
4145
9aee7df31417
Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents:
4144
diff
changeset
|
390 |
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
|
391 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
|
392 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
|
393 |
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
|
394 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
|
395 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
|
396 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
|
397 |
4577
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
398 if vm is None: |
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
399 vm = _vm |
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
400 |
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
|
401 if vm == 'server': |
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
|
402 buildSuffix = '' |
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
|
403 elif vm == 'client': |
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
|
404 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
|
405 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
|
406 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
|
407 buildSuffix = 'graal' |
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
|
408 |
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
|
409 for build in builds: |
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
|
410 jdk = _jdk(build, create=True) |
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
|
411 |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
412 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
|
413 if not exists(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
|
414 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
|
415 os.makedirs(vmDir) |
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
|
416 |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
417 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
|
418 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
|
419 sys.stderr.write(line + os.linesep) |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
420 |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
421 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
|
422 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
|
423 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
|
424 |
4572
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4559
diff
changeset
|
425 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
|
426 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
|
427 _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
|
428 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
|
429 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
|
430 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
|
431 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
|
432 mx.log('Error executing create command') |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
433 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
|
434 winBuildCmd = 'msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=' + project_config + ' /p:Platform=x64' |
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
|
435 winBuildSuccess = re.compile('Build succeeded.') |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
436 if not _runInDebugShell(winBuildCmd, _graal_home, compilelogfile, winBuildSuccess): |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
437 mx.log('Error building project') |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
438 return |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
439 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
|
440 cpus = multiprocessing.cpu_count() |
4572
76841bdd5f3e
(Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents:
4559
diff
changeset
|
441 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
|
442 build = 'jvmg' |
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
|
443 env = os.environ |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
444 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
|
445 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
|
446 env.setdefault('HOTSPOT_BUILD_JOBS', str(cpus)) |
4294
600cbdce9805
force ALT_BOOTDIR to the proper jdk to avoid installing non-product builds into the product build
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4293
diff
changeset
|
447 env['ALT_BOOTDIR'] = jdk |
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
|
448 env.setdefault('INSTALL', 'y') |
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
|
449 |
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
|
450 # 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
|
451 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
|
452 env.pop('CLASSPATH', 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
|
453 |
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
|
454 mx.run([mx.gmake_cmd(), build + buildSuffix], cwd=join(_graal_home, 'make'), err=filterXusage) |
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
|
455 |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
456 jvmCfg = join(_vmLibDirInJdk(jdk), 'jvm.cfg') |
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
|
457 found = False |
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
|
458 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
|
459 mx.abort(jvmCfg + ' does not exist') |
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
|
460 |
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
|
461 prefix = '-' + 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
|
462 vmKnown = prefix + ' KNOWN\n' |
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
|
463 lines = [] |
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
|
464 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
|
465 for line in 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
|
466 if vmKnown in line: |
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
|
467 found = True |
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
|
468 break |
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
|
469 if not line.startswith(prefix): |
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
|
470 lines.append(line) |
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
|
471 if not found: |
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
|
472 mx.log('Appending "' + prefix + ' KNOWN" to ' + 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
|
473 lines.append(vmKnown) |
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
|
474 with open(jvmCfg, 'w') 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
|
475 for line in lines: |
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
|
476 f.write(line) |
3718 | 477 |
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
|
478 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
|
479 """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
|
480 |
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
|
481 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
|
482 vm = _vm |
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
|
483 |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
484 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' |
4324
b0aa4a52b89c
Added support for project specs in classpath.
Doug Simon <doug.simon@oracle.com>
parents:
4294
diff
changeset
|
485 mx.expand_project_in_args(args) |
4145
9aee7df31417
Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents:
4144
diff
changeset
|
486 if mx.java().debug: |
3718 | 487 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
488 if _jacoco: |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
489 jacocoagent = mx.library("JACOCOAGENT", True) |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
490 agentOptions = { |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
491 'append' : 'false', |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
492 'bootclasspath' : 'true', |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
493 'includes' : 'com.oracle.max.*', |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
494 'excludes' : ':'.join(_jacocoExcludes) |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
495 } |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
496 args = ['-javaagent:' + jacocoagent.get_path(True) + '=' + ','.join([k + '=' + v for k, v in agentOptions.items()])] + args |
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
|
497 exe = join(_jdk(build), 'bin', mx.exe_suffix('java')) |
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
|
498 return mx.run([exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) |
3718 | 499 |
3732
3e2e8b8abdaf
Updated mxtool to allow projects in subdirectories.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3730
diff
changeset
|
500 |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
501 # Table of unit tests. |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
502 # Keys are project names, values are package name lists. |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
503 # All source files in the given (project,package) pairs are scanned for lines |
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
|
504 # containing '@Test'. These are then determined to be the classes defining |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
505 # unit tests. |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
506 _unittests = { |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
507 'com.oracle.max.graal.tests': ['com.oracle.max.graal.compiler.tests'], |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
508 } |
4587
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
509 _jtttests = { |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
510 'com.oracle.max.graal.jtt': ['com.oracle.max.graal.jtt'], |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
511 } |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
512 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
513 def _add_test_classes(testClassList, searchDir, pkgRoot): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
514 pkgDecl = re.compile(r"^package\s+([a-zA-Z_][\w\.]*)\s*;$") |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
515 for root, _, files in os.walk(searchDir): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
516 for name in files: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
517 if name.endswith('.java') and name != 'package-info.java': |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
518 hasTest = False |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
519 with open(join(root, name)) as f: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
520 pkg = None |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
521 for line in f: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
522 if line.startswith("package "): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
523 match = pkgDecl.match(line) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
524 if match: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
525 pkg = match.group(1) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
526 else: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
527 if line.strip().startswith('@Test'): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
528 hasTest = True |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
529 break |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
530 if hasTest: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
531 assert pkg is not None |
4587
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
532 if pkg.startswith(pkgRoot): |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
533 testClassList.append(pkg + '.' + name[:-len('.java')]) |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
534 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
535 def unittest(args): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
536 """run the Graal Compiler Unit Tests in the GraalVM |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
537 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
538 If filters are supplied, only tests whose fully qualified name |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
539 include a filter as a substring are run. Negative filters are |
4630
ef0ff914c10f
Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4602
diff
changeset
|
540 those with a '-' prefix. VM args should have a @ prefix.""" |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
541 |
4630
ef0ff914c10f
Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4602
diff
changeset
|
542 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
|
543 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
|
544 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
|
545 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
546 def containsAny(c, substrings): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
547 for s in substrings: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
548 if s in c: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
549 return True |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
550 return False |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
551 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
552 for proj in _unittests.iterkeys(): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
553 p = mx.project(proj) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
554 classes = [] |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
555 for pkg in _unittests[proj]: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
556 _add_test_classes(classes, join(p.dir, 'src'), pkg) |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
557 |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
558 if len(pos) != 0: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
559 classes = [c for c in classes if containsAny(c, pos)] |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
560 if len(neg) != 0: |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
561 classes = [c for c in classes if not containsAny(c, neg)] |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
562 |
4630
ef0ff914c10f
Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4602
diff
changeset
|
563 vm(['-XX:-BootstrapGraal', '-esa'] + vmArgs + ['-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) |
4587
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
564 |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
565 def jtt(args): |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
566 """run the Java Tester Tests in the GraalVM |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
567 |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
568 If filters are supplied, only tests whose fully qualified name |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
569 include a filter as a substring are run. Negative filters are |
4630
ef0ff914c10f
Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4602
diff
changeset
|
570 those with a '-' prefix. VM args should have a @ prefix.""" |
4587
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
571 |
4630
ef0ff914c10f
Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4602
diff
changeset
|
572 pos = [a for a in args if a[0] != '-' and a[0] != '@' ] |
4587
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
573 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
|
574 vmArgs = [a[1:] for a in args if a[0] == '@'] |
4587
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
575 |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
576 def containsAny(c, substrings): |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
577 for s in substrings: |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
578 if s in c: |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
579 return True |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
580 return False |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
581 |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
582 for proj in _jtttests.iterkeys(): |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
583 p = mx.project(proj) |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
584 classes = [] |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
585 for pkg in _jtttests[proj]: |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
586 _add_test_classes(classes, join(p.dir, 'src'), pkg) |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
587 |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
588 if len(pos) != 0: |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
589 classes = [c for c in classes if containsAny(c, pos)] |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
590 if len(neg) != 0: |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
591 classes = [c for c in classes if not containsAny(c, neg)] |
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
592 |
4630
ef0ff914c10f
Make it possible to pass jvm args in jtt and unittest
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4602
diff
changeset
|
593 vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=::test', '-Xcomp', '-esa'] + vmArgs + ['-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
594 |
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
|
595 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
|
596 """build one or more VMs in various configurations""" |
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
|
597 |
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
|
598 parser = ArgumentParser(prog='mx buildvms'); |
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
|
599 parser.add_argument('--vms', help='a comma separated list of VMs to build (default: server,client,graal)', default='server,client,graal') |
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
|
600 parser.add_argument('--builds', help='a comma separated list of build types (default: product,fastdebug,debug)', default='product,fastdebug,debug') |
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
|
601 |
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
|
602 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
|
603 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
|
604 builds = args.builds.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
|
605 |
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
|
606 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
|
607 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
|
608 for vmbuild in builds: |
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
|
609 logFile = join(v + '-' + vmbuild + '.log') |
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
|
610 log = open(join(_graal_home, logFile), 'wb') |
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
|
611 start = 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
|
612 mx.log('BEGIN: ' + v + '-' + vmbuild + '\t(see: ' + logFile + ')') |
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
|
613 # Run as subprocess so that output can be directed to a file |
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
|
614 subprocess.check_call([sys.executable, '-u', join('mxtool', 'mx.py'), '--vm', v, 'build', vmbuild], cwd=_graal_home, stdout=log, stderr=subprocess.STDOUT) |
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
|
615 duration = datetime.timedelta(seconds=time.time() - start) |
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
|
616 mx.log('END: ' + v + '-' + vmbuild + '\t[' + str(duration) + ']') |
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
|
617 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
|
618 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
|
619 |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
620 def gate(args): |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
621 """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
|
622 |
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
|
623 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
|
624 a state that would be accepted for integration into the main repository.""" |
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
625 |
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
|
626 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
|
627 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
|
628 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
|
629 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
|
630 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
|
631 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
|
632 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
|
633 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
|
634 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
|
635 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
|
636 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
|
637 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
|
638 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
|
639 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
|
640 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
|
641 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
|
642 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
|
643 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
|
644 |
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
|
645 parser = ArgumentParser(prog='mx gate'); |
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
|
646 parser.add_argument('-n', '--omit-native-build', action='store_false', dest='buildNative', help='omit cleaning and building native code') |
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
|
647 parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM') |
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
|
648 |
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
|
649 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
|
650 |
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
|
651 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
|
652 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
|
653 try: |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
654 |
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
|
655 t = Task('Clean') |
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
|
656 clean([] if args.buildNative else ['--no-native']) |
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
|
657 tasks.append(t.stop()) |
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
|
658 |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
659 t = Task('Checkstyle') |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
660 if mx.checkstyle([]) != 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
|
661 t.abort('Checkstyle warnings were found') |
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
|
662 tasks.append(t.stop()) |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
663 |
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
|
664 t = Task('Canonicalization Check') |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
665 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
666 if mx.canonicalizeprojects([]) != 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
|
667 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') |
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
|
668 tasks.append(t.stop()) |
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
|
669 |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
670 t = Task('BuildJava') |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
671 build(['--no-native']) |
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
|
672 tasks.append(t.stop()) |
4184
fa6b78681c54
Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4178
diff
changeset
|
673 |
4536
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
674 t = Task('CleanAndBuildGraalVisualizer') |
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
675 mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-q', 'clean', 'build']) |
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
676 tasks.append(t.stop()) |
4577
bc8b58c11768
Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4575
diff
changeset
|
677 |
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
|
678 # Prevent Graal modifications from breaking the standard builds |
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
|
679 if args.buildNative and args.buildNonGraal: |
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
|
680 t = Task('BuildHotSpotVarieties') |
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
|
681 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) |
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
|
682 tasks.append(t.stop()) |
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
|
683 |
4483
58ecb156a3e8
Gate : run fastdebug configuration before product in order to get a better log if the gate fails
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4482
diff
changeset
|
684 for vmbuild in ['fastdebug', 'product']: |
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
|
685 global _vmbuild |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
686 _vmbuild = vmbuild |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
687 |
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
|
688 if args.buildNative: |
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
|
689 t = Task('BuildHotSpotGraal:' + vmbuild) |
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
|
690 buildvms(['--vms', 'graal', '--builds', vmbuild]) |
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
|
691 tasks.append(t.stop()) |
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
|
692 |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
693 t = Task('BootstrapWithSystemAssertions:' + vmbuild) |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
694 vm(['-esa', '-version']) |
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
|
695 tasks.append(t.stop()) |
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
|
696 |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
697 t = Task('UnitTests:' + vmbuild) |
057620486c90
Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents:
4230
diff
changeset
|
698 unittest([]) |
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
|
699 tasks.append(t.stop()) |
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
|
700 |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
701 t = Task('JavaTesterTests:' + vmbuild) |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
702 jtt([]) |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
703 tasks.append(t.stop()) |
4587
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
704 |
4240
394424b7df1a
Disabled certain DaCapo tests for fastdebug testing in the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4238
diff
changeset
|
705 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
|
706 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
|
707 if not test.test('graal'): |
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
|
708 t.abort(test.group + ' ' + 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
|
709 tasks.append(t.stop()) |
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
|
710 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
|
711 total.abort(1) |
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
|
712 |
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
|
713 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
|
714 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
|
715 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
|
716 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
|
717 |
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
|
718 total.stop() |
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
|
719 |
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
|
720 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
|
721 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
|
722 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
|
723 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
|
724 mx.log(' ' + str(total.duration)) |
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
|
725 |
4536
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
726 def gv(args): |
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
727 """run the Graal Visualizer""" |
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
728 mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-q', 'run']) |
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
729 |
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
|
730 def bench(args): |
4324
b0aa4a52b89c
Added support for project specs in classpath.
Doug Simon <doug.simon@oracle.com>
parents:
4294
diff
changeset
|
731 """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
|
732 |
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
|
733 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
|
734 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
|
735 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
|
736 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
|
737 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
|
738 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
|
739 del args[index] |
d4906ea4255b
Handle SIGTERM : killing mx will properly kill subprocesses
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4288
diff
changeset
|
740 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
|
741 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
|
742 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
|
743 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
|
744 if len(args) is 0: |
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
|
745 args += ['all'] |
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
|
746 |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
747 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
|
748 benchmarks = [] |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
749 #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
|
750 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
|
751 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
|
752 else: |
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
|
753 dacapos = [a[7:] for a in args if a.startswith('dacapo:')] |
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
|
754 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
|
755 if dacapo not in sanitycheck.dacapoSanityWarmup.keys(): |
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
|
756 mx.abort('Unknown dacapo : ' + dacapo) |
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
|
757 benchmarks += [sanitycheck.getDacapo(dacapo, sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])] |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
758 |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
759 if ('scaladacapo' in args or 'all' in args): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
760 benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark) |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
761 else: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
762 dacapos = [a[7:] for a in args if a.startswith('scaladacapo:')] |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
763 for dacapo in dacapos: |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
764 if dacapo not in sanitycheck.dacapoScalaSanityWarmup.keys(): |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
765 mx.abort('Unknown dacapo : ' + dacapo) |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
766 benchmarks += [sanitycheck.getScalaDacapo(dacapo, sanitycheck.dacapoScalaSanityWarmup[dacapo][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
|
767 |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
768 #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
|
769 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
|
770 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
|
771 #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
|
772 if ('specjvm2008' in args or 'all' in args): |
4336
b5c12b21879c
fix for SPECjvm2008 bench in commands.py
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4335
diff
changeset
|
773 benchmarks += [sanitycheck.getSPECjvm2008([], 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
|
774 else: |
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
|
775 specjvms = [a[12:] for a in args if a.startswith('specjvm2008:')] |
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
|
776 for specjvm in specjvms: |
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
|
777 benchmarks += [sanitycheck.getSPECjvm2008([specjvm], True, 120, 120)] |
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
|
778 |
4219
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
779 for test in benchmarks: |
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
780 if not results.has_key(test.group): |
47f7d91d34cf
Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
4216
diff
changeset
|
781 results[test.group] = {} |
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
|
782 results[test.group].update(test.bench(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
|
783 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
|
784 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
|
785 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
|
786 f.write(json.dumps(results)) |
4159
e253ca26b2d5
Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents:
4157
diff
changeset
|
787 |
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
|
788 def specjvm2008(args): |
4537
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
789 """run one or all SPECjvm2008 benchmarks |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
790 |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
791 All options begining with - will be passed to the vm except for -ikv -wt and -it. |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
792 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
|
793 benchArgs = [a for a in args if a[0] != '-'] |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
794 vmArgs = [a for a in args if a[0] == '-'] |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
795 wt = None |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
796 it = None |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
797 skipValid = False |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
798 if '-ikv' in vmArgs: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
799 skipValid = True |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
800 vmArgs.remove('-ikv') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
801 if '-wt' in vmArgs: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
802 wtIdx = args.index('-wt') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
803 try: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
804 wt = int(args[wtIdx+1]) |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
805 except: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
806 mx.abort('-wt (Warmup time) needs a numeric value (seconds)') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
807 vmArgs.remove('-wt') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
808 benchArgs.remove(args[wtIdx+1]) |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
809 if '-it' in vmArgs: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
810 itIdx = args.index('-it') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
811 try: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
812 it = int(args[itIdx+1]) |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
813 except: |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
814 mx.abort('-it (Iteration time) needs a numeric value (seconds)') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
815 vmArgs.remove('-it') |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
816 benchArgs.remove(args[itIdx+1]) |
43b4e9201c29
Improve specjvm2008 command
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4483
diff
changeset
|
817 sanitycheck.getSPECjvm2008(benchArgs, skipValid, wt, it).bench('graal', opts=vmArgs) |
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
|
818 |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
819 def hsdis(args): |
4575
ccb5369481a2
Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents:
4572
diff
changeset
|
820 """install the hsdis library |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
821 |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
822 This is needed to support HotSpot's assembly dumping features. |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
823 By default it installs the Intel syntax version, use the 'att' argument to install AT&T syntax.""" |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
824 flavor = 'intel' |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
825 if 'att' in args: |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
826 flavor = 'att' |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
827 build = _vmbuild if _vmSourcesAvailable else 'product' |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
828 lib = mx.lib_suffix('hsdis-amd64') |
4607
ee87cfe2f8f9
Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents:
4602
diff
changeset
|
829 path = join(_vmLibDirInJdk(_jdk(build)), lib) |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
830 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib]) |
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
831 |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
832 def jacocoreport(args): |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
833 """creates a JaCoCo coverage report |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
834 |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
835 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
|
836 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
|
837 jacocoreport = mx.library("JACOCOREPORT", True) |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
838 out = 'coverage' |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
839 if len(args) == 1: |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
840 out = args[0] |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
841 elif len(args) > 1: |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
842 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
|
843 mx.run_java(['-jar', jacocoreport.get_path(True), '-in', 'jacoco.exec', '-g', join(_graal_home, 'graal'), out]) |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
844 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
845 def mx_init(): |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
846 _vmbuild = 'product' |
3718 | 847 commands = { |
4226
e03ff10d4bfc
Made the gate clean the Java projects only.
Doug Simon <doug.simon@oracle.com>
parents:
4225
diff
changeset
|
848 'build': [build, '[-options]'], |
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
|
849 '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
|
850 'clean': [clean, ''], |
4184
fa6b78681c54
Added copyright check to the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4178
diff
changeset
|
851 'copyrightcheck': [copyrightcheck, ''], |
4482
7903b6c28f9c
Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4480
diff
changeset
|
852 'hsdis': [hsdis, '[att]'], |
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
|
853 'dacapo': [dacapo, '[[n] benchmark] [VM options|@DaCapo options]'], |
4480
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
854 'scaladacapo': [scaladacapo, '[[n] benchmark] [VM options|@Scala DaCapo options]'], |
7d6490436b57
Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4438
diff
changeset
|
855 'specjvm2008': [specjvm2008, '[VM options|@specjvm2008 options]'], |
3718 | 856 '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
|
857 'gate' : [gate, '[-options]'], |
4536
8caa4f2df081
Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents:
4483
diff
changeset
|
858 '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
|
859 '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
|
860 'unittest' : [unittest, '[filters...]'], |
4587
5b04b33dac74
add jtt tests, converted from the maxine repository using ConvertJTT
Lukas Stadler <lukas.stadler@jku.at>
parents:
4584
diff
changeset
|
861 'jtt' : [jtt, '[filters...]'], |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
862 'jacocoreport' : [jacocoreport, '[output directory]'], |
4269
ffd5ce8fc736
Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents:
4257
diff
changeset
|
863 'vm': [vm, '[-options] class [args...]'] |
3718 | 864 } |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
865 |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
866 mx.add_argument('--jacoco', action='store_true', dest='jacoco', help='instruments com.oracle.max.* classes using JaCoCo') |
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
|
867 |
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
|
868 if (_vmSourcesAvailable): |
4575
ccb5369481a2
Clarified mx help text on how to build/run [Graal|Client|Server].
Doug Simon <doug.simon@oracle.com>
parents:
4572
diff
changeset
|
869 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)') |
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
|
870 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product build of the VM') |
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
|
871 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug build of the VM') |
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
|
872 mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug build of the VM') |
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
|
873 |
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
|
874 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
|
875 'export': [export, '[-options] [zipfile]'], |
4240
394424b7df1a
Disabled certain DaCapo tests for fastdebug testing in the gate.
Doug Simon <doug.simon@oracle.com>
parents:
4238
diff
changeset
|
876 'build': [build, '[-options] [product|debug|fastdebug]...'] |
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
|
877 }) |
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
|
878 |
4144
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
879 mx.commands.update(commands) |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
880 |
34527a24bcf8
Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents:
3736
diff
changeset
|
881 def mx_post_parse_cmd_line(opts): |
4148
bf5efc22fb3f
Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents:
4147
diff
changeset
|
882 version = mx.java().version |
bf5efc22fb3f
Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents:
4147
diff
changeset
|
883 parts = version.split('.') |
bf5efc22fb3f
Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents:
4147
diff
changeset
|
884 assert len(parts) >= 2 |
bf5efc22fb3f
Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents:
4147
diff
changeset
|
885 assert parts[0] == '1' |
bf5efc22fb3f
Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents:
4147
diff
changeset
|
886 major = int(parts[1]) |
bf5efc22fb3f
Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents:
4147
diff
changeset
|
887 if not major >= 7: |
bf5efc22fb3f
Replace downloading of JDK 7 with copying of host JDK 7.
Doug Simon <doug.simon@oracle.com>
parents:
4147
diff
changeset
|
888 mx.abort('Requires Java version 1.7 or greater, got version ' + version) |
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
|
889 |
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
|
890 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
|
891 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
|
892 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
|
893 _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
|
894 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
|
895 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
|
896 _vmbuild = opts.vmbuild |
4684
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
897 if opts.jacoco: |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
898 global _jacoco |
e136f2d0d002
Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4660
diff
changeset
|
899 _jacoco = True |