annotate mx/commands.py @ 12647:b038b643a3a4

restricted BootstrapGraal option to GRAALVM builds only
author Doug Simon <doug.simon@oracle.com>
date Wed, 30 Oct 2013 21:49:04 +0100
parents 868dba721f1e
children c6b833f7935e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
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
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 # ----------------------------------------------------------------------------------------------------
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
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
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 # This code is free software; you can redistribute it and/or modify it
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 # under the terms of the GNU General Public License version 2 only, as
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 # published by the Free Software Foundation.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 # This code is distributed in the hope that it will be useful, but WITHOUT
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 # version 2 for more details (a copy is included in the LICENSE file that
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 # accompanied this code).
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 # You should have received a copy of the GNU General Public License version
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 # 2 along with this work; if not, write to the Free Software Foundation,
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24 # or visit www.oracle.com if you need additional information or have any
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 # questions.
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 #
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27 # ----------------------------------------------------------------------------------------------------
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
28
7509
442668d41bc2 fixed warnings
Doug Simon <doug.simon@oracle.com>
parents: 7345
diff changeset
29 import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, multiprocessing
8406
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
30 from os.path import join, exists, dirname, basename, getmtime
4156
843c8d6720da Added 'export' command for creating a GraalVM zip file distribution without the Mercurial data or VM sources.
Doug Simon <doug.simon@oracle.com>
parents: 4155
diff changeset
31 from argparse import ArgumentParser, REMAINDER
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
32 import mx
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
33 import sanitycheck
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
34 import itertools
9116
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
35 import json, textwrap
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
36
10574
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
37 # This works because when mx loads this file, it makes sure __file__ gets an absolute path
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
38 _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
39
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 """ Used to distinguish an exported GraalVM (see 'mx export'). """
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
41 _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
42
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
43 """ The VMs that can be built and run along with an optional description. Only VMs with a
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
44 description are listed in the dialogue for setting the default VM (see _get_vm()). """
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
45 _vmChoices = {
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
46 'graal' : 'All compilation is performed with Graal. This includes bootstrapping Graal itself unless -XX:-BootstrapGraal is used.',
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
47 'server' : 'Normal compilation is performed with the tiered system (i.e., client + server), Truffle compilation is performed with Graal. Use this for optimal Truffle performance.',
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
48 'client' : None, # normal compilation with client compiler, explicit compilation (e.g., by Truffle) with Graal
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
49 'server-nograal' : None, # all compilation with tiered system (i.e., client + server), Graal omitted
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
50 'client-nograal' : None, # all compilation with client compiler, Graal omitted
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
51 'original' : None, # default VM copied from bootstrap JDK
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
52 }
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
53
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
54 """ The VM that will be run by the 'vm' command and built by default by the 'build' command.
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
55 This can be set via the global '--vm' option or the DEFAULT_VM environment variable.
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
56 It can also be temporarily set by using of a VM context manager object in a 'with' statement. """
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
57 _vm = None
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
58
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
59 """ The VM builds that will be run by the 'vm' command - default is first in list """
9157
a38d748d4130 Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9130
diff changeset
60 _vmbuildChoices = ['product', 'fastdebug', 'debug', 'optimized']
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
61
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
62 """ The VM build that will be run by the 'vm' command.
11371
74414b248381 mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents: 11368
diff changeset
63 This can be set via the global '--vmbuild' option.
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
64 It can also be temporarily set by using of a VM context manager object in a 'with' statement. """
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
65 _vmbuild = _vmbuildChoices[0]
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
66
5024
7ccdae96e98a Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5016
diff changeset
67 _jacoco = 'off'
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
68
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
69 """ The current working directory to switch to before running the VM. """
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
70 _vm_cwd = None
10454
590b0c26877f mx: add --workdir argument
Bernhard Urban <bernhard.urban@jku.at>
parents: 10417
diff changeset
71
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
72 """ The base directory in which the JDKs cloned from $JAVA_HOME exist. """
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
73 _installed_jdks = None
10570
2f80624df8a2 Add a --vmdir argument to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10568
diff changeset
74
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
75 """ Prefix for running the VM. """
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
76 _vm_prefix = None
5875
000fb0550afe Add an option to launch the vm from a debugger in mx's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5871
diff changeset
77
5194
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
78 _make_eclipse_launch = False
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
79
7916
9bff64f43299 Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7788
diff changeset
80 _minVersion = mx.JavaVersion('1.7.0_04')
9bff64f43299 Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7788
diff changeset
81
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
82 def _get_vm():
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
83 """
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
84 Gets the configured VM, presenting a dialogue if there is no currently configured VM.
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
85 """
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
86 global _vm
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
87 if _vm:
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
88 return _vm
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
89 vm = mx.get_env('DEFAULT_VM')
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
90 if vm is None:
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
91 if not sys.stdout.isatty():
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
92 mx.abort('Need to specify VM with --vm option or DEFAULT_VM environment variable')
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
93 envPath = join(_graal_home, 'mx', 'env')
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
94 mx.log('Please select the VM to be executed from the following: ')
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
95 items = [k for k in _vmChoices.keys() if _vmChoices[k] is not None]
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
96 descriptions = [_vmChoices[k] for k in _vmChoices.keys() if _vmChoices[k] is not None]
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
97 vm = mx.select_items(items, descriptions, allowMultiple=False)
11511
3110bea9a6b0 mx: add helper method for yes/no question
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11493
diff changeset
98 if mx.ask_yes_no('Persist this choice by adding "DEFAULT_VM=' + vm + '" to ' + envPath, 'y'):
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
99 with open(envPath, 'a') as fp:
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
100 print >> fp, 'DEFAULT_VM=' + vm
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
101 _vm = vm
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
102 return vm
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
103
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
104 """
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
105 A context manager that can be used with the 'with' statement to set the VM
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
106 used by all VM executions within the scope of the 'with' statement. For example:
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
107
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
108 with VM('server'):
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
109 dacapo(['pmd'])
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
110 """
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
111 class VM:
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
112 def __init__(self, vm=None, build=None):
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
113 assert vm is None or vm in _vmChoices.keys()
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
114 assert build is None or build in _vmbuildChoices
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
115 self.vm = vm if vm else _vm
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
116 self.build = build if build else _vmbuild
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
117 self.previousVm = _vm
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
118 self.previousBuild = _vmbuild
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
119
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
120 def __enter__(self):
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
121 global _vm, _vmbuild
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
122 _vm = self.vm
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
123 _vmbuild = self.build
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
124
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
125 def __exit__(self, exc_type, exc_value, traceback):
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
126 global _vm, _vmbuild
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
127 _vm = self.previousVm
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
128 _vmbuild = self.previousBuild
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
129
6705
0cb1ac637dd0 Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6702
diff changeset
130 def _chmodDir(chmodFlags, dirname, fnames):
0cb1ac637dd0 Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6702
diff changeset
131 os.chmod(dirname, chmodFlags)
7509
442668d41bc2 fixed warnings
Doug Simon <doug.simon@oracle.com>
parents: 7345
diff changeset
132 for name in fnames:
442668d41bc2 fixed warnings
Doug Simon <doug.simon@oracle.com>
parents: 7345
diff changeset
133 os.chmod(os.path.join(dirname, name), chmodFlags)
6705
0cb1ac637dd0 Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6702
diff changeset
134
0cb1ac637dd0 Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6702
diff changeset
135 def chmodRecursive(dirname, chmodFlags):
0cb1ac637dd0 Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6702
diff changeset
136 os.path.walk(dirname, _chmodDir, chmodFlags)
0cb1ac637dd0 Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6702
diff changeset
137
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
138 def clean(args):
6291
633136426f26 consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents: 6278
diff changeset
139 """clean the GraalVM source tree"""
4247
3f6c6e61614e Changed 'mx build' such that all Java sources for a project are compiled together instead of by source directory.
Doug Simon <doug.simon@oracle.com>
parents: 4244
diff changeset
140 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
141 if opts.native:
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
142 def rmIfExists(name):
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
143 if os.path.isdir(name):
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
144 shutil.rmtree(name)
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
145 elif os.path.isfile(name):
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
146 os.unlink(name)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
147
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
148 rmIfExists(join(_graal_home, 'build'))
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
149 rmIfExists(join(_graal_home, 'build-nograal'))
9119
0c9c4ae236b2 refactoring to ensure the path to the JDKs dir is consistent between the _jdk() and clean() command
Doug Simon <doug.simon@oracle.com>
parents: 9118
diff changeset
150 rmIfExists(_jdksDir())
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
151 rmIfExists(mx.distribution('GRAAL').path)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
152
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
153 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
154 """create a GraalVM zip file for distribution"""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
155
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
156 parser = ArgumentParser(prog='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
157 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
158 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
159 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
160
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
161 args = parser.parse_args(args)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
162
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
163 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
164 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
165 # Make sure the product VM binary is up to date
11371
74414b248381 mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents: 11368
diff changeset
166 with VM(vmbuild='product'):
74414b248381 mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents: 11368
diff changeset
167 build([])
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
168
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
169 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
170 mx.run(('hg archive -I graal -I mx -I mxtool -I mx.sh ' + tmp).split())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
171
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
172 # 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
173 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
174 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
175 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
176 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
177 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
178 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
179 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
180 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
181 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
182 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
183 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
184
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
185 # 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
186 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
187 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
188 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
189 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
190 mx.run('mx ideinit'.split(), cwd=tmp)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
191
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
192 # 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
193 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
194 shutil.rmtree(tmp)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
195
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
196 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
197
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
198 def _run_benchmark(args, availableBenchmarks, runBenchmark):
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
199
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
200 vmOpts, benchmarksAndOptions = _extract_VM_args(args, useDoubleDash=availableBenchmarks is None)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
201
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
202 if availableBenchmarks is None:
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
203 harnessArgs = benchmarksAndOptions
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
204 return runBenchmark(None, harnessArgs, 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
205
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
206 if len(benchmarksAndOptions) == 0:
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
207 mx.abort('at least one benchmark name or "all" must be specified')
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
208 benchmarks = list(itertools.takewhile(lambda x: not x.startswith('-'), benchmarksAndOptions))
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
209 harnessArgs = benchmarksAndOptions[len(benchmarks):]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
210
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
211 if 'all' in benchmarks:
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
212 benchmarks = availableBenchmarks
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
213 else:
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
214 for bm in benchmarks:
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
215 if bm not in availableBenchmarks:
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
216 mx.abort('unknown benchmark: ' + bm + '\nselect one of: ' + str(availableBenchmarks))
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
217
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
218 failed = []
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
219 for bm in benchmarks:
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
220 if not runBenchmark(bm, harnessArgs, vmOpts):
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
221 failed.append(bm)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
222
4157
b26279781d95 Simplified 'dacapo' command and made it more suitable for gate usage.
Doug Simon <doug.simon@oracle.com>
parents: 4156
diff changeset
223 if len(failed) != 0:
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
224 mx.abort('Benchmark failures: ' + str(failed))
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
225
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
226 def dacapo(args):
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
227 """run one or more DaCapo benchmarks"""
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
228
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
229 def launcher(bm, harnessArgs, extraVmOpts):
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
230 return sanitycheck.getDacapo(bm, harnessArgs).test(_get_vm(), extraVmOpts=extraVmOpts)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
231
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
232 _run_benchmark(args, sanitycheck.dacapoSanityWarmup.keys(), launcher)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
233
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
234 def scaladacapo(args):
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
235 """run one or more Scala DaCapo benchmarks"""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
236
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
237 def launcher(bm, harnessArgs, extraVmOpts):
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
238 return sanitycheck.getScalaDacapo(bm, harnessArgs).test(_get_vm(), extraVmOpts=extraVmOpts)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
239
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
240 _run_benchmark(args, sanitycheck.dacapoScalaSanityWarmup.keys(), launcher)
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
241
6495
75f130f2b30f moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents: 6340
diff changeset
242 def _arch():
6512
edea9ba7ac7b Windows-specific fix for mx.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 6506
diff changeset
243 machine = platform.uname()[4]
6558
0a6d8857306d arch is i86pc on solaris x64 boxes.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6512
diff changeset
244 if machine in ['amd64', 'AMD64', 'x86_64', 'i86pc']:
6495
75f130f2b30f moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents: 6340
diff changeset
245 return 'amd64'
11784
a2958b7bf83f add "sun4u" as a valid identifier for the SPARC architecture
Doug Simon <doug.simon@oracle.com>
parents: 11777
diff changeset
246 if machine in ['sun4v', 'sun4u']:
12540
0aa37fd2f33e mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents: 12497
diff changeset
247 return 'sparcv9'
6566
ef48be91f5fd fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents: 6558
diff changeset
248 if machine == 'i386' and mx.get_os() == 'darwin':
ef48be91f5fd fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents: 6558
diff changeset
249 try:
ef48be91f5fd fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents: 6558
diff changeset
250 # Support for Snow Leopard and earlier version of MacOSX
ef48be91f5fd fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents: 6558
diff changeset
251 if subprocess.check_output(['sysctl', '-n', 'hw.cpu64bit_capable']).strip() == '1':
ef48be91f5fd fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents: 6558
diff changeset
252 return 'amd64'
ef48be91f5fd fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents: 6558
diff changeset
253 except OSError:
ef48be91f5fd fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents: 6558
diff changeset
254 # sysctl is not available
ef48be91f5fd fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents: 6558
diff changeset
255 pass
ef48be91f5fd fixed detection of architecture on Snow Leopard and earlier versions of MacOSX
Doug Simon <doug.simon@oracle.com>
parents: 6558
diff changeset
256 mx.abort('unknown or unsupported architecture: os=' + mx.get_os() + ', machine=' + machine)
6495
75f130f2b30f moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents: 6340
diff changeset
257
4607
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
258 def _vmLibDirInJdk(jdk):
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
259 """
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
260 Get the directory within a JDK where the server and client
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
261 subdirectories are located.
4607
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
262 """
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
263 if platform.system() == 'Darwin':
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
264 return join(jdk, 'jre', 'lib')
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
265 if platform.system() == 'Windows':
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
266 return join(jdk, 'jre', 'bin')
6495
75f130f2b30f moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents: 6340
diff changeset
267 return join(jdk, 'jre', 'lib', _arch())
4607
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
268
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
269 def _vmCfgInJdk(jdk):
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
270 """
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
271 Get the jvm.cfg file.
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
272 """
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
273 if platform.system() == 'Windows':
6495
75f130f2b30f moved AMD64 specific HotSpot code in com.oracle.graal.hotspot.amd64 project
Doug Simon <doug.simon@oracle.com>
parents: 6340
diff changeset
274 return join(jdk, 'jre', 'lib', _arch(), 'jvm.cfg')
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
275 return join(_vmLibDirInJdk(jdk), 'jvm.cfg')
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
276
9119
0c9c4ae236b2 refactoring to ensure the path to the JDKs dir is consistent between the _jdk() and clean() command
Doug Simon <doug.simon@oracle.com>
parents: 9118
diff changeset
277 def _jdksDir():
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
278 return os.path.abspath(join(_installed_jdks if _installed_jdks else _graal_home, 'jdk' + str(mx.java().version)))
9119
0c9c4ae236b2 refactoring to ensure the path to the JDKs dir is consistent between the _jdk() and clean() command
Doug Simon <doug.simon@oracle.com>
parents: 9118
diff changeset
279
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
280 def _handle_missing_VM(bld, vm):
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
281 mx.log('The ' + bld + ' ' + vm + ' VM has not been created')
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
282 if sys.stdout.isatty():
11511
3110bea9a6b0 mx: add helper method for yes/no question
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11493
diff changeset
283 if mx.ask_yes_no('Build it now', 'y'):
11371
74414b248381 mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents: 11368
diff changeset
284 with VM(vm, bld):
74414b248381 mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents: 11368
diff changeset
285 build([])
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
286 return
11493
94779c895aad fixed documentation of --installed-jdks mx option
Doug Simon <doug.simon@oracle.com>
parents: 11424
diff changeset
287 mx.abort('You need to run "mx --vm ' + vm + ' --vmbuild ' + bld + ' build" to build the selected VM')
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
288
10574
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
289 def _jdk(build='product', vmToCheck=None, create=False, installGraalJar=True):
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
290 """
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
291 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
292 """
9119
0c9c4ae236b2 refactoring to ensure the path to the JDKs dir is consistent between the _jdk() and clean() command
Doug Simon <doug.simon@oracle.com>
parents: 9118
diff changeset
293 jdk = join(_jdksDir(), 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
294 if create:
10574
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
295 srcJdk = mx.java().jdk
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
296 jdkContents = ['bin', 'include', 'jre', 'lib']
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
297 if exists(join(srcJdk, 'db')):
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
298 jdkContents.append('db')
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
299 if mx.get_os() != 'windows' and exists(join(srcJdk, 'man')):
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
300 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
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 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
303 os.makedirs(jdk)
4252
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
304 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
305 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
306 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
307 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
308 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
309 shutil.copytree(src, dst)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
310
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 # Make a copy of the default VM so that this JDK can be
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
312 # reliably used as the bootstrap for a HotSpot build.
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
313 jvmCfg = _vmCfgInJdk(jdk)
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
314 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
315 mx.abort(jvmCfg + ' does not exist')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
316
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
317 defaultVM = None
8647
5f8299106dd9 A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8646
diff changeset
318 jvmCfgLines = []
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
319 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
320 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
321 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
322 parts = line.split()
12540
0aa37fd2f33e mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents: 12497
diff changeset
323 if len(parts) == 2:
0aa37fd2f33e mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents: 12497
diff changeset
324 assert parts[1] == 'KNOWN', parts[1]
0aa37fd2f33e mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents: 12497
diff changeset
325 defaultVM = parts[0][1:]
0aa37fd2f33e mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents: 12497
diff changeset
326 jvmCfgLines += ['# default VM is a copy of the unmodified ' + defaultVM + ' VM\n']
0aa37fd2f33e mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents: 12497
diff changeset
327 jvmCfgLines += ['-original KNOWN\n']
0aa37fd2f33e mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents: 12497
diff changeset
328 else:
0aa37fd2f33e mx: fix detection for sparc. ignore unparsable lines in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents: 12497
diff changeset
329 # skip lines which we cannot parse (e.g. '-hotspot ALIASED_TO -client')
12583
110c3faa57e9 mx: print warning if encounter a non-parsable line in jvm.cfg
Bernhard Urban <bernhard.urban@jku.at>
parents: 12540
diff changeset
330 mx.log("WARNING: skipping not parsable line \"" + line + "\"")
8647
5f8299106dd9 A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8646
diff changeset
331 else:
5f8299106dd9 A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8646
diff changeset
332 jvmCfgLines += [line]
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
333
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 assert defaultVM is not None, 'Could not find default VM in ' + jvmCfg
6687
a9a50f21e000 Added change to copied directory's protection when source JDK directories are read-only.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6566
diff changeset
335 if mx.get_os() != 'windows':
6705
0cb1ac637dd0 Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6702
diff changeset
336 chmodRecursive(jdk, 0755)
9117
cbfcb1054619 renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents: 9116
diff changeset
337 shutil.move(join(_vmLibDirInJdk(jdk), defaultVM), join(_vmLibDirInJdk(jdk), 'original'))
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
338
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
339
8261
2237260c6fdb the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents: 8223
diff changeset
340 with open(jvmCfg, 'w') as fp:
8647
5f8299106dd9 A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8646
diff changeset
341 for line in jvmCfgLines:
5f8299106dd9 A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8646
diff changeset
342 fp.write(line)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
343
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
344 # Install a copy of the disassembler library
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
345 try:
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
346 hsdis([], copyToDir=_vmLibDirInJdk(jdk))
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
347 except SystemExit:
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
348 pass
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
349 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
350 if not exists(jdk):
11797
65dbed1fdf46 be verbose when the JDK specified by --installed-jdks is missing
Doug Simon <doug.simon@oracle.com>
parents: 11784
diff changeset
351 if _installed_jdks:
65dbed1fdf46 be verbose when the JDK specified by --installed-jdks is missing
Doug Simon <doug.simon@oracle.com>
parents: 11784
diff changeset
352 mx.log("The selected JDK directory does not (yet) exist: " + jdk)
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
353 _handle_missing_VM(build, vmToCheck if vmToCheck else 'graal')
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
354
10574
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
355 if installGraalJar:
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
356 _installGraalJarInJdks(mx.distribution('GRAAL'))
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
357
8261
2237260c6fdb the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents: 8223
diff changeset
358 if vmToCheck is not None:
2237260c6fdb the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents: 8223
diff changeset
359 jvmCfg = _vmCfgInJdk(jdk)
2237260c6fdb the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents: 8223
diff changeset
360 found = False
2237260c6fdb the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents: 8223
diff changeset
361 with open(jvmCfg) as f:
2237260c6fdb the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents: 8223
diff changeset
362 for line in f:
2237260c6fdb the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents: 8223
diff changeset
363 if line.strip() == '-' + vmToCheck + ' KNOWN':
2237260c6fdb the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents: 8223
diff changeset
364 found = True
2237260c6fdb the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents: 8223
diff changeset
365 break
2237260c6fdb the contents of jvm.cfg are reset when copying the JDK so that the non-default VMs must be built before being run
Doug Simon <doug.simon@oracle.com>
parents: 8223
diff changeset
366 if not found:
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
367 _handle_missing_VM(build, vmToCheck)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
368
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
369 return jdk
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
370
11936
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
371 def _updateInstalledGraalOptionsFile(jdk):
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
372 graalOptions = join(_graal_home, 'graal.options')
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
373 jreLibDir = join(jdk, 'jre', 'lib')
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
374 if exists(graalOptions):
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
375 shutil.copy(graalOptions, join(jreLibDir, 'graal.options'))
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
376 else:
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
377 toDelete = join(jreLibDir, 'graal.options')
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
378 if exists(toDelete):
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
379 os.unlink(toDelete)
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
380
8134
6e3ebc6fd5a4 graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents: 8132
diff changeset
381 def _installGraalJarInJdks(graalDist):
6e3ebc6fd5a4 graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents: 8132
diff changeset
382 graalJar = graalDist.path
10574
0cad5096735e commands.py: Make sure _jdk returns an absolute path. Use _jdk and _jdksDir where necessary
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 10570
diff changeset
383 jdks = _jdksDir()
8134
6e3ebc6fd5a4 graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents: 8132
diff changeset
384 if exists(jdks):
6e3ebc6fd5a4 graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents: 8132
diff changeset
385 for e in os.listdir(jdks):
6e3ebc6fd5a4 graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents: 8132
diff changeset
386 jreLibDir = join(jdks, e, 'jre', 'lib')
6e3ebc6fd5a4 graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents: 8132
diff changeset
387 if exists(jreLibDir):
8180
0934903d28f3 use shutil.move to make concurrent updating/replacement of graal.jar atomic
Doug Simon <doug.simon@oracle.com>
parents: 8135
diff changeset
388 # do a copy and then a move to get atomic updating (on Unix) of graal.jar in the JRE
8183
4b11a0983557 fixed issue with deleting temp files on Windows
Doug Simon <doug.simon@oracle.com>
parents: 8182
diff changeset
389 fd, tmp = tempfile.mkstemp(suffix='', prefix='graal.jar', dir=jreLibDir)
8180
0934903d28f3 use shutil.move to make concurrent updating/replacement of graal.jar atomic
Doug Simon <doug.simon@oracle.com>
parents: 8135
diff changeset
390 shutil.copyfile(graalJar, tmp)
8183
4b11a0983557 fixed issue with deleting temp files on Windows
Doug Simon <doug.simon@oracle.com>
parents: 8182
diff changeset
391 os.close(fd)
8180
0934903d28f3 use shutil.move to make concurrent updating/replacement of graal.jar atomic
Doug Simon <doug.simon@oracle.com>
parents: 8135
diff changeset
392 shutil.move(tmp, join(jreLibDir, 'graal.jar'))
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
393
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
394 # run a command in the windows SDK Debug Shell
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
395 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None):
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
396 if respondTo is None:
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
397 respondTo = {}
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
398 newLine = os.linesep
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
399 startToken = 'RUNINDEBUGSHELL_STARTSEQUENCE'
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
400 endToken = 'RUNINDEBUGSHELL_ENDSEQUENCE'
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
401
4252
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
402 winSDK = mx.get_env('WIN_SDK', 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\')
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
403
6306
2a819543cc45 Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6294
diff changeset
404 if not exists(winSDK):
2a819543cc45 Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6294
diff changeset
405 mx.abort("Could not find Windows SDK : '" + winSDK + "' does not exist")
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
406
6306
2a819543cc45 Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6294
diff changeset
407 if not exists(join(winSDK, 'Bin', 'SetEnv.cmd')):
2a819543cc45 Warnings for windows build if there is no SDK
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6294
diff changeset
408 mx.abort("Invalid Windows SDK path (" + winSDK + ") : could not find Bin/SetEnv.cmd (you can use the WIN_SDK environment variable to specify an other path)")
4252
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
409
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
410 p = subprocess.Popen('cmd.exe /E:ON /V:ON /K ""' + winSDK + '/Bin/SetEnv.cmd" & echo ' + startToken + '"', \
4252
67e88b7624d5 Removed need for GRAAL environment variable on Windows.
Doug Simon <doug.simon@oracle.com>
parents: 4247
diff changeset
411 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
412 stdout = p.stdout
ffd5ce8fc736 Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents: 4257
diff changeset
413 stdin = p.stdin
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
414 if logFile:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
415 log = open(logFile, 'w')
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
416 ret = False
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
417 while True:
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
418
7291
a748e4d44694 Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents: 7290
diff changeset
419 # encoding may be None on windows plattforms
a748e4d44694 Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents: 7290
diff changeset
420 if sys.stdout.encoding is None:
a748e4d44694 Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents: 7290
diff changeset
421 encoding = 'utf-8'
a748e4d44694 Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents: 7290
diff changeset
422 else:
a748e4d44694 Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents: 7290
diff changeset
423 encoding = sys.stdout.encoding
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
424
7291
a748e4d44694 Truffle API to specify type-specalized Node classes; annotation processor for automatic code generation of the type-specialized Node classes during the build process
Christian Humer <christian.humer@gmail.com>
parents: 7290
diff changeset
425 line = stdout.readline().decode(encoding)
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
426 if logFile:
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
427 log.write(line.encode('utf-8'))
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
428 line = line.strip()
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
429 mx.log(line)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
430 if line == startToken:
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
431 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
432 for regex in respondTo.keys():
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
433 match = regex.search(line)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
434 if match:
4269
ffd5ce8fc736 Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents: 4257
diff changeset
435 stdin.write(respondTo[regex] + newLine)
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
436 if findInOutput:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
437 match = findInOutput.search(line)
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
438 if match:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
439 ret = True
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
440 if line == endToken:
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
441 if not findInOutput:
5868
a10e72af4dc5 Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5782
diff changeset
442 stdin.write('echo ERRXXX%errorlevel%' + newLine)
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
443 else:
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
444 break
5868
a10e72af4dc5 Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5782
diff changeset
445 if line.startswith('ERRXXX'):
a10e72af4dc5 Make windows build work even if Visual Studio is not installed (only the Windows SDK is required)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5782
diff changeset
446 if line == 'ERRXXX0':
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
447 ret = True
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
448 break
4269
ffd5ce8fc736 Moved IDE project configuration into mx.py.
Doug Simon <doug.simon@oracle.com>
parents: 4257
diff changeset
449 stdin.write('exit' + newLine)
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
450 if logFile:
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
451 log.close()
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
452 return ret
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
453
11605
3676540f71cf Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents: 11534
diff changeset
454 def jdkhome(vm=None):
3676540f71cf Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents: 11534
diff changeset
455 """return the JDK directory selected for the 'vm' command"""
3676540f71cf Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents: 11534
diff changeset
456 build = _vmbuild if _vmSourcesAvailable else 'product'
3676540f71cf Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents: 11534
diff changeset
457 return _jdk(build, installGraalJar=False)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
458
11605
3676540f71cf Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents: 11534
diff changeset
459 def print_jdkhome(args, vm=None):
3676540f71cf Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents: 11534
diff changeset
460 """print the JDK directory selected for the 'vm' command"""
3676540f71cf Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents: 11534
diff changeset
461 print jdkhome(vm)
5103
276e14614531 Added jdkhome command to mx.
Doug Simon <doug.simon@oracle.com>
parents: 5094
diff changeset
462
9116
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
463 def buildvars(args):
11377
0fbc1e418c88 fixed capitalization and tense in documentation of some mx commands
Doug Simon <doug.simon@oracle.com>
parents: 11373
diff changeset
464 """describe the variables that can be set by the -D option to the 'mx build' commmand"""
9116
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
465
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
466 buildVars = {
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
467 'ALT_BOOTDIR' : 'The location of the bootstrap JDK installation (default: ' + mx.java().jdk + ')',
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
468 'ALT_OUTPUTDIR' : 'Build directory',
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
469 'HOTSPOT_BUILD_JOBS' : 'Number of CPUs used by make (default: ' + str(multiprocessing.cpu_count()) + ')',
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
470 'INSTALL' : 'Install the built VM into the JDK? (default: y)',
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
471 'ZIP_DEBUGINFO_FILES' : 'Install zipped debug symbols file? (default: 0)',
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
472 }
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
473
9116
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
474 mx.log('HotSpot build variables that can be set by the -D option to "mx build":')
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
475 mx.log('')
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
476 for n in sorted(buildVars.iterkeys()):
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
477 mx.log(n)
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
478 mx.log(textwrap.fill(buildVars[n], initial_indent=' ', subsequent_indent=' ', width=200))
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
479
9120
9f361c0f912b added note about mx/env to the output of 'mx buildvars'
Doug Simon <doug.simon@oracle.com>
parents: 9119
diff changeset
480 mx.log('')
9f361c0f912b added note about mx/env to the output of 'mx buildvars'
Doug Simon <doug.simon@oracle.com>
parents: 9119
diff changeset
481 mx.log('Note that these variables can be given persistent values in the file ' + join(_graal_home, 'mx', 'env') + ' (see \'mx about\').')
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
482
4577
bc8b58c11768 Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4575
diff changeset
483 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
484 """build the VM binary
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
485
11392
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
486 The global '--vm' and '--vmbuild' options select which VM type and build target to build."""
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
487
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
488 # Override to fail quickly if extra arguments are given
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
489 # at the end of the command line. This allows for a more
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
490 # helpful error message.
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
491 class AP(ArgumentParser):
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
492 def __init__(self):
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
493 ArgumentParser.__init__(self, prog='mx build')
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
494 def parse_args(self, args):
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
495 result = ArgumentParser.parse_args(self, args)
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
496 if len(result.remainder) != 0:
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
497 firstBuildTarget = result.remainder[0]
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
498 mx.abort('To specify the ' + firstBuildTarget + ' VM build target, you need to use the global "--vmbuild" option. For example:\n' +
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
499 ' mx --vmbuild ' + firstBuildTarget + ' build')
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
500 return result
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
501
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
502 # Call mx.build to compile the Java sources
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
503 parser = AP()
10083
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
504 parser.add_argument('--export-dir', help='directory to which graal.jar and graal.options will be copied', metavar='<path>')
9116
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
505 parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value')
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
506 opts2 = mx.build(['--source', '1.7'] + args, parser=parser)
11392
66251d9f62ab fail faster with better error message if deprecated and unsupported mx build command line is given
Doug Simon <doug.simon@oracle.com>
parents: 11377
diff changeset
507 assert len(opts2.remainder) == 0
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
508
10083
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
509 if opts2.export_dir is not None:
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
510 if not exists(opts2.export_dir):
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
511 os.makedirs(opts2.export_dir)
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
512 else:
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
513 assert os.path.isdir(opts2.export_dir), '{} is not a directory'.format(opts2.export_dir)
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
514
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
515 shutil.copy(mx.distribution('GRAAL').path, opts2.export_dir)
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
516 graalOptions = join(_graal_home, 'graal.options')
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
517 if exists(graalOptions):
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
518 shutil.copy(graalOptions, opts2.export_dir)
8dc4cdde75fb remove build-graal.xml and have make directly call mx to generate graal.jar
Doug Simon <doug.simon@oracle.com>
parents: 10067
diff changeset
519
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
520 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
521 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
522
11371
74414b248381 mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents: 11368
diff changeset
523 builds = [_vmbuild]
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
524
4577
bc8b58c11768 Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4575
diff changeset
525 if vm is None:
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
526 vm = _get_vm()
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
527
9117
cbfcb1054619 renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents: 9116
diff changeset
528 if vm == 'original':
cbfcb1054619 renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents: 9116
diff changeset
529 pass
cbfcb1054619 renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents: 9116
diff changeset
530 elif vm.startswith('server'):
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
531 buildSuffix = ''
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
532 elif vm.startswith('client'):
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
533 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
534 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
535 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
536 buildSuffix = 'graal'
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
537
11530
be9e54fbb699 Use a better warning message for building with --installed-jdks set
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11526
diff changeset
538 if _installed_jdks and _installed_jdks != _graal_home:
be9e54fbb699 Use a better warning message for building with --installed-jdks set
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11526
diff changeset
539 if not mx.ask_yes_no("Warning: building while --installed-jdks is set (" + _installed_jdks + ") is not recommanded - are you sure you want to continue", 'n'):
11512
38acec26d535 If _installed_jdk is set, ask confirmation before building
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11511
diff changeset
540 mx.abort(1)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
541
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
542 for build in builds:
5094
d3f547b08304 added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents: 5090
diff changeset
543 if build == 'ide-build-target':
11302
fcb4cf14a3c3 absence of IDE_BUILD_TARGET environment variable prevents HotSpot builds when editing C++ sources in Eclipse
Doug Simon <doug.simon@oracle.com>
parents: 11296
diff changeset
544 build = os.environ.get('IDE_BUILD_TARGET', None)
fcb4cf14a3c3 absence of IDE_BUILD_TARGET environment variable prevents HotSpot builds when editing C++ sources in Eclipse
Doug Simon <doug.simon@oracle.com>
parents: 11296
diff changeset
545 if build is None or len(build) == 0:
5094
d3f547b08304 added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents: 5090
diff changeset
546 continue
d3f547b08304 added mechanism for disabling automatic native builds from the IDE (set IDE_BUILD_TARGET="" in mx/env)
Doug Simon <doug.simon@oracle.com>
parents: 5090
diff changeset
547
9098
d766fd8eede0 VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents: 9097
diff changeset
548 jdk = _jdk(build, create=True)
8647
5f8299106dd9 A server0 "build" needs to create a jdk copy if it does not exist yet
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8646
diff changeset
549
9117
cbfcb1054619 renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents: 9116
diff changeset
550 if vm == 'original':
9098
d766fd8eede0 VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents: 9097
diff changeset
551 if build != 'product':
9117
cbfcb1054619 renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents: 9116
diff changeset
552 mx.log('only product build of original VM exists')
9098
d766fd8eede0 VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents: 9097
diff changeset
553 continue
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
554
4607
ee87cfe2f8f9 Made GraalVM build work on Mac OS X.
Doug Simon <doug.simon@oracle.com>
parents: 4602
diff changeset
555 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
556 if not exists(vmDir):
6687
a9a50f21e000 Added change to copied directory's protection when source JDK directories are read-only.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6566
diff changeset
557 if mx.get_os() != 'windows':
6705
0cb1ac637dd0 Added recursive chmod for cases where JAVA_HOME is not owned by graal workspace owner.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6702
diff changeset
558 chmodRecursive(jdk, 0755)
4417
648a7873cea2 Made it possible to build and run the client and server VM with a new '--vm' option to 'mx build' and a global option of the same name.
Doug Simon <doug.simon@oracle.com>
parents: 4407
diff changeset
559 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
560 os.makedirs(vmDir)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
561
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
562 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
563 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
564 sys.stderr.write(line + os.linesep)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
565
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
566 # Check if a build really needs to be done
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
567 timestampFile = join(vmDir, '.build-timestamp')
9098
d766fd8eede0 VM copy made during initial copy of the JDK is now named 'boot' instead of 'server0' to better reflect that it is the default VM (which may not be 'server') from the boot JDK
Doug Simon <doug.simon@oracle.com>
parents: 9097
diff changeset
568 if opts2.force or not exists(timestampFile):
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
569 mustBuild = True
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
570 else:
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
571 mustBuild = False
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
572 timestamp = os.path.getmtime(timestampFile)
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
573 sources = []
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
574 for d in ['src', 'make']:
5244
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
575 for root, dirnames, files in os.walk(join(_graal_home, d)):
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
576 # ignore <graal>/src/share/tools
5244
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
577 if root == join(_graal_home, 'src', 'share'):
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
578 dirnames.remove('tools')
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
579 sources += [join(root, name) for name in files]
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
580 for f in sources:
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
581 if len(f) != 0 and os.path.getmtime(f) > timestamp:
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
582 mustBuild = True
5244
55ff4ba8d7b1 ignore src/share/tools directory in native build out-of-date check
Doug Simon <doug.simon@oracle.com>
parents: 5239
diff changeset
583 break
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
584
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
585 if not mustBuild:
10568
070b4a3c56f3 disabled "noisy" log statements unless -v option (i.e. verbose) is specified to mx
Doug Simon <doug.simon@oracle.com>
parents: 10527
diff changeset
586 mx.logv('[all files in src and make directories are older than ' + timestampFile[len(_graal_home) + 1:] + ' - skipping native build]')
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
587 continue
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
588
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
589 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
590 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
591 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
592
4572
76841bdd5f3e (Windows) Add Graal build configurations (with GRAAL defined) and fix build command.
Andreas Woess <andreas.woess@jku.at>
parents: 4559
diff changeset
593 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
594 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
595 _runInDebugShell('msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcproj /p:Configuration=' + project_config + ' /target:clean', _graal_home)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
596 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
597 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
598 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
599 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
600 mx.log('Error executing create command')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
601 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
602 winBuildCmd = 'msbuild ' + _graal_home + r'\build\vs-amd64\jvm.vcxproj /p:Configuration=' + project_config + ' /p:Platform=x64'
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
603 if not _runInDebugShell(winBuildCmd, _graal_home, compilelogfile):
4234
057620486c90 Improved time stamps of gate tasks to show duration of each task explicitly.
Doug Simon <doug.simon@oracle.com>
parents: 4230
diff changeset
604 mx.log('Error building project')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
605 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
606 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
607 cpus = multiprocessing.cpu_count()
6718
cce59a7ee92c Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6705
diff changeset
608 runCmd = [mx.gmake_cmd()]
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
609 runCmd.append(build + buildSuffix)
8884
51a8368d0231 Adapt to changes in hotspot makefiles : pass our JAVA_HOME as ALT_BOOTDIR (so that things are built with a 'safe' jdk) and our jdk copy as JAVA_HOME (so that the jvm gets installed there)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8647
diff changeset
610 env = os.environ.copy()
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
611
9116
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
612 if opts2.D:
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
613 for nv in opts2.D:
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
614 name, value = nv.split('=', 1)
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
615 env[name.strip()] = value
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
616
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
617 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
618 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
619 env.setdefault('HOTSPOT_BUILD_JOBS', str(cpus))
9116
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
620 env.setdefault('ALT_BOOTDIR', mx.java().jdk)
9161
8d4174140745 Make the native build less verbose unless mx -v is used
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9159
diff changeset
621 if not mx._opts.verbose:
8d4174140745 Make the native build less verbose unless mx -v is used
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9159
diff changeset
622 runCmd.append('MAKE_VERBOSE=')
8884
51a8368d0231 Adapt to changes in hotspot makefiles : pass our JAVA_HOME as ALT_BOOTDIR (so that things are built with a 'safe' jdk) and our jdk copy as JAVA_HOME (so that the jvm gets installed there)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8647
diff changeset
623 env['JAVA_HOME'] = jdk
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
624 if vm.endswith('nograal'):
9166
0f3fe35513a0 renamed build variable used to make a Graal/non-Graal build from OMIT_GRAAL to INCLUDE_GRAAL and ensured it is only used internally
Doug Simon <doug.simon@oracle.com>
parents: 9163
diff changeset
625 env['INCLUDE_GRAAL'] = 'false'
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
626 env.setdefault('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os()))
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
627 else:
9166
0f3fe35513a0 renamed build variable used to make a Graal/non-Graal build from OMIT_GRAAL to INCLUDE_GRAAL and ensured it is only used internally
Doug Simon <doug.simon@oracle.com>
parents: 9163
diff changeset
628 env['INCLUDE_GRAAL'] = 'true'
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
629 env.setdefault('INSTALL', 'y')
6702
602ee4d1db61 added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6701
diff changeset
630 if mx.get_os() == 'solaris' :
602ee4d1db61 added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6701
diff changeset
631 # If using sparcWorks, setup flags to avoid make complaining about CC version
602ee4d1db61 added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6701
diff changeset
632 cCompilerVersion = subprocess.Popen('CC -V', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).stderr.readlines()[0]
602ee4d1db61 added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6701
diff changeset
633 if cCompilerVersion.startswith('CC: Sun C++') :
602ee4d1db61 added setup of ENFORCE_COMPILER_REV and ENFORCE_CC_COMPILER_REV when using sunstudio compilers on Solaris to avoid build complaint from HotSpot makefiles.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6701
diff changeset
634 compilerRev = cCompilerVersion.split(' ')[3]
6718
cce59a7ee92c Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6705
diff changeset
635 env.setdefault('ENFORCE_COMPILER_REV', compilerRev)
cce59a7ee92c Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6705
diff changeset
636 env.setdefault('ENFORCE_CC_COMPILER_REV', compilerRev)
cce59a7ee92c Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6705
diff changeset
637 if build == 'jvmg':
cce59a7ee92c Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6705
diff changeset
638 # I want ALL the symbols when I'm debugging on Solaris
cce59a7ee92c Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6705
diff changeset
639 # Some Makefile variable are overloaded by environment variable so we need to explicitely
cce59a7ee92c Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6705
diff changeset
640 # pass them down in the command line. This one is an example of that.
cce59a7ee92c Avoids stripping libjvm.so when building debug on Solaris (.debuginfo files don't work well with Oracle Solaris Studio 12.3's solaris).
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6705
diff changeset
641 runCmd.append('STRIP_POLICY=no_strip')
6276
03c4c25ae726 disabled zipping of lib*.debuginfo files to simplify debugging with gdb
Doug Simon <doug.simon@oracle.com>
parents: 5881
diff changeset
642 # This removes the need to unzip the *.diz files before debugging in gdb
03c4c25ae726 disabled zipping of lib*.debuginfo files to simplify debugging with gdb
Doug Simon <doug.simon@oracle.com>
parents: 5881
diff changeset
643 env.setdefault('ZIP_DEBUGINFO_FILES', '0')
03c4c25ae726 disabled zipping of lib*.debuginfo files to simplify debugging with gdb
Doug Simon <doug.simon@oracle.com>
parents: 5881
diff changeset
644
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
645 # 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
646 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
647 env.pop('CLASSPATH', None)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
648
8884
51a8368d0231 Adapt to changes in hotspot makefiles : pass our JAVA_HOME as ALT_BOOTDIR (so that things are built with a 'safe' jdk) and our jdk copy as JAVA_HOME (so that the jvm gets installed there)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8647
diff changeset
649 mx.run(runCmd, cwd=join(_graal_home, 'make'), err=filterXusage, env=env)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
650
5680
87fc13b59258 Split _vmLibDirInJdk into _vmLibDirInJdk and _vmCfgInJdk to account for Windows jdk layout
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5649
diff changeset
651 jvmCfg = _vmCfgInJdk(jdk)
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
652 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
653 mx.abort(jvmCfg + ' does not exist')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
654
8901
8ddaac81cb21 Be more careful while updating jvm.cfg (fixes a bug where the -server configuration would overwrite the -server0 one)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8900
diff changeset
655 prefix = '-' + vm + ' '
8ddaac81cb21 Be more careful while updating jvm.cfg (fixes a bug where the -server configuration would overwrite the -server0 one)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8900
diff changeset
656 vmKnown = prefix + 'KNOWN\n'
8889
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
657 lines = []
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
658 found = False
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
659 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
660 for line in f:
8889
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
661 if line.strip() == vmKnown.strip():
4559
723df37192d6 Make it possible again to build a real client libjvm, drop the UseGraal flag.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4540
diff changeset
662 found = True
8889
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
663 lines.append(line)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
664
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
665 if not found:
8901
8ddaac81cb21 Be more careful while updating jvm.cfg (fixes a bug where the -server configuration would overwrite the -server0 one)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8900
diff changeset
666 mx.log('Appending "' + prefix + 'KNOWN" to ' + jvmCfg)
6688
806821a1c0a8 Make sure files in copy of JDK has write-protection unset before modifying it.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6687
diff changeset
667 if mx.get_os() != 'windows':
806821a1c0a8 Make sure files in copy of JDK has write-protection unset before modifying it.
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6687
diff changeset
668 os.chmod(jvmCfg, 0755)
8889
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
669 with open(jvmCfg, 'w') as f:
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
670 for line in lines:
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
671 if line.startswith(prefix):
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
672 line = vmKnown
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
673 found = True
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
674 f.write(line)
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
675 if not found:
c669e8e621a1 Update the -client line in jvm.cfg when it already exists (ie IGNORE)
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8887
diff changeset
676 f.write(vmKnown)
5194
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
677
5239
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
678 if exists(timestampFile):
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
679 os.utime(timestampFile, None)
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
680 else:
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
681 file(timestampFile, 'a')
b9db4fee6eb2 skip a native build if all files in src and make are older than the timestamp of the previous build
Doug Simon <doug.simon@oracle.com>
parents: 5234
diff changeset
682
5257
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
683 def vmg(args):
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
684 """run the debug build of VM selected by the '--vm' option"""
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
685 return vm(args, vmbuild='debug')
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
686
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
687 def vmfg(args):
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
688 """run the fastdebug build of VM selected by the '--vm' option"""
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
689 return vm(args, vmbuild='fastdebug')
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
690
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
691 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
692 """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
693
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
694 if vm is None:
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
695 vm = _get_vm()
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
696
10454
590b0c26877f mx: add --workdir argument
Bernhard Urban <bernhard.urban@jku.at>
parents: 10417
diff changeset
697 if cwd is None:
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
698 cwd = _vm_cwd
11424
ece40b452e65 mx: Fix commands.vm when an explicit cwd is passed and no --vmcwd is given
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11415
diff changeset
699 elif _vm_cwd is not None and _vm_cwd != cwd:
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
700 mx.abort("conflicting working directories: do not set --vmcwd for this command")
10454
590b0c26877f mx: add --workdir argument
Bernhard Urban <bernhard.urban@jku.at>
parents: 10417
diff changeset
701
4219
47f7d91d34cf Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4216
diff changeset
702 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product'
11286
485a5f029b32 mx: graal.jar is not silently updated anymore in the vm function
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11237
diff changeset
703 jdk = _jdk(build, vmToCheck=vm, installGraalJar=False)
11936
4cdf7623fbe6 ensure graal.options in the JDK is deployed/updated/deleted each time the VM is run
Doug Simon <doug.simon@oracle.com>
parents: 11867
diff changeset
704 _updateInstalledGraalOptionsFile(jdk)
5189
6fbf12b8e572 automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents: 5153
diff changeset
705 mx.expand_project_in_args(args)
5194
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
706 if _make_eclipse_launch:
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
707 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))
5189
6fbf12b8e572 automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents: 5153
diff changeset
708 if len([a for a in args if 'PrintAssembly' in a]) != 0:
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
709 hsdis([], copyToDir=_vmLibDirInJdk(jdk))
5032
e2de9649f0a9 Integrated mxtool updates from Maxine project.
Doug Simon <doug.simon@oracle.com>
parents: 5024
diff changeset
710 if mx.java().debug_port is not None:
e2de9649f0a9 Integrated mxtool updates from Maxine project.
Doug Simon <doug.simon@oracle.com>
parents: 5024
diff changeset
711 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(mx.java().debug_port)] + args
5024
7ccdae96e98a Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5016
diff changeset
712 if _jacoco == 'on' or _jacoco == 'append':
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
713 jacocoagent = mx.library("JACOCOAGENT", True)
5366
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
714 # Exclude all compiler tests and snippets
5881
472a648769e4 better JaCoCo : only include com.oracle.graal.* and com.oracle.max.*, exclude com.oracle.graal.jtt.*
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5878
diff changeset
715 excludes = ['com.oracle.graal.compiler.tests.*', 'com.oracle.graal.jtt.*']
5366
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
716 for p in mx.projects():
8607
c7672a325faf search for classes containing annotations returns source file as well as class name
Doug Simon <doug.simon@oracle.com>
parents: 8554
diff changeset
717 excludes += _find_classes_with_annotations(p, None, ['@Snippet', '@ClassSubstitution', '@Test'], includeInnerClasses=True).keys()
c7672a325faf search for classes containing annotations returns source file as well as class name
Doug Simon <doug.simon@oracle.com>
parents: 8554
diff changeset
718 excludes += p.find_classes_with_matching_source_line(None, lambda line: 'JaCoCo Exclude' in line, includeInnerClasses=True).keys()
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
719
9343
cdc21fd3d389 removed obsolete JaCoCo inclusion filter
Doug Simon <doug.simon@oracle.com>
parents: 9291
diff changeset
720 includes = ['com.oracle.graal.*']
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
721 agentOptions = {
5024
7ccdae96e98a Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5016
diff changeset
722 'append' : 'true' if _jacoco == 'append' else 'false',
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
723 'bootclasspath' : 'true',
5881
472a648769e4 better JaCoCo : only include com.oracle.graal.* and com.oracle.max.*, exclude com.oracle.graal.jtt.*
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5878
diff changeset
724 'includes' : ':'.join(includes),
5878
191e08da4de4 Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5877
diff changeset
725 'excludes' : ':'.join(excludes),
191e08da4de4 Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5877
diff changeset
726 'destfile' : 'jacoco.exec'
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
727 }
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
728 args = ['-javaagent:' + jacocoagent.get_path(True) + '=' + ','.join([k + '=' + v for k, v in agentOptions.items()])] + args
6691
9611d0ccb4ec Automatically add -d64 vm options when running graal
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6688
diff changeset
729 if '-d64' not in args:
9611d0ccb4ec Automatically add -d64 vm options when running graal
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6688
diff changeset
730 args = ['-d64'] + args
8132
394f685c1502 prepend -XX:GraalClassPath option if graal.jar exists (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents: 7925
diff changeset
731
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
732 exe = join(jdk, 'bin', mx.exe_suffix('java'))
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
733 pfx = _vm_prefix.split() if _vm_prefix is not None else []
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
734
9667
1ef7b26e9177 mx/commands.py: warn about arguments after '-version' when launching the vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9639
diff changeset
735 if '-version' in args:
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
736 ignoredArgs = args[args.index('-version') + 1:]
9667
1ef7b26e9177 mx/commands.py: warn about arguments after '-version' when launching the vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9639
diff changeset
737 if len(ignoredArgs) > 0:
1ef7b26e9177 mx/commands.py: warn about arguments after '-version' when launching the vm
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9639
diff changeset
738 mx.log("Warning: The following options will be ignored by the vm because they come after the '-version' argument: " + ' '.join(ignoredArgs))
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
739
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
740 return mx.run(pfx + [exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout)
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
741
5762
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
742 def _find_classes_with_annotations(p, pkgRoot, annotations, includeInnerClasses=False):
5366
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
743 """
5482
9f4783c0269e folded -G:+CheckcastCounters functionality into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents: 5438
diff changeset
744 Scan the sources of project 'p' for Java source files containing a line starting with 'annotation'
5762
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
745 (ignoring preceding whitespace) and return the fully qualified class name for each Java
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
746 source file matched in a list.
5366
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
747 """
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
748
5762
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
749 matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0
b30cced39597 generalized functionality for finding classes based on searching for patterns in source code and moved it from commands.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5729
diff changeset
750 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses)
5366
67e63e8dcbd2 build JaCoCo exclude list by scanning for snippets
Doug Simon <doug.simon@oracle.com>
parents: 5295
diff changeset
751
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
752 def _extract_VM_args(args, allowClasspath=False, useDoubleDash=False):
11359
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
753 """
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
754 Partitions a command line into a leading sequence of HotSpot VM options and the rest.
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
755 """
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
756 for i in range(0, len(args)):
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
757 if useDoubleDash:
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
758 if args[i] == '--':
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
759 vmArgs = args[:i]
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
760 remainder = args[i + 1:]
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
761 return vmArgs, remainder
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
762 else:
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
763 if not args[i].startswith('-'):
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
764 if i != 0 and (args[i - 1] == '-cp' or args[i - 1] == '-classpath'):
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
765 if not allowClasspath:
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
766 mx.abort('Cannot supply explicit class path option')
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
767 else:
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
768 continue
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
769 vmArgs = args[:i]
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
770 remainder = args[i:]
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
771 return vmArgs, remainder
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
772
11359
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
773 return args, []
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
774
8406
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
775 def _run_tests(args, harness, annotations, testfile):
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
776
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
777
11359
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
778 vmArgs, tests = _extract_VM_args(args)
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
779 for t in tests:
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
780 if t.startswith('-'):
11403
e45b540b0ef2 clearer error message
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
781 mx.abort('VM option ' + t + ' must precede ' + tests[0])
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
782
10606
a6c0ae38e05e more robust command line checking for unittest (at cost of removing support for negative filters)
Doug Simon <doug.simon@oracle.com>
parents: 10574
diff changeset
783 candidates = []
11777
f3e5cbd1efae move pylint to mxtool
Mick Jordan <mick.jordan@oracle.com>
parents: 11758
diff changeset
784 for p in mx.projects_opt_limit_to_suites():
9639
fde5ccbab3a3 made unittest command take Java compliance of a project into account
Doug Simon <doug.simon@oracle.com>
parents: 9598
diff changeset
785 if mx.java().javaCompliance < p.javaCompliance:
fde5ccbab3a3 made unittest command take Java compliance of a project into account
Doug Simon <doug.simon@oracle.com>
parents: 9598
diff changeset
786 continue
10606
a6c0ae38e05e more robust command line checking for unittest (at cost of removing support for negative filters)
Doug Simon <doug.simon@oracle.com>
parents: 10574
diff changeset
787 candidates += _find_classes_with_annotations(p, None, annotations).keys()
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
788
10606
a6c0ae38e05e more robust command line checking for unittest (at cost of removing support for negative filters)
Doug Simon <doug.simon@oracle.com>
parents: 10574
diff changeset
789 classes = []
10608
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
790 if len(tests) == 0:
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
791 classes = candidates
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
792 else:
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
793 for t in tests:
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
794 found = False
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
795 for c in candidates:
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
796 if t in c:
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
797 found = True
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
798 classes.append(c)
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
799 if not found:
eeb80dcd60d8 fixed regression in unittest command when no tests are specified
Doug Simon <doug.simon@oracle.com>
parents: 10606
diff changeset
800 mx.log('warning: no tests matched by substring "' + t)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
801
11777
f3e5cbd1efae move pylint to mxtool
Mick Jordan <mick.jordan@oracle.com>
parents: 11758
diff changeset
802 projectscp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites() if pcp.javaCompliance <= mx.java().javaCompliance])
8343
a3c30d467f96 unittest: just do a single JVM call
Bernhard Urban <bernhard.urban@jku.at>
parents: 8340
diff changeset
803
a3c30d467f96 unittest: just do a single JVM call
Bernhard Urban <bernhard.urban@jku.at>
parents: 8340
diff changeset
804 if len(classes) != 0:
8406
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
805 f_testfile = open(testfile, 'w')
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
806 for c in classes:
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
807 f_testfile.write(c + '\n')
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
808 f_testfile.close()
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
809 harness(projectscp, vmArgs)
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
810
8340
d9d883aeb96f unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents: 8317
diff changeset
811 def _unittest(args, annotations):
8406
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
812 mxdir = dirname(__file__)
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
813 name = 'JUnitWrapper'
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
814 javaSource = join(mxdir, name + '.java')
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
815 javaClass = join(mxdir, name + '.class')
9010
08a16c26907f MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents: 8901
diff changeset
816 testfile = os.environ.get('MX_TESTFILE', None)
08a16c26907f MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents: 8901
diff changeset
817 if testfile is None:
08a16c26907f MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents: 8901
diff changeset
818 (_, testfile) = tempfile.mkstemp(".testclasses", "graal")
9236
ec607ddaa99b windows-specific mx fix for executing unit tests selectively
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9177
diff changeset
819 os.close(_)
8406
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
820
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
821 def harness(projectscp, vmArgs):
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
822 if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource):
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
823 subprocess.check_call([mx.java().javac, '-cp', projectscp, '-d', mxdir, javaSource])
12647
b038b643a3a4 restricted BootstrapGraal option to GRAALVM builds only
Doug Simon <doug.simon@oracle.com>
parents: 12605
diff changeset
824 if _get_vm() != 'graal':
8440
2d0160c35f8f Fix unittest on server0.
Roland Schatz <roland.schatz@oracle.com>
parents: 8433
diff changeset
825 prefixArgs = ['-esa', '-ea']
2d0160c35f8f Fix unittest on server0.
Roland Schatz <roland.schatz@oracle.com>
parents: 8433
diff changeset
826 else:
2d0160c35f8f Fix unittest on server0.
Roland Schatz <roland.schatz@oracle.com>
parents: 8433
diff changeset
827 prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea']
11227
bd0e589a9a65 avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents: 11179
diff changeset
828 with open(testfile) as fp:
bd0e589a9a65 avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents: 11179
diff changeset
829 testclasses = [l.rstrip() for l in fp.readlines()]
bd0e589a9a65 avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents: 11179
diff changeset
830 if len(testclasses) == 1:
bd0e589a9a65 avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents: 11179
diff changeset
831 # Execute Junit directly when one test is being run. This simplifies
bd0e589a9a65 avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents: 11179
diff changeset
832 # replaying the VM execution in a native debugger (e.g., gdb).
bd0e589a9a65 avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents: 11179
diff changeset
833 vm(prefixArgs + vmArgs + ['-cp', projectscp, 'org.junit.runner.JUnitCore'] + testclasses)
bd0e589a9a65 avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents: 11179
diff changeset
834 else:
bd0e589a9a65 avoid use of JUnitWrapper when exactly one test is being executed
Doug Simon <doug.simon@oracle.com>
parents: 11179
diff changeset
835 vm(prefixArgs + vmArgs + ['-cp', projectscp + os.pathsep + mxdir, name] + [testfile])
8406
2bfb9644dcc2 unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents: 8343
diff changeset
836
8433
87346100d7a5 temporary file is removed when unittests fail
Doug Simon <doug.simon@oracle.com>
parents: 8406
diff changeset
837 try:
87346100d7a5 temporary file is removed when unittests fail
Doug Simon <doug.simon@oracle.com>
parents: 8406
diff changeset
838 _run_tests(args, harness, annotations, testfile)
87346100d7a5 temporary file is removed when unittests fail
Doug Simon <doug.simon@oracle.com>
parents: 8406
diff changeset
839 finally:
9010
08a16c26907f MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents: 8901
diff changeset
840 if os.environ.get('MX_TESTFILE') is None:
08a16c26907f MX_TESTFILE environment variable can be used to specify (and preserve) the test list file used by 'mx unittest'.
Doug Simon <doug.simon@oracle.com>
parents: 8901
diff changeset
841 os.remove(testfile)
8340
d9d883aeb96f unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents: 8317
diff changeset
842
9598
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
843 _unittestHelpSuffix = """
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
844
5649
14505f3e6b4c modified harness for running JUnit and JTT tests such that only projects declaring a 'testHarness' attribute in mx/projects are scanned for tests
Doug Simon <doug.simon@oracle.com>
parents: 5596
diff changeset
845 If filters are supplied, only tests whose fully qualified name
10606
a6c0ae38e05e more robust command line checking for unittest (at cost of removing support for negative filters)
Doug Simon <doug.simon@oracle.com>
parents: 10574
diff changeset
846 includes a filter as a substring are run.
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
847
9598
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
848 For example, this command line:
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
849
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
850 mx unittest -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG BC_aload
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
851
9598
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
852 will run all JUnit test classes that contain 'BC_aload' in their
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
853 fully qualified name and will pass these options to the VM:
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
854
9598
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
855 -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
856
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
857 To get around command line length limitations on some OSes, the
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
858 JUnit class names to be executed are written to a file that a
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
859 custom JUnit wrapper reads and passes onto JUnit proper. The
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
860 MX_TESTFILE environment variable can be set to specify a
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
861 file which will not be deleted once the unittests are done
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
862 (unlike the temporary file otherwise used).
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
863
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
864 As with all other commands, using the global '-v' before 'unittest'
11359
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
865 command will cause mx to show the complete command line
9598
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
866 it uses to run the VM.
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
867 """
9598
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
868
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
869 def unittest(args):
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
870 """run the JUnit tests (all testcases){0}"""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
871
11237
2e38c55153e5 unittest: also pick up @Parameters annotation
Bernhard Urban <bernhard.urban@jku.at>
parents: 11227
diff changeset
872 _unittest(args, ['@Test', '@LongTest', '@Parameters'])
8340
d9d883aeb96f unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents: 8317
diff changeset
873
d9d883aeb96f unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents: 8317
diff changeset
874 def shortunittest(args):
9598
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
875 """run the JUnit tests (short testcases only){0}"""
8340
d9d883aeb96f unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents: 8317
diff changeset
876
d9d883aeb96f unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents: 8317
diff changeset
877 _unittest(args, ['@Test'])
d9d883aeb96f unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents: 8317
diff changeset
878
d9d883aeb96f unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents: 8317
diff changeset
879 def longunittest(args):
9598
0fc67e300471 better help message for the unittest commands
Doug Simon <doug.simon@oracle.com>
parents: 9343
diff changeset
880 """run the JUnit tests (long testcases only){0}"""
8340
d9d883aeb96f unittest: seperate target `longunittest' and `shortunittest'
Bernhard Urban <bernhard.urban@jku.at>
parents: 8317
diff changeset
881
11237
2e38c55153e5 unittest: also pick up @Parameters annotation
Bernhard Urban <bernhard.urban@jku.at>
parents: 11227
diff changeset
882 _unittest(args, ['@LongTest', '@Parameters'])
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
883
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
884 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
885 """build one or more VMs in various configurations"""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
886
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
887 vmsDefault = ','.join(_vmChoices.keys())
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
888 vmbuildsDefault = ','.join(_vmbuildChoices)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
889
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
890 parser = ArgumentParser(prog='mx buildvms')
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
891 parser.add_argument('--vms', help='a comma separated list of VMs to build (default: ' + vmsDefault + ')', metavar='<args>', default=vmsDefault)
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
892 parser.add_argument('--builds', help='a comma separated list of build types (default: ' + vmbuildsDefault + ')', metavar='<args>', default=vmbuildsDefault)
9096
d4b868ed9cfb buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents: 9095
diff changeset
893 parser.add_argument('-n', '--no-check', action='store_true', help='omit running "java -version" after each build')
9097
a0ab945fb95f build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents: 9096
diff changeset
894 parser.add_argument('-c', '--console', action='store_true', help='send build output to console instead of log file')
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
895
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
896 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
897 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
898 builds = args.builds.split(',')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
899
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
900 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
901 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
902 for vmbuild in builds:
9117
cbfcb1054619 renamed 'boot' VM to 'original' VM
Doug Simon <doug.simon@oracle.com>
parents: 9116
diff changeset
903 if v == 'original' and vmbuild != 'product':
9095
d538dce8f403 support for non-GRAAL VMs co-existing with GRAAL VMs
Doug Simon <doug.simon@oracle.com>
parents: 9010
diff changeset
904 continue
9097
a0ab945fb95f build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents: 9096
diff changeset
905 if not args.console:
a0ab945fb95f build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents: 9096
diff changeset
906 logFile = join(v + '-' + vmbuild + '.log')
a0ab945fb95f build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents: 9096
diff changeset
907 log = open(join(_graal_home, logFile), 'wb')
a0ab945fb95f build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents: 9096
diff changeset
908 start = time.time()
a0ab945fb95f build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents: 9096
diff changeset
909 mx.log('BEGIN: ' + v + '-' + vmbuild + '\t(see: ' + logFile + ')')
a0ab945fb95f build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents: 9096
diff changeset
910 # Run as subprocess so that output can be directed to a file
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
911 subprocess.check_call([sys.executable, '-u', join('mxtool', 'mx.py'), '--vm', v, '--vmbuild',
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
912 vmbuild, 'build'], cwd=_graal_home, stdout=log, stderr=subprocess.STDOUT)
9097
a0ab945fb95f build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents: 9096
diff changeset
913 duration = datetime.timedelta(seconds=time.time() - start)
a0ab945fb95f build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents: 9096
diff changeset
914 mx.log('END: ' + v + '-' + vmbuild + '\t[' + str(duration) + ']')
a0ab945fb95f build output during buildvms command is sent to console (instead of log files) if -c option is given
Doug Simon <doug.simon@oracle.com>
parents: 9096
diff changeset
915 else:
11371
74414b248381 mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents: 11368
diff changeset
916 with VM(v, vmbuild):
74414b248381 mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents: 11368
diff changeset
917 build([])
9096
d4b868ed9cfb buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents: 9095
diff changeset
918 if not args.no_check:
d4b868ed9cfb buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents: 9095
diff changeset
919 vmargs = ['-version']
d4b868ed9cfb buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents: 9095
diff changeset
920 if v == 'graal':
d4b868ed9cfb buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents: 9095
diff changeset
921 vmargs.insert(0, '-XX:-BootstrapGraal')
d4b868ed9cfb buildvms command now runs "java -version" for each VM built unless -n option is specified
Doug Simon <doug.simon@oracle.com>
parents: 9095
diff changeset
922 vm(vmargs, vm=v, vmbuild=vmbuild)
4584
7e5d8d1c74a1 Modified JDK replication process such that a copy of the default VM is made. This prevents issues with the replicated JDK being used to bootstrap a HotSpot build.
Doug Simon <doug.simon@oracle.com>
parents: 4582
diff changeset
923 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
924 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
925
11756
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
926 class Task:
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
927 def __init__(self, title):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
928 self.start = time.time()
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
929 self.title = title
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
930 self.end = None
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
931 self.duration = None
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
932 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title)
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
933 def stop(self):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
934 self.end = time.time()
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
935 self.duration = datetime.timedelta(seconds=self.end - self.start)
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
936 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: END: ') + self.title + ' [' + str(self.duration) + ']')
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
937 return self
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
938 def abort(self, codeOrMessage):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
939 self.end = time.time()
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
940 self.duration = datetime.timedelta(seconds=self.end - self.start)
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
941 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: ABORT: ') + self.title + ' [' + str(self.duration) + ']')
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
942 mx.abort(codeOrMessage)
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
943 return self
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
944
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
945 def _basic_gate_body(args, tasks):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
946 t = Task('BuildHotSpotGraal: fastdebug,product')
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
947 buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product'])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
948 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
949
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
950 with VM('graal', 'fastdebug'):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
951 t = Task('BootstrapWithSystemAssertions:fastdebug')
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
952 vm(['-esa', '-version'])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
953 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
954
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
955 with VM('graal', 'product'):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
956 t = Task('BootstrapWithGCVerification:product')
12042
fbe1ee508936 added ability to suppress duplicate lines on an output stream and used it to filter the GC verification log messages in the gate
Doug Simon <doug.simon@oracle.com>
parents: 11936
diff changeset
957 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write
fbe1ee508936 added ability to suppress duplicate lines on an output stream and used it to filter the GC verification log messages in the gate
Doug Simon <doug.simon@oracle.com>
parents: 11936
diff changeset
958 vm(['-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out)
11756
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
959 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
960
12412
3c11430f62d8 Re-enable G1 verification in gate
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 12359
diff changeset
961 with VM('graal', 'product'):
3c11430f62d8 Re-enable G1 verification in gate
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 12359
diff changeset
962 t = Task('BootstrapWithG1GCVerification:product')
3c11430f62d8 Re-enable G1 verification in gate
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 12359
diff changeset
963 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write
12605
868dba721f1e Remove UseNewCode from gate G1 verification run
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 12583
diff changeset
964 vm(['-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out)
12412
3c11430f62d8 Re-enable G1 verification in gate
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 12359
diff changeset
965 tasks.append(t.stop())
11756
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
966
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
967 with VM('graal', 'product'):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
968 t = Task('BootstrapWithRegisterPressure:product')
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
969 vm(['-G:RegisterPressure=rbx,r11,r10,r14,xmm3,xmm11,xmm14', '-esa', '-version'])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
970 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
971
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
972 with VM('graal', 'product'):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
973 t = Task('BootstrapWithAOTConfiguration:product')
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
974 vm(['-G:+AOTCompilation', '-G:+VerifyPhases', '-esa', '-version'])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
975 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
976
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
977 with VM('server', 'product'): # hosted mode
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
978 t = Task('UnitTests:hosted-product')
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
979 unittest([])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
980 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
981
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
982 for vmbuild in ['fastdebug', 'product']:
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
983 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
984 t = Task(str(test) + ':' + vmbuild)
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
985 if not test.test('graal'):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
986 t.abort(test.name + ' Failed')
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
987 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
988
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
989 if args.jacocout is not None:
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
990 jacocoreport([args.jacocout])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
991
11758
4ac92e735a16 pylint fixes (retry)
Mick Jordan <mick.jordan@oracle.com>
parents: 11757
diff changeset
992 global _jacoco
11756
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
993 _jacoco = 'off'
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
994
12497
98caa3872d83 gate: clean and build IGV (not GV)
Bernhard Urban <bernhard.urban@jku.at>
parents: 12412
diff changeset
995 t = Task('CleanAndBuildIdealGraphVisualizer')
98caa3872d83 gate: clean and build IGV (not GV)
Bernhard Urban <bernhard.urban@jku.at>
parents: 12412
diff changeset
996 mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-q', 'clean', 'build'])
11756
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
997 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
998
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
999 # Prevent Graal modifications from breaking the standard builds
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1000 if args.buildNonGraal:
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1001 t = Task('BuildHotSpotVarieties')
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1002 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product'])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1003 buildvms(['--vms', 'server-nograal', '--builds', 'product'])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1004 buildvms(['--vms', 'server-nograal', '--builds', 'optimized'])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1005 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1006
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1007 for vmbuild in ['product', 'fastdebug']:
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1008 for theVm in ['client', 'server']:
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1009 with VM(theVm, vmbuild):
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1010 t = Task('DaCapo_pmd:' + theVm + ':' + vmbuild)
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1011 dacapo(['pmd'])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1012 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1013
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1014 t = Task('UnitTests:' + theVm + ':' + vmbuild)
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1015 unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api'])
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1016 tasks.append(t.stop())
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1017
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1018
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1019 def gate(args, gate_body=_basic_gate_body):
4159
e253ca26b2d5 Added 'unittest' command to run the Graal unit tests.
Doug Simon <doug.simon@oracle.com>
parents: 4157
diff changeset
1020 """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
1021
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
1022 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
1023 a state that would be accepted for integration into the main repository."""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1024
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1025 parser = ArgumentParser(prog='mx gate')
5232
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
1026 parser.add_argument('-j', '--omit-java-clean', action='store_false', dest='cleanJava', help='omit cleaning Java native code')
5750
30876d0bb92d In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5729
diff changeset
1027 parser.add_argument('-n', '--omit-native-clean', action='store_false', dest='cleanNative', help='omit cleaning and building native code')
4608
05a33fabcfe6 Added -g option to 'mx gate' to omit the server and client builds (i.e. -g == graal only).
Doug Simon <doug.simon@oracle.com>
parents: 4607
diff changeset
1028 parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM')
5033
d7ecce178ad2 Add jacoco report and a -XX:+DeoptimizeALot -XX:+VerifyOops bootstrap run to the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5032
diff changeset
1029 parser.add_argument('--jacocout', help='specify the output directory for jacoco report')
4601
ade18666f2be Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents: 4584
diff changeset
1030
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
1031 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
1032
5431
0bd1ba69db2a removed double declaration of _vmbuild global variable in gate command
Doug Simon <doug.simon@oracle.com>
parents: 5430
diff changeset
1033 global _jacoco
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1034
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1035 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
1036 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
1037 try:
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1038
11526
db297343d44e added pylint to gate
Doug Simon <doug.simon@oracle.com>
parents: 11525
diff changeset
1039 t = Task('Pylint')
11777
f3e5cbd1efae move pylint to mxtool
Mick Jordan <mick.jordan@oracle.com>
parents: 11758
diff changeset
1040 mx.pylint([])
11526
db297343d44e added pylint to gate
Doug Simon <doug.simon@oracle.com>
parents: 11525
diff changeset
1041 tasks.append(t.stop())
db297343d44e added pylint to gate
Doug Simon <doug.simon@oracle.com>
parents: 11525
diff changeset
1042
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
1043 t = Task('Clean')
5232
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
1044 cleanArgs = []
5750
30876d0bb92d In gate command, allways build natives, use '-n' to avoid cleaning them only
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5729
diff changeset
1045 if not args.cleanNative:
5232
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
1046 cleanArgs.append('--no-native')
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
1047 if not args.cleanJava:
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
1048 cleanArgs.append('--no-java')
c005ca943790 added -j option to gate command to disable cleaning of Java class files
Doug Simon <doug.simon@oracle.com>
parents: 5197
diff changeset
1049 clean(cleanArgs)
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
1050 tasks.append(t.stop())
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1051
9824
6fa4b4933892 added check to gate that generated IDE configurations don't break the build
Doug Simon <doug.simon@oracle.com>
parents: 9803
diff changeset
1052 t = Task('IDEConfigCheck')
6fa4b4933892 added check to gate that generated IDE configurations don't break the build
Doug Simon <doug.simon@oracle.com>
parents: 9803
diff changeset
1053 mx.ideclean([])
6fa4b4933892 added check to gate that generated IDE configurations don't break the build
Doug Simon <doug.simon@oracle.com>
parents: 9803
diff changeset
1054 mx.ideinit([])
6fa4b4933892 added check to gate that generated IDE configurations don't break the build
Doug Simon <doug.simon@oracle.com>
parents: 9803
diff changeset
1055 tasks.append(t.stop())
6fa4b4933892 added check to gate that generated IDE configurations don't break the build
Doug Simon <doug.simon@oracle.com>
parents: 9803
diff changeset
1056
7533
29b0768b7ba6 added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents: 7509
diff changeset
1057 eclipse_exe = os.environ.get('ECLIPSE_EXE')
29b0768b7ba6 added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents: 7509
diff changeset
1058 if eclipse_exe is not None:
29b0768b7ba6 added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents: 7509
diff changeset
1059 t = Task('CodeFormatCheck')
29b0768b7ba6 added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents: 7509
diff changeset
1060 if mx.eclipseformat(['-e', eclipse_exe]) != 0:
29b0768b7ba6 added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents: 7509
diff changeset
1061 t.abort('Formatter modified files - run "mx eclipseformat", check in changes and repush')
29b0768b7ba6 added eclipseformat to the gate
Doug Simon <doug.simon@oracle.com>
parents: 7509
diff changeset
1062 tasks.append(t.stop())
8211
74896b25297a Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8183
diff changeset
1063
74896b25297a Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8183
diff changeset
1064 t = Task('Canonicalization Check')
74896b25297a Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8183
diff changeset
1065 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...'))
74896b25297a Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8183
diff changeset
1066 if mx.canonicalizeprojects([]) != 0:
74896b25297a Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8183
diff changeset
1067 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.')
74896b25297a Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8183
diff changeset
1068 tasks.append(t.stop())
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1069
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
1070 t = Task('BuildJava')
7748
2d57a3bd82ab Make gate fail on warnings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7730
diff changeset
1071 build(['--no-native', '--jdt-warning-as-error'])
4438
0312460af9fc Made gate do a full clean and added timing report for all gate tasks to end of gate log.
Doug Simon <doug.simon@oracle.com>
parents: 4417
diff changeset
1072 tasks.append(t.stop())
9172
bc5c5336008b Add gate test to check build-graal.xml is up to date.
Roland Schatz <roland.schatz@oracle.com>
parents: 9169
diff changeset
1073
8211
74896b25297a Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8183
diff changeset
1074 t = Task('Checkstyle')
74896b25297a Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8183
diff changeset
1075 if mx.checkstyle([]) != 0:
74896b25297a Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8183
diff changeset
1076 t.abort('Checkstyle warnings were found')
74896b25297a Test canonicalization and checkstyle early in gate process
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8183
diff changeset
1077 tasks.append(t.stop())
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1078
5878
191e08da4de4 Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5877
diff changeset
1079 if exists('jacoco.exec'):
191e08da4de4 Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5877
diff changeset
1080 os.unlink('jacoco.exec')
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1081
5878
191e08da4de4 Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5877
diff changeset
1082 if args.jacocout is not None:
191e08da4de4 Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5877
diff changeset
1083 _jacoco = 'append'
191e08da4de4 Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5877
diff changeset
1084 else:
191e08da4de4 Apply jacoco coverage to all gate tests
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5877
diff changeset
1085 _jacoco = 'off'
11757
ec058ce90a3d pylint fixes
Mick Jordan <mick.jordan@oracle.com>
parents: 11756
diff changeset
1086
11756
78e6109ee411 mx refactoring for split-repo suites; should have no effect on existing repos
Mick Jordan <mick.jordan@oracle.com>
parents: 11605
diff changeset
1087 gate_body(args, tasks)
7155
c356cab093bc added execution of the Graal API unittest with non-GraalVM HotSpot builds to the gate
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
1088
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
1089 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
1090 total.abort(1)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1091
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
1092 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
1093 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
1094 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
1095 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
1096
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
1097 total.stop()
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1098
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
1099 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
1100 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
1101 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
1102 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
1103 mx.log(' ' + str(total.duration))
11757
ec058ce90a3d pylint fixes
Mick Jordan <mick.jordan@oracle.com>
parents: 11756
diff changeset
1104
6340
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1105 def deoptalot(args):
11377
0fbc1e418c88 fixed capitalization and tense in documentation of some mx commands
Doug Simon <doug.simon@oracle.com>
parents: 11373
diff changeset
1106 """bootstrap a fastdebug Graal VM with DeoptimizeALot and VerifyOops on
6340
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1107
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1108 If the first argument is a number, the process will be repeated
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1109 this number of times. All other arguments are passed to the VM."""
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1110 count = 1
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1111 if len(args) > 0 and args[0].isdigit():
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1112 count = int(args[0])
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1113 del args[0]
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1114
7509
442668d41bc2 fixed warnings
Doug Simon <doug.simon@oracle.com>
parents: 7345
diff changeset
1115 for _ in range(count):
6340
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1116 if not vm(['-XX:+DeoptimizeALot', '-XX:+VerifyOops'] + args + ['-version'], vmbuild='fastdebug') == 0:
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1117 mx.abort("Failed")
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1118
6340
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1119 def longtests(args):
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1120
6340
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1121 deoptalot(['15', '-Xmx48m'])
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1122
6340
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1123 dacapo(['100', 'eclipse', '-esa'])
4215
a2caa019ba3a Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments.
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4187
diff changeset
1124
4536
8caa4f2df081 Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents: 4483
diff changeset
1125 def gv(args):
8caa4f2df081 Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents: 4483
diff changeset
1126 """run the Graal Visualizer"""
5047
6bc165b0fdcd Added 'intro' command to mx that runs a simple 'hello world' program and visualizes its compilation in the Graal Visualizer.
Doug Simon <doug.simon@oracle.com>
parents: 5034
diff changeset
1127 with open(join(_graal_home, '.graal_visualizer.log'), 'w') as fp:
10568
070b4a3c56f3 disabled "noisy" log statements unless -v option (i.e. verbose) is specified to mx
Doug Simon <doug.simon@oracle.com>
parents: 10527
diff changeset
1128 mx.logv('[Graal Visualizer log is in ' + fp.name + ']')
5089
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
1129 if not exists(join(_graal_home, 'visualizer', 'build.xml')):
10568
070b4a3c56f3 disabled "noisy" log statements unless -v option (i.e. verbose) is specified to mx
Doug Simon <doug.simon@oracle.com>
parents: 10527
diff changeset
1130 mx.logv('[This initial execution may take a while as the NetBeans platform needs to be downloaded]')
5047
6bc165b0fdcd Added 'intro' command to mx that runs a simple 'hello world' program and visualizes its compilation in the Graal Visualizer.
Doug Simon <doug.simon@oracle.com>
parents: 5034
diff changeset
1131 mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-l', fp.name, 'run'])
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1132
5089
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
1133 def igv(args):
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
1134 """run the Ideal Graph Visualizer"""
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
1135 with open(join(_graal_home, '.ideal_graph_visualizer.log'), 'w') as fp:
10568
070b4a3c56f3 disabled "noisy" log statements unless -v option (i.e. verbose) is specified to mx
Doug Simon <doug.simon@oracle.com>
parents: 10527
diff changeset
1136 mx.logv('[Ideal Graph Visualizer log is in ' + fp.name + ']')
5089
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
1137 if not exists(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'nbplatform')):
10568
070b4a3c56f3 disabled "noisy" log statements unless -v option (i.e. verbose) is specified to mx
Doug Simon <doug.simon@oracle.com>
parents: 10527
diff changeset
1138 mx.logv('[This initial execution may take a while as the NetBeans platform needs to be downloaded]')
5089
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
1139 mx.run(['ant', '-f', join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'), '-l', fp.name, 'run'])
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
1140
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
1141 def bench(args):
4324
b0aa4a52b89c Added support for project specs in classpath.
Doug Simon <doug.simon@oracle.com>
parents: 4294
diff changeset
1142 """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
1143
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
1144 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
1145 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
1146 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
1147 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
1148 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
1149 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
1150 del args[index]
d4906ea4255b Handle SIGTERM : killing mx will properly kill subprocesses
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4288
diff changeset
1151 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
1152 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
1153 mx.abort('-resultfile must be followed by a file name')
11296
4e943a311d9c mx presents a command line dialogue to select the default VM if it is not configured (GRAAL-416)
Doug Simon <doug.simon@oracle.com>
parents: 11287
diff changeset
1154 vm = _get_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
1155 if len(args) is 0:
7563
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1156 args = ['all']
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1157
8459
3393f870e6a4 Allow vm arguments in mx bench
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8440
diff changeset
1158 vmArgs = [arg for arg in args if arg.startswith('-')]
7563
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1159
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1160 def benchmarks_in_group(group):
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1161 prefix = group + ':'
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1162 return [a[len(prefix):] for a in args if a.startswith(prefix)]
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
1163
4219
47f7d91d34cf Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4216
diff changeset
1164 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
1165 benchmarks = []
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1166 # 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
1167 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
1168 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
1169 else:
7563
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1170 dacapos = benchmarks_in_group('dacapo')
4335
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
1171 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
1172 if dacapo not in sanitycheck.dacapoSanityWarmup.keys():
7563
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1173 mx.abort('Unknown DaCapo : ' + dacapo)
8891
ca82d06ec93a mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8890
diff changeset
1174 iterations = sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark]
ca82d06ec93a mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8890
diff changeset
1175 if (iterations > 0):
ca82d06ec93a mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8890
diff changeset
1176 benchmarks += [sanitycheck.getDacapo(dacapo, iterations)]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1177
4480
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
1178 if ('scaladacapo' in args or 'all' in args):
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
1179 benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
7d6490436b57 Add Scala DaCapo benchs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4438
diff changeset
1180 else:
7563
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1181 scaladacapos = benchmarks_in_group('scaladacapo')
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1182 for scaladacapo in scaladacapos:
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1183 if scaladacapo not in sanitycheck.dacapoScalaSanityWarmup.keys():
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1184 mx.abort('Unknown Scala DaCapo : ' + scaladacapo)
8891
ca82d06ec93a mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8890
diff changeset
1185 iterations = sanitycheck.dacapoScalaSanityWarmup[scaladacapo][sanitycheck.SanityCheckLevel.Benchmark]
ca82d06ec93a mx: bench command should not run dacapos with -n 0 when using a specification such as scaladacapo:specs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8890
diff changeset
1186 if (iterations > 0):
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1187 benchmarks += [sanitycheck.getScalaDacapo(scaladacapo, ['-n', str(iterations)])]
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1188
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1189 # 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
1190 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
1191 benchmarks += sanitycheck.getBootstraps()
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1192 # 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
1193 if ('specjvm2008' in args or 'all' in args):
11373
6675167d52b6 fixed specjvm2008 regression in bench command
Doug Simon <doug.simon@oracle.com>
parents: 11372
diff changeset
1194 benchmarks += [sanitycheck.getSPECjvm2008(['-ikv', '-wt', '120', '-it', '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
1195 else:
7563
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1196 specjvms = benchmarks_in_group('specjvm2008')
4335
0d661161fa24 Add possibility to run individual DaCapo & SPECjvm2008 benchmarks, small fix in success and score regular expressions for SPECjvm2008
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4330
diff changeset
1197 for specjvm in specjvms:
11373
6675167d52b6 fixed specjvm2008 regression in bench command
Doug Simon <doug.simon@oracle.com>
parents: 11372
diff changeset
1198 benchmarks += [sanitycheck.getSPECjvm2008(['-ikv', '-wt', '120', '-it', '120', specjvm])]
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1199
5877
0e54d9bb922d Add SPECjbb2005 to the benchmarks
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5875
diff changeset
1200 if ('specjbb2005' in args or 'all' in args):
0e54d9bb922d Add SPECjbb2005 to the benchmarks
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5875
diff changeset
1201 benchmarks += [sanitycheck.getSPECjbb2005()]
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1202
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1203 if ('specjbb2013' in args): # or 'all' in args //currently not in default set
7565
9a521597686b Add SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7563
diff changeset
1204 benchmarks += [sanitycheck.getSPECjbb2013()]
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1205
9157
a38d748d4130 Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9130
diff changeset
1206 if ('ctw-full' in args):
a38d748d4130 Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9130
diff changeset
1207 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.Full))
a38d748d4130 Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9130
diff changeset
1208 if ('ctw-noinline' in args):
a38d748d4130 Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9130
diff changeset
1209 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoInline))
a38d748d4130 Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9130
diff changeset
1210 if ('ctw-nocomplex' in args):
a38d748d4130 Add support for the 'optimized' build in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9130
diff changeset
1211 benchmarks.append(sanitycheck.getCTW(vm, sanitycheck.CTWMode.NoComplex))
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1212
4219
47f7d91d34cf Fix javac build issues with classpath
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4216
diff changeset
1213 for test in benchmarks:
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1214 for (groupName, res) in test.bench(vm, extraVmOpts=vmArgs).items():
7563
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1215 group = results.setdefault(groupName, {})
3aab15f42934 moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
1216 group.update(res)
4282
063ea022532c mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents: 4276
diff changeset
1217 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
1218 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
1219 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
1220 f.write(json.dumps(results))
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1221
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
1222 def specjvm2008(args):
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1223 """run one or more SPECjvm2008 benchmarks"""
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1224
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1225 def launcher(bm, harnessArgs, extraVmOpts):
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1226 return sanitycheck.getSPECjvm2008(harnessArgs + [bm]).bench(_get_vm(), extraVmOpts=extraVmOpts)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1227
11372
76c45fb64191 added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents: 11371
diff changeset
1228 availableBenchmarks = set(sanitycheck.specjvm2008Names)
76c45fb64191 added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents: 11371
diff changeset
1229 for name in sanitycheck.specjvm2008Names:
76c45fb64191 added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents: 11371
diff changeset
1230 parts = name.rsplit('.', 1)
76c45fb64191 added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents: 11371
diff changeset
1231 if len(parts) > 1:
76c45fb64191 added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents: 11371
diff changeset
1232 assert len(parts) == 2
76c45fb64191 added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents: 11371
diff changeset
1233 group = parts[0]
76c45fb64191 added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents: 11371
diff changeset
1234 availableBenchmarks.add(group)
76c45fb64191 added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents: 11371
diff changeset
1235
76c45fb64191 added support to the specjvm2008 command for specifying a benchmark group
Doug Simon <doug.simon@oracle.com>
parents: 11371
diff changeset
1236 _run_benchmark(args, sorted(availableBenchmarks), launcher)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1237
8147
9786ac8fff61 Use different vm args for SPECjbb2013
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8135
diff changeset
1238 def specjbb2013(args):
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1239 """runs the composite SPECjbb2013 benchmark"""
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1240
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1241 def launcher(bm, harnessArgs, extraVmOpts):
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1242 assert bm is None
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1243 return sanitycheck.getSPECjbb2013(harnessArgs).bench(_get_vm(), extraVmOpts=extraVmOpts)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1244
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1245 _run_benchmark(args, None, launcher)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1246
8506
c3657d00e343 -Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8406
diff changeset
1247 def specjbb2005(args):
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1248 """runs the composite SPECjbb2005 benchmark"""
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1249
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1250 def launcher(bm, harnessArgs, extraVmOpts):
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1251 assert bm is None
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1252 return sanitycheck.getSPECjbb2005(harnessArgs).bench(_get_vm(), extraVmOpts=extraVmOpts)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1253
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1254 _run_benchmark(args, None, launcher)
8506
c3657d00e343 -Merge with tip
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8406
diff changeset
1255
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
1256 def hsdis(args, copyToDir=None):
6291
633136426f26 consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents: 6278
diff changeset
1257 """download the hsdis library
4482
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
1258
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
1259 This is needed to support HotSpot's assembly dumping features.
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
1260 By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax."""
4482
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
1261 flavor = 'intel'
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
1262 if 'att' in args:
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
1263 flavor = 'att'
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1264 lib = mx.add_lib_suffix('hsdis-' + _arch())
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
1265 path = join(_graal_home, 'lib', lib)
5189
6fbf12b8e572 automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents: 5153
diff changeset
1266 if not exists(path):
6fbf12b8e572 automated download of hsdis lib if PrintAssembly option is used; added support for hsdis on the Mac
Doug Simon <doug.simon@oracle.com>
parents: 5153
diff changeset
1267 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib])
5596
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
1268 if copyToDir is not None and exists(copyToDir):
e4b1bc5e29e0 hsdis library is downloaded into newly created Graal JDK
Doug Simon <doug.simon@oracle.com>
parents: 5517
diff changeset
1269 shutil.copy(path, copyToDir)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1270
5245
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
1271 def hcfdis(args):
6291
633136426f26 consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents: 6278
diff changeset
1272 """disassemble HexCodeFiles embedded in text files
5245
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
1273
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
1274 Run a tool over the input files to convert all embedded HexCodeFiles
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
1275 to a disassembled format."""
6958
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1276
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1277 parser = ArgumentParser(prog='mx hcfdis')
6958
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1278 parser.add_argument('-m', '--map', help='address to symbol map applied to disassembler output')
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1279 parser.add_argument('files', nargs=REMAINDER, metavar='files...')
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1280
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1281 args = parser.parse_args(args)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1282
6278
4f9574b2893e removed dependence on private java.lang.String internals in HexCodeFile
Doug Simon <doug.simon@oracle.com>
parents: 6276
diff changeset
1283 path = join(_graal_home, 'lib', 'hcfdis-1.jar')
5245
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
1284 if not exists(path):
6278
4f9574b2893e removed dependence on private java.lang.String internals in HexCodeFile
Doug Simon <doug.simon@oracle.com>
parents: 6276
diff changeset
1285 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hcfdis-1.jar'])
6958
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1286 mx.run_java(['-jar', path] + args.files)
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1287
6958
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1288 if args.map is not None:
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1289 addressRE = re.compile(r'0[xX]([A-Fa-f0-9]+)')
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1290 with open(args.map) as fp:
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1291 lines = fp.read().splitlines()
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1292 symbols = dict()
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1293 for l in lines:
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1294 addressAndSymbol = l.split(' ', 1)
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1295 if len(addressAndSymbol) == 2:
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1296 address, symbol = addressAndSymbol
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1297 if address.startswith('0x'):
6958
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1298 address = long(address, 16)
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1299 symbols[address] = symbol
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1300 for f in args.files:
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1301 with open(f) as fp:
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1302 lines = fp.read().splitlines()
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1303 updated = False
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1304 for i in range(0, len(lines)):
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1305 l = lines[i]
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1306 for m in addressRE.finditer(l):
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1307 sval = m.group(0)
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1308 val = long(sval, 16)
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1309 sym = symbols.get(val)
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1310 if sym:
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1311 l = l.replace(sval, sym)
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1312 updated = True
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1313 lines[i] = l
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1314 if updated:
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1315 mx.log('updating ' + f)
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1316 with open('new_' + f, "w") as fp:
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1317 for l in lines:
abbe4faaf0c1 added support for dumping an address to symbol map (with -G:+PrintAddressMap) to translate addresses in disassembled output (via new '-m' option to the hcfdis command)
Doug Simon <doug.simon@oracle.com>
parents: 6718
diff changeset
1318 print >> fp, l
5245
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
1319
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
1320 def jacocoreport(args):
6291
633136426f26 consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents: 6278
diff changeset
1321 """create a JaCoCo coverage report
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
1322
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
1323 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
1324 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
1325 jacocoreport = mx.library("JACOCOREPORT", True)
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
1326 out = 'coverage'
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
1327 if len(args) == 1:
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
1328 out = args[0]
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
1329 elif len(args) > 1:
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
1330 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
1331 mx.run_java(['-jar', jacocoreport.get_path(True), '-in', 'jacoco.exec', '-g', join(_graal_home, 'graal'), out])
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1332
11867
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
1333 def sl(args):
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
1334 """run an SL program
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
1335
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
1336 VM args should have a @ prefix."""
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
1337 vmArgs = [a[1:] for a in args if a[0] == '@']
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
1338 slArgs = [a for a in args if a[0] != '@']
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
1339 vm(vmArgs + ['-cp', mx.classpath("com.oracle.truffle.sl"), "com.oracle.truffle.sl.SimpleLanguage"] + slArgs)
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
1340
9803
8e33b4ebfef1 add isGraalEnabled(vm) function in commands.py
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9667
diff changeset
1341 def isGraalEnabled(vm):
8e33b4ebfef1 add isGraalEnabled(vm) function in commands.py
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9667
diff changeset
1342 return vm != 'original' and not vm.endswith('nograal')
8e33b4ebfef1 add isGraalEnabled(vm) function in commands.py
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9667
diff changeset
1343
5700
12a34d1bcaa2 added site command to generate a javadoc-based website
Doug Simon <doug.simon@oracle.com>
parents: 5688
diff changeset
1344 def site(args):
6291
633136426f26 consolidated jtt command into unittest command and removed need for explicit 'testHarness' property in 'projects' file
Doug Simon <doug.simon@oracle.com>
parents: 6278
diff changeset
1345 """create a website containing javadoc and the project dependency graph"""
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1346
5771
613a3ddb9a71 moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5764
diff changeset
1347 return mx.site(['--name', 'Graal',
5782
488864d5069a added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents: 5771
diff changeset
1348 '--jd', '@-tag', '--jd', '@test:X',
488864d5069a added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents: 5771
diff changeset
1349 '--jd', '@-tag', '--jd', '@run:X',
488864d5069a added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents: 5771
diff changeset
1350 '--jd', '@-tag', '--jd', '@bug:X',
488864d5069a added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents: 5771
diff changeset
1351 '--jd', '@-tag', '--jd', '@summary:X',
488864d5069a added support for passing -tag option to javadoc to suppress warnings about unrecognized tags in javadoc comments
Doug Simon <doug.simon@oracle.com>
parents: 5771
diff changeset
1352 '--jd', '@-tag', '--jd', '@vmoption:X',
5771
613a3ddb9a71 moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5764
diff changeset
1353 '--overview', join(_graal_home, 'graal', 'overview.html'),
613a3ddb9a71 moved core site functionality into mx.py
Doug Simon <doug.simon@oracle.com>
parents: 5764
diff changeset
1354 '--title', 'Graal OpenJDK Project Documentation',
6506
305b9166b455 added projects table to the top level javadoc page generated by the site command
Doug Simon <doug.simon@oracle.com>
parents: 6495
diff changeset
1355 '--dot-output-base', 'projects'] + args)
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1356
11605
3676540f71cf Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents: 11534
diff changeset
1357 def mx_init(suite):
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1358 commands = {
11371
74414b248381 mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents: 11368
diff changeset
1359 'build': [build, ''],
9116
e2dae636732a added 'mx buildvars' command to list (some of) the variables that can be passed to 'mx build' with the -D option
Doug Simon <doug.simon@oracle.com>
parents: 9098
diff changeset
1360 'buildvars': [buildvars, ''],
4601
ade18666f2be Added --omit-native-build to gate command so that native cleaning and building can be omitted for changesets that made no changes to the C/C++ code.
Doug Simon <doug.simon@oracle.com>
parents: 4584
diff changeset
1361 '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
1362 'clean': [clean, ''],
4482
7903b6c28f9c Add hsdis command to mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4480
diff changeset
1363 'hsdis': [hsdis, '[att]'],
5245
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
1364 'hcfdis': [hcfdis, ''],
5089
206e68bb66c6 Made the IdealGraphVisualizer runnable from mx with new 'igv' command.
Doug Simon <doug.simon@oracle.com>
parents: 5064
diff changeset
1365 'igv' : [igv, ''],
11605
3676540f71cf Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents: 11534
diff changeset
1366 'jdkhome': [print_jdkhome, ''],
11367
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1367 'dacapo': [dacapo, '[VM options] benchmarks...|"all" [DaCapo options]'],
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1368 'scaladacapo': [scaladacapo, '[VM options] benchmarks...|"all" [Scala DaCapo options]'],
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1369 'specjvm2008': [specjvm2008, '[VM options] benchmarks...|"all" [SPECjvm2008 options]'],
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1370 'specjbb2013': [specjbb2013, '[VM options] [-- [SPECjbb2013 options]]'],
39b86b83ddeb normalized the command line interface for the dacapo, scaladacapo, specjvm2008, specjbb2005 and specjbb2013 commands
Doug Simon <doug.simon@oracle.com>
parents: 11359
diff changeset
1371 'specjbb2005': [specjbb2005, '[VM options] [-- [SPECjbb2005 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
1372 'gate' : [gate, '[-options]'],
4536
8caa4f2df081 Added 'gv' command to mx for launching the GraalVisualizer.
Doug Simon <doug.simon@oracle.com>
parents: 4483
diff changeset
1373 '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
1374 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'],
11359
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
1375 'unittest' : [unittest, '[VM options] [filters...]', _unittestHelpSuffix],
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
1376 'longunittest' : [longunittest, '[VM options] [filters...]', _unittestHelpSuffix],
51b0b1104114 changed unittest command to remove use of '@' character. The format is now: mx unittest [VM options] [test filters...]
Doug Simon <doug.simon@oracle.com>
parents: 11302
diff changeset
1377 'shortunittest' : [shortunittest, '[VM options] [filters...]', _unittestHelpSuffix],
4684
e136f2d0d002 Activate jtt for the gate
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4660
diff changeset
1378 'jacocoreport' : [jacocoreport, '[output directory]'],
5700
12a34d1bcaa2 added site command to generate a javadoc-based website
Doug Simon <doug.simon@oracle.com>
parents: 5688
diff changeset
1379 'site' : [site, '[-options]'],
5257
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
1380 'vm': [vm, '[-options] class [args...]'],
a549662f6c6f added 'vmg' and 'vmfg' commands to mx as convenient aliases for running the debug and fastdebug builds of the selected VM
Doug Simon <doug.simon@oracle.com>
parents: 5245
diff changeset
1381 'vmg': [vmg, '[-options] class [args...]'],
6340
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1382 'vmfg': [vmfg, '[-options] class [args...]'],
74560fdffd51 Add a draft longtests command to mc's commands
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6319
diff changeset
1383 'deoptalot' : [deoptalot, '[n]'],
11867
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
1384 'longtests' : [longtests, ''],
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
1385 'sl' : [sl, '[SL args|@VM options]']
3718
42e655a6a6f3 Added mx configuration.
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1386 }
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1387
5064
8a88c903e381 Updated mx commands.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5047
diff changeset
1388 mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append'])
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1389 mx.add_argument('--vmcwd', dest='vm_cwd', help='current directory will be changed to <path> before the VM is executed', default=None, metavar='<path>')
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1390 mx.add_argument('--installed-jdks', help='the base directory in which the JDKs cloned from $JAVA_HOME exist. ' +
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1391 'The VM selected by --vm and --vmbuild options is under this directory (i.e., ' +
11493
94779c895aad fixed documentation of --installed-jdks mx option
Doug Simon <doug.simon@oracle.com>
parents: 11424
diff changeset
1392 join('<path>', '<jdk-version>', '<vmbuild>', 'jre', 'lib', '<vm>', mx.add_lib_prefix(mx.add_lib_suffix('jvm'))) + ')', default=None, metavar='<path>')
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
1393
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
1394 if (_vmSourcesAvailable):
11371
74414b248381 mx: added --vmbuild global option, removed --product, --fastdebug, --debug options as well as suffix of build command
Doug Simon <doug.simon@oracle.com>
parents: 11368
diff changeset
1395 mx.add_argument('--vm', action='store', dest='vm', choices=_vmChoices.keys(), help='the VM type to build/run')
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1396 mx.add_argument('--vmbuild', action='store', dest='vmbuild', choices=_vmbuildChoices, help='the VM build to build/run (default: ' + _vmbuildChoices[0] + ')')
5194
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
1397 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse')
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1398 mx.add_argument('--vmprefix', action='store', dest='vm_prefix', help='prefix for running the VM (e.g. "/usr/bin/gdb --args")', metavar='<prefix>')
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1399 mx.add_argument('--gdb', action='store_const', const='/usr/bin/gdb --args', dest='vm_prefix', help='alias for --vmprefix "/usr/bin/gdb --args"')
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1400
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
1401 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
1402 'export': [export, '[-options] [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
1403 })
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1404
11605
3676540f71cf Allow mxtool suites to be in separate repositories (CR-1367)
Mick Jordan <mick.jordan@oracle.com>
parents: 11534
diff changeset
1405 mx.update_commands(suite, commands)
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
1406
11514
dc3c8df55905 added support for pylint and fixed errors/warnings it found
Doug Simon <doug.simon@oracle.com>
parents: 11512
diff changeset
1407 def mx_post_parse_cmd_line(opts): #
7916
9bff64f43299 Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7788
diff changeset
1408 # TODO _minVersion check could probably be part of a Suite in mx?
9bff64f43299 Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7788
diff changeset
1409 if (mx.java().version < _minVersion) :
9bff64f43299 Better java version numbers support in mx
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7788
diff changeset
1410 mx.abort('Requires Java version ' + str(_minVersion) + ' or greater, got version ' + str(mx.java().version))
5729
dab877fe7c31 prevented error during mx site from corrupting an existing site
Doug Simon <doug.simon@oracle.com>
parents: 5708
diff changeset
1411
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
1412 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
1413 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
1414 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
1415 _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
1416 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
1417 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
1418 _vmbuild = opts.vmbuild
5194
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
1419 global _make_eclipse_launch
a6eceb5efb0e added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
Doug Simon <doug.simon@oracle.com>
parents: 5189
diff changeset
1420 _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False)
5024
7ccdae96e98a Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5016
diff changeset
1421 global _jacoco
7ccdae96e98a Allow JaCoCon to append to the execution file
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5016
diff changeset
1422 _jacoco = opts.jacoco
11401
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1423 global _vm_cwd
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1424 _vm_cwd = opts.vm_cwd
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1425 global _installed_jdks
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1426 _installed_jdks = opts.installed_jdks
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1427 global _vm_prefix
2d228d304247 minor improvements/cleanups to mx (CR-1313)
Doug Simon <doug.simon@oracle.com>
parents: 11395
diff changeset
1428 _vm_prefix = opts.vm_prefix
8134
6e3ebc6fd5a4 graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents: 8132
diff changeset
1429
6e3ebc6fd5a4 graal.jar is installed in all JDKs every time it is updated (GRAAL-136)
Doug Simon <doug.simon@oracle.com>
parents: 8132
diff changeset
1430 mx.distribution('GRAAL').add_update_listener(_installGraalJarInJdks)