author | rkennke |
Mon, 10 Dec 2018 15:47:44 +0100 | |
changeset 52925 | 9c18c9d839d3 |
parent 50624 | 724ed31f9d05 |
child 53523 | 4c5184c56dc2 |
permissions | -rw-r--r-- |
50624
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
1 |
/* |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
4 |
* |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
8 |
* |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
13 |
* accompanied this code). |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
14 |
* |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
18 |
* |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
21 |
* questions. |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
22 |
*/ |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
23 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
24 |
/* |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
25 |
* @test TestParallelRefProc |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
26 |
* @key gc |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
27 |
* @summary Test defaults processing for -XX:+ParallelRefProcEnabled. |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
28 |
* @library /test/lib |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
29 |
* @run driver TestParallelRefProc |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
30 |
*/ |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
31 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
32 |
import java.util.Arrays; |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
33 |
import java.util.ArrayList; |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
34 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
35 |
import jdk.test.lib.process.OutputAnalyzer; |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
36 |
import jdk.test.lib.process.ProcessTools; |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
37 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
38 |
public class TestParallelRefProc { |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
39 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
40 |
public static void main(String args[]) throws Exception { |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
41 |
testFlag(new String[] { "-XX:+UseSerialGC" }, false); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
42 |
testFlag(new String[] { "-XX:+UseConcMarkSweepGC" }, false); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
43 |
testFlag(new String[] { "-XX:+UseParallelGC" }, false); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
44 |
testFlag(new String[] { "-XX:+UseG1GC", "-XX:ParallelGCThreads=1" }, false); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
45 |
testFlag(new String[] { "-XX:+UseG1GC", "-XX:ParallelGCThreads=2" }, true); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
46 |
testFlag(new String[] { "-XX:+UseG1GC", "-XX:-ParallelRefProcEnabled", "-XX:ParallelGCThreads=2" }, false); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
47 |
} |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
48 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
49 |
private static final String parallelRefProcEnabledPattern = |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
50 |
" *bool +ParallelRefProcEnabled *= *true +\\{product\\}"; |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
51 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
52 |
private static final String parallelRefProcDisabledPattern = |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
53 |
" *bool +ParallelRefProcEnabled *= *false +\\{product\\}"; |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
54 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
55 |
private static void testFlag(String[] args, boolean expectedTrue) throws Exception { |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
56 |
ArrayList<String> result = new ArrayList<String>(); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
57 |
result.addAll(Arrays.asList(args)); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
58 |
result.add("-XX:+PrintFlagsFinal"); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
59 |
result.add("-version"); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
60 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(result.toArray(new String[0])); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
61 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
62 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
63 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
64 |
output.shouldHaveExitValue(0); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
65 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
66 |
final String expectedPattern = expectedTrue ? parallelRefProcEnabledPattern : parallelRefProcDisabledPattern; |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
67 |
|
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
68 |
String value = output.firstMatch(expectedPattern); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
69 |
if (value == null) { |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
70 |
throw new RuntimeException( |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
71 |
Arrays.toString(args) + " didn't set ParallelRefProcEnabled to " + expectedTrue + " as expected"); |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
72 |
} |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
73 |
} |
724ed31f9d05
8205043: Make parallel reference processing default for G1
tschatzl
parents:
diff
changeset
|
74 |
} |