annotate mx.truffle/mx_truffle.py @ 22034:a4c9f8c89c68

Add unit tests to truffle gate.
author Roland Schatz <roland.schatz@oracle.com>
date Mon, 27 Jul 2015 16:34:38 +0200
parents 92168cb0e803
children 88eaf4852595
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 #
18891
9afee75cee46 mx: add microbench command to run JMH benchmarks
Roland Schatz <roland.schatz@oracle.com>
parents: 18888
diff changeset
6 # Copyright (c) 2007, 2015, 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
4144
34527a24bcf8 Adopted mxtool changes.
Doug Simon <doug.simon@oracle.com>
parents: 3736
diff changeset
29 import mx
4177
c843578c269d Make building work on Windows.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4163
diff changeset
30
22034
a4c9f8c89c68 Add unit tests to truffle gate.
Roland Schatz <roland.schatz@oracle.com>
parents: 22016
diff changeset
31 from mx_unittest import unittest
a4c9f8c89c68 Add unit tests to truffle gate.
Roland Schatz <roland.schatz@oracle.com>
parents: 22016
diff changeset
32 from mx_gate import Task
a4c9f8c89c68 Add unit tests to truffle gate.
Roland Schatz <roland.schatz@oracle.com>
parents: 22016
diff changeset
33 import mx_gate
a4c9f8c89c68 Add unit tests to truffle gate.
Roland Schatz <roland.schatz@oracle.com>
parents: 22016
diff changeset
34
22016
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
35 _suite = mx.suite('truffle')
16622
faaea970b951 Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents: 16621
diff changeset
36
4577
bc8b58c11768 Added debug build of HotSpot Client to the gate.
Doug Simon <doug.simon@oracle.com>
parents: 4575
diff changeset
37 def build(args, vm=None):
22016
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
38 """build the Java sources"""
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
39 opts2 = mx.build(['--source', '1.7'] + args)
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
40 assert len(opts2.remainder) == 0
4145
9aee7df31417 Removed 'tests' command.
Doug Simon <doug.simon@oracle.com>
parents: 4144
diff changeset
41
16693
b002c864e974 Truffle: rename install to maven-install-truffle and update location of Truffle JARs.
Chris Seaton <chris.seaton@oracle.com>
parents: 16676
diff changeset
42 def maven_install_truffle(args):
16622
faaea970b951 Add an mx install command to install the Truffle jars to the local Maven repository.
Chris Seaton <chris.seaton@oracle.com>
parents: 16621
diff changeset
43 """install Truffle into your local Maven repository"""
21981
da5e694d2b3c Using groupId=com.oracle.[suite.name] when deploying the artifacts. Iterating thru all distributions (except ap ones). Using name of the JAR file as artifactId.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21977
diff changeset
44 for name in mx._dists:
da5e694d2b3c Using groupId=com.oracle.[suite.name] when deploying the artifacts. Iterating thru all distributions (except ap ones). Using name of the JAR file as artifactId.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21977
diff changeset
45 dist = mx._dists[name]
da5e694d2b3c Using groupId=com.oracle.[suite.name] when deploying the artifacts. Iterating thru all distributions (except ap ones). Using name of the JAR file as artifactId.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21977
diff changeset
46 if dist.isProcessorDistribution:
da5e694d2b3c Using groupId=com.oracle.[suite.name] when deploying the artifacts. Iterating thru all distributions (except ap ones). Using name of the JAR file as artifactId.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21977
diff changeset
47 continue
16729
3d148f5e90b8 mx: refactor maven_install_truffle such that it uses specified paths from the project file
Bernhard Urban <bernhard.urban@jku.at>
parents: 16699
diff changeset
48 mx.archive(["@" + name])
21981
da5e694d2b3c Using groupId=com.oracle.[suite.name] when deploying the artifacts. Iterating thru all distributions (except ap ones). Using name of the JAR file as artifactId.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21977
diff changeset
49 path = dist.path
da5e694d2b3c Using groupId=com.oracle.[suite.name] when deploying the artifacts. Iterating thru all distributions (except ap ones). Using name of the JAR file as artifactId.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21977
diff changeset
50 slash = path.rfind('/')
da5e694d2b3c Using groupId=com.oracle.[suite.name] when deploying the artifacts. Iterating thru all distributions (except ap ones). Using name of the JAR file as artifactId.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21977
diff changeset
51 dot = path.rfind('.')
da5e694d2b3c Using groupId=com.oracle.[suite.name] when deploying the artifacts. Iterating thru all distributions (except ap ones). Using name of the JAR file as artifactId.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21977
diff changeset
52 if dot <= slash:
21984
de52ea7de779 Doug prefers usage of abort
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21981
diff changeset
53 mx.abort('Dot should be after / in ' + path)
21981
da5e694d2b3c Using groupId=com.oracle.[suite.name] when deploying the artifacts. Iterating thru all distributions (except ap ones). Using name of the JAR file as artifactId.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21977
diff changeset
54 artifactId = path[slash + 1: dot]
22016
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
55 mx.run(['mvn', 'install:install-file', '-DgroupId=com.oracle.' + dist.suite.name, '-DartifactId=' + artifactId, '-Dversion=' + mx.suite('truffle').release_version('SNAPSHOT'), '-Dpackaging=jar', '-Dfile=' + path])
5245
71ac4221b1b0 added hcfdis command
Doug Simon <doug.simon@oracle.com>
parents: 5244
diff changeset
56
11867
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
57 def sl(args):
12693
c6b833f7935e mx sl: change vm args syntax
Andreas Woess <andreas.woess@jku.at>
parents: 12647
diff changeset
58 """run an SL program"""
22016
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
59 vmArgs, slArgs = mx.extract_VM_args(args)
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
60 mx.run_java(vmArgs + ['-cp', mx.classpath(["TRUFFLE", "com.oracle.truffle.sl"]), "com.oracle.truffle.sl.SLLanguage"] + slArgs)
11867
952ecf32788a mx sl command.
Chris Seaton <chris.seaton@oracle.com>
parents: 11797
diff changeset
61
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21447
diff changeset
62 def sldebug(args):
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 21447
diff changeset
63 """run a simple command line debugger for the Simple Language"""
22016
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
64 vmArgs, slArgs = mx.extract_VM_args(args, useDoubleDash=True)
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
65 mx.run_java(vmArgs + ['-cp', mx.classpath("com.oracle.truffle.sl.tools"), "com.oracle.truffle.sl.tools.debug.SLREPLServer"] + slArgs)
14769
141d570b397c fixed pylint errors
Doug Simon <doug.simon@oracle.com>
parents: 14767
diff changeset
66
22034
a4c9f8c89c68 Add unit tests to truffle gate.
Roland Schatz <roland.schatz@oracle.com>
parents: 22016
diff changeset
67 def _truffle_gate_runner(args, tasks):
a4c9f8c89c68 Add unit tests to truffle gate.
Roland Schatz <roland.schatz@oracle.com>
parents: 22016
diff changeset
68 with Task('Truffle UnitTests', tasks) as t:
a4c9f8c89c68 Add unit tests to truffle gate.
Roland Schatz <roland.schatz@oracle.com>
parents: 22016
diff changeset
69 if t: unittest(['--suite', 'truffle', '--enable-timing', '--verbose', '--fail-fast'])
a4c9f8c89c68 Add unit tests to truffle gate.
Roland Schatz <roland.schatz@oracle.com>
parents: 22016
diff changeset
70
a4c9f8c89c68 Add unit tests to truffle gate.
Roland Schatz <roland.schatz@oracle.com>
parents: 22016
diff changeset
71 mx_gate.add_gate_runner(_suite, _truffle_gate_runner)
a4c9f8c89c68 Add unit tests to truffle gate.
Roland Schatz <roland.schatz@oracle.com>
parents: 22016
diff changeset
72
22016
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
73 mx.update_commands(_suite, {
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
74 'maven-install-truffle' : [maven_install_truffle, ''],
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
75 'sl' : [sl, '[SL args|@VM options]'],
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
76 'sldebug' : [sldebug, '[SL args|@VM options]'],
92168cb0e803 removed non-Truffle code from mx.truffle/mx_truffle.py
Doug Simon <doug.simon@oracle.com>
parents: 21984
diff changeset
77 })