Mercurial > hg > truffle
annotate mx/JUnitWrapper.java @ 11499:fc3a6fb4cf3d
Support for PlatformKind in PhiResolver.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 02 Sep 2013 14:15:41 +0200 |
parents | f38f746f4980 |
children | f2132fab8a6f 12f2b3baa163 |
rev | line source |
---|---|
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
1 /* |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
4 * |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
8 * |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
14 * |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
18 * |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
21 * questions. |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
22 */ |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
23 |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
24 |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
25 /* Execute testcases by reading names from a given file, due to limits of |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
26 * the operating system regarding command line size (windows: 32k, |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
27 * linux [depending on the settings]: ~2097k) |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
28 * see http://msdn.microsoft.com/en-us/library/ms682425%28VS.85%29.aspx |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
29 */ |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
30 |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
31 import org.junit.runner.*; |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
32 import java.io.*; |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
33 import java.util.*; |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
34 |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
35 public class JUnitWrapper { |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
36 |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
37 /** |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
38 * @param args |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
39 * args[0] is the path where to read the names of the testclasses. |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
40 */ |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
41 public static void main(String[] args) { |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
42 if (args.length == 0) { |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
43 System.err.printf("wrong usage. provide a filename\n"); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
44 System.exit(1); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
45 } |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
46 ArrayList<String> tests = new ArrayList<String>(1000); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
47 BufferedReader br = null; |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
48 try { |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
49 br = new BufferedReader(new FileReader(args[0])); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
50 |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
51 String buf; |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
52 while ((buf = br.readLine()) != null) { |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
53 tests.add(buf); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
54 } |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
55 } catch (IOException ioe) { |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
56 ioe.printStackTrace(); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
57 System.exit(2); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
58 } finally { |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
59 try { |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
60 if (br != null) { |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
61 br.close(); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
62 } |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
63 } catch (IOException ioe) { |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
64 ioe.printStackTrace(); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
65 System.exit(3); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
66 } |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
67 } |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
68 |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
69 String[] strargs = tests.toArray(new String[tests.size()]); |
9637
f38f746f4980
JUnitWrapper: print class name if only one testclass is executed
Bernhard Urban <bernhard.urban@jku.at>
parents:
8435
diff
changeset
|
70 if (strargs.length == 1) { |
f38f746f4980
JUnitWrapper: print class name if only one testclass is executed
Bernhard Urban <bernhard.urban@jku.at>
parents:
8435
diff
changeset
|
71 System.out.printf("executing junit test now... (%s)\n", strargs[0]); |
f38f746f4980
JUnitWrapper: print class name if only one testclass is executed
Bernhard Urban <bernhard.urban@jku.at>
parents:
8435
diff
changeset
|
72 } else { |
f38f746f4980
JUnitWrapper: print class name if only one testclass is executed
Bernhard Urban <bernhard.urban@jku.at>
parents:
8435
diff
changeset
|
73 System.out.printf("executing junit tests now... (%d test classes)\n", strargs.length); |
f38f746f4980
JUnitWrapper: print class name if only one testclass is executed
Bernhard Urban <bernhard.urban@jku.at>
parents:
8435
diff
changeset
|
74 } |
8406
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
75 JUnitCore.main(strargs); |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
76 } |
2bfb9644dcc2
unittest: call wrapper to avoid long command lines
Bernhard Urban <bernhard.urban@jku.at>
parents:
diff
changeset
|
77 } |