author | sjohanss |
Mon, 20 Jan 2014 10:55:54 +0100 | |
changeset 22553 | 12b903843ee2 |
child 29678 | dd2f3932c21e |
permissions | -rw-r--r-- |
22553
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
1 |
/* |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
4 |
* |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
8 |
* |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
13 |
* accompanied this code). |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
14 |
* |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
18 |
* |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
21 |
* questions. |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
22 |
*/ |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
23 |
|
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
24 |
/* |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
25 |
* @test Test2GbHeap |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
26 |
* @bug 8031686 |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
27 |
* @summary Regression test to ensure we can start G1 with 2gb heap. |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
28 |
* @key gc |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
29 |
* @key regression |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
30 |
* @library /testlibrary |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
31 |
*/ |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
32 |
|
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
33 |
import java.util.ArrayList; |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
34 |
|
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
35 |
import com.oracle.java.testlibrary.OutputAnalyzer; |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
36 |
import com.oracle.java.testlibrary.ProcessTools; |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
37 |
|
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
38 |
public class Test2GbHeap { |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
39 |
public static void main(String[] args) throws Exception { |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
40 |
ArrayList<String> testArguments = new ArrayList<String>(); |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
41 |
|
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
42 |
testArguments.add("-XX:+UseG1GC"); |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
43 |
testArguments.add("-Xmx2g"); |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
44 |
testArguments.add("-version"); |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
45 |
|
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
46 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(testArguments.toArray(new String[0])); |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
47 |
|
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
48 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
49 |
|
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
50 |
// Avoid failing test for setups not supported. |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
51 |
if (output.getOutput().contains("Could not reserve enough space for 2097152KB object heap")) { |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
52 |
// Will fail on machines with too little memory (and Windows 32-bit VM), ignore such failures. |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
53 |
output.shouldHaveExitValue(1); |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
54 |
} else if (output.getOutput().contains("G1 GC is disabled in this release")) { |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
55 |
// G1 is not supported on embedded, ignore such failures. |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
56 |
output.shouldHaveExitValue(1); |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
57 |
} else { |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
58 |
// Normally everything should be fine. |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
59 |
output.shouldHaveExitValue(0); |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
60 |
} |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
61 |
} |
12b903843ee2
8031686: G1: assert(_hrs.max_length() == _expansion_regions) failed
sjohanss
parents:
diff
changeset
|
62 |
} |