1 /* |
|
2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 package compiler.tiered; |
|
25 |
|
26 import compiler.whitebox.CompilerWhiteBoxTest; |
|
27 import jdk.test.lib.process.OutputAnalyzer; |
|
28 import jdk.test.lib.process.ProcessTools; |
|
29 |
|
30 import java.lang.management.ManagementFactory; |
|
31 import java.lang.management.RuntimeMXBean; |
|
32 import java.util.ArrayList; |
|
33 import java.util.Collections; |
|
34 import java.util.List; |
|
35 |
|
36 /** |
|
37 * Executes given test in a separate VM with enabled Tiered Compilation for |
|
38 * CompilationPolicyChoice 2 and 3 |
|
39 */ |
|
40 public class TransitionsTestExecutor { |
|
41 public static void main(String[] args) throws Throwable { |
|
42 if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) { |
|
43 return; |
|
44 } |
|
45 if (args.length != 1) { |
|
46 throw new Error("TESTBUG: Test name should be specified"); |
|
47 } |
|
48 executeTestFor(2, args[0]); |
|
49 executeTestFor(3, args[0]); |
|
50 } |
|
51 |
|
52 private static void executeTestFor(int compilationPolicy, String testName) throws Throwable { |
|
53 String policy = "-XX:CompilationPolicyChoice=" + compilationPolicy; |
|
54 |
|
55 // Get runtime arguments including VM options given to this executor |
|
56 RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); |
|
57 List<String> vmArgs = runtime.getInputArguments(); |
|
58 |
|
59 // Construct execution command with compilation policy choice and test name |
|
60 List<String> args = new ArrayList<>(vmArgs); |
|
61 Collections.addAll(args, policy, testName); |
|
62 |
|
63 OutputAnalyzer out = ProcessTools.executeTestJvm(args.toArray(new String[args.size()])); |
|
64 out.shouldHaveExitValue(0); |
|
65 } |
|
66 } |
|