Mercurial > hg > graal-compiler
annotate mxtool/mx_unittest.py @ 22069:b3a22c989adb
Functional test of Unsafe access marking for MappedByteBuffer operations
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 23 Jun 2015 12:03:39 +0200 |
parents | 36a7ec14279d |
children |
rev | line source |
---|---|
22020
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python2.7 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 # |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 # ---------------------------------------------------------------------------------------------------- |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 # |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 # Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 # |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 # This code is free software; you can redistribute it and/or modify it |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 # under the terms of the GNU General Public License version 2 only, as |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 # published by the Free Software Foundation. |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 # |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 # This code is distributed in the hope that it will be useful, but WITHOUT |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 # version 2 for more details (a copy is included in the LICENSE file that |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 # accompanied this code). |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 # |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 # You should have received a copy of the GNU General Public License version |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 # 2 along with this work; if not, write to the Free Software Foundation, |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 # |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 # or visit www.oracle.com if you need additional information or have any |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 # questions. |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 # |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 # ---------------------------------------------------------------------------------------------------- |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 # |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 import mx |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 import os |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 import re |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 import tempfile |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 import fnmatch |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 from argparse import ArgumentParser, RawDescriptionHelpFormatter |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 def _find_classes_with_annotations(p, pkgRoot, annotations, includeInnerClasses=False): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 """ |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 Scan the sources of project 'p' for Java source files containing a line starting with 'annotation' |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 (ignoring preceding whitespace) and return the fully qualified class name for each Java |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 source file matched in a list. |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 """ |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 matches = lambda line: len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 def _run_tests(args, harness, vmLauncher, annotations, testfile, blacklist, whitelist, regex): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 vmArgs, tests = mx.extract_VM_args(args) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 for t in tests: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 if t.startswith('-'): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 mx.abort('VM option ' + t + ' must precede ' + tests[0]) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 candidates = {} |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 for p in mx.projects_opt_limit_to_suites(): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 if mx.java().javaCompliance < p.javaCompliance: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 continue |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 for c in _find_classes_with_annotations(p, None, annotations).keys(): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 candidates[c] = p |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 classes = [] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 if len(tests) == 0: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 classes = candidates.keys() |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 projectsCp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites() if pcp.javaCompliance <= mx.java().javaCompliance]) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 else: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 projs = set() |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 found = False |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 if len(tests) == 1 and '#' in tests[0]: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 words = tests[0].split('#') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 if len(words) != 2: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 mx.abort("Method specification is class#method: " + tests[0]) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 t, method = words |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 for c, p in candidates.iteritems(): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 # prefer exact matches first |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 if t == c: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 found = True |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 classes.append(c) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 projs.add(p.name) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 if not found: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 for c, p in candidates.iteritems(): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 if t in c: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 found = True |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 classes.append(c) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
85 projs.add(p.name) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 if not found: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 mx.log('warning: no tests matched by substring "' + t) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 elif len(classes) != 1: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 mx.abort('More than one test matches substring {0} {1}'.format(t, classes)) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 classes = [c + "#" + method for c in classes] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
92 else: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
93 for t in tests: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
94 if '#' in t: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
95 mx.abort('Method specifications can only be used in a single test: ' + t) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
96 for c, p in candidates.iteritems(): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
97 if t in c: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
98 found = True |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
99 classes.append(c) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
100 projs.add(p.name) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
101 if not found: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
102 mx.log('warning: no tests matched by substring "' + t) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
103 projectsCp = mx.classpath(projs) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
104 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
105 if blacklist: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
106 classes = [c for c in classes if not any((glob.match(c) for glob in blacklist))] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
107 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
108 if whitelist: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
109 classes = [c for c in classes if any((glob.match(c) for glob in whitelist))] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
110 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
111 if regex: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
112 classes = [c for c in classes if re.search(regex, c)] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
113 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
114 if len(classes) != 0: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
115 f_testfile = open(testfile, 'w') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
116 for c in classes: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
117 f_testfile.write(c + '\n') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
118 f_testfile.close() |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
119 harness(projectsCp, vmLauncher, vmArgs) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
120 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
121 def _unittest(args, annotations, vmLauncher=None, prefixCp="", blacklist=None, whitelist=None, verbose=False, fail_fast=False, enable_timing=False, regex=None, color=False, eager_stacktrace=False, gc_after_test=False): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
122 testfile = os.environ.get('MX_TESTFILE', None) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
123 if testfile is None: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
124 (_, testfile) = tempfile.mkstemp(".testclasses", "mxtool") |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
125 os.close(_) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
126 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
127 coreCp = mx.classpath(['com.oracle.mxtool.junit', 'HCFDIS']) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
128 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
129 coreArgs = [] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
130 if verbose: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
131 coreArgs.append('-JUnitVerbose') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
132 if fail_fast: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
133 coreArgs.append('-JUnitFailFast') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
134 if enable_timing: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
135 coreArgs.append('-JUnitEnableTiming') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
136 if color: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
137 coreArgs.append('-JUnitColor') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
138 if eager_stacktrace: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
139 coreArgs.append('-JUnitEagerStackTrace') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
140 if gc_after_test: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
141 coreArgs.append('-JUnitGCAfterTest') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
142 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
143 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
144 def harness(projectsCp, vmLauncher, vmArgs): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
145 prefixArgs = ['-esa', '-ea'] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
146 if gc_after_test: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
147 prefixArgs.append('-XX:-DisableExplicitGC') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
148 with open(testfile) as fp: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
149 testclasses = [l.rstrip() for l in fp.readlines()] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
150 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
151 # Run the VM in a mode where application/test classes can |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
152 # access classes normally hidden behind the JVMCI class loader |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
153 cp = prefixCp + coreCp + os.pathsep + projectsCp |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
154 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
155 # suppress menubar and dock when running on Mac |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
156 vmArgs = prefixArgs + ['-Djava.awt.headless=true'] + vmArgs + ['-cp', mx._separatedCygpathU2W(cp)] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
157 mainClass = 'com.oracle.mxtool.junit.MxJUnitWrapper' |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
158 # Execute Junit directly when one test is being run. This simplifies |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
159 # replaying the VM execution in a native debugger (e.g., gdb). |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
160 mainClassArgs = coreArgs + (testclasses if len(testclasses) == 1 else ['@' + mx._cygpathU2W(testfile)]) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
161 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
162 vmLauncher(vmArgs, mainClass, mainClassArgs) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
163 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
164 if vmLauncher is None: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
165 vmLauncher = lambda vmArgs, mainClass, mainClassArgs: mx.run_java(vmArgs + [mainClass] + mainClassArgs) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
166 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
167 try: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
168 _run_tests(args, harness, vmLauncher, annotations, testfile, blacklist, whitelist, regex) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
169 finally: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
170 if os.environ.get('MX_TESTFILE') is None: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
171 os.remove(testfile) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
172 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
173 unittestHelpSuffix = """ |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
174 Unittest options: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
175 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
176 --blacklist <file> run all testcases not specified in the blacklist |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
177 --whitelist <file> run only testcases which are included |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
178 in the given whitelist |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
179 --verbose enable verbose JUnit output |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
180 --fail-fast stop after first JUnit test class that has a failure |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
181 --enable-timing enable JUnit test timing |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
182 --regex <regex> run only testcases matching a regular expression |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
183 --color enable colors output |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
184 --eager-stacktrace print stacktrace eagerly |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
185 --gc-after-test force a GC after each test |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
186 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
187 To avoid conflicts with VM options '--' can be used as delimiter. |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
188 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
189 If filters are supplied, only tests whose fully qualified name |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
190 includes a filter as a substring are run. |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
191 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
192 For example, this command line: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
193 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
194 mx unittest -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG BC_aload |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
195 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
196 will run all JUnit test classes that contain 'BC_aload' in their |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
197 fully qualified name and will pass these options to the VM: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
198 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
199 -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
200 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
201 To get around command line length limitations on some OSes, the |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
202 JUnit class names to be executed are written to a file that a |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
203 custom JUnit wrapper reads and passes onto JUnit proper. The |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
204 MX_TESTFILE environment variable can be set to specify a |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
205 file which will not be deleted once the unittests are done |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
206 (unlike the temporary file otherwise used). |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
207 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
208 As with all other commands, using the global '-v' before 'unittest' |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
209 command will cause mx to show the complete command line |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
210 it uses to run the VM. |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
211 """ |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
212 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
213 def unittest(args, vmLauncher=None): |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
214 """run the JUnit tests (all testcases)""" |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
215 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
216 parser = ArgumentParser(prog='mx unittest', |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
217 description='run the JUnit tests', |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
218 add_help=False, |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
219 formatter_class=RawDescriptionHelpFormatter, |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
220 epilog=unittestHelpSuffix, |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
221 ) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
222 parser.add_argument('--blacklist', help='run all testcases not specified in <file>', metavar='<file>') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
223 parser.add_argument('--whitelist', help='run testcases specified in <file> only', metavar='<file>') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
224 parser.add_argument('--verbose', help='enable verbose JUnit output', action='store_true') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
225 parser.add_argument('--fail-fast', help='stop after first JUnit test class that has a failure', action='store_true') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
226 parser.add_argument('--enable-timing', help='enable JUnit test timing', action='store_true') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
227 parser.add_argument('--regex', help='run only testcases matching a regular expression', metavar='<regex>') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
228 parser.add_argument('--color', help='enable color output', action='store_true') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
229 parser.add_argument('--eager-stacktrace', help='print stacktrace eagerly', action='store_true') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
230 parser.add_argument('--gc-after-test', help='force a GC after each test', action='store_true') |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
231 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
232 ut_args = [] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
233 delimiter = False |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
234 # check for delimiter |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
235 while len(args) > 0: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
236 arg = args.pop(0) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
237 if arg == '--': |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
238 delimiter = True |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
239 break |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
240 ut_args.append(arg) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
241 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
242 if delimiter: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
243 # all arguments before '--' must be recognized |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
244 parsed_args = parser.parse_args(ut_args) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
245 else: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
246 # parse all know arguments |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
247 parsed_args, args = parser.parse_known_args(ut_args) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
248 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
249 if parsed_args.whitelist: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
250 try: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
251 with open(parsed_args.whitelist) as fp: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
252 parsed_args.whitelist = [re.compile(fnmatch.translate(l.rstrip())) for l in fp.readlines() if not l.startswith('#')] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
253 except IOError: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
254 mx.log('warning: could not read whitelist: ' + parsed_args.whitelist) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
255 if parsed_args.blacklist: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
256 try: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
257 with open(parsed_args.blacklist) as fp: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
258 parsed_args.blacklist = [re.compile(fnmatch.translate(l.rstrip())) for l in fp.readlines() if not l.startswith('#')] |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
259 except IOError: |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
260 mx.log('warning: could not read blacklist: ' + parsed_args.blacklist) |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
261 |
36a7ec14279d
moved unit test support from mx_graal.py to mx.py
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
262 _unittest(args, ['@Test', '@Parameters'], vmLauncher=vmLauncher, **parsed_args.__dict__) |