1 /*
2 * Copyright (c) 2013, 2014, 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 */
78 OutputAnalyzer output = new OutputAnalyzer(pb.start());
79 output.shouldContain("Narrow klass base:");
80 output.shouldHaveExitValue(0);
81 }
82
83 public static void heapBaseMinAddressTest() throws Exception {
84 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
85 "-XX:HeapBaseMinAddress=1m",
86 "-XX:+UnlockDiagnosticVMOptions",
87 "-XX:+PrintCompressedOopsMode",
88 "-version");
89 OutputAnalyzer output = new OutputAnalyzer(pb.start());
90 output.shouldContain("HeapBaseMinAddress must be at least");
91 output.shouldHaveExitValue(0);
92 }
93
94 public static void sharingTest() throws Exception {
95 // Test small heaps
96 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
97 "-XX:+UnlockDiagnosticVMOptions",
98 "-XX:SharedArchiveFile=./sample.jsa",
99 "-Xmx128m",
100 "-XX:SharedBaseAddress=8g",
101 "-XX:+PrintCompressedOopsMode",
102 "-XX:+VerifyBeforeGC",
103 "-Xshare:dump");
104 OutputAnalyzer output = new OutputAnalyzer(pb.start());
105 try {
106 output.shouldContain("Loading classes to share");
107 output.shouldHaveExitValue(0);
108
109 pb = ProcessTools.createJavaProcessBuilder(
110 "-XX:+UnlockDiagnosticVMOptions",
111 "-XX:SharedArchiveFile=./sample.jsa",
112 "-Xmx128m",
113 "-XX:SharedBaseAddress=8g",
114 "-XX:+PrintCompressedOopsMode",
115 "-Xshare:on",
116 "-version");
117 output = new OutputAnalyzer(pb.start());
118 output.shouldContain("sharing");
119 output.shouldHaveExitValue(0);
120
121 } catch (RuntimeException e) {
122 output.shouldContain("Unable to use shared archive");
123 output.shouldHaveExitValue(1);
124 }
125 }
126
127 public static void main(String[] args) throws Exception {
128 if (!Platform.is64bit()) {
129 // Can't test this on 32 bit, just pass
130 System.out.println("Skipping test on 32bit");
131 return;
|
1 /*
2 * Copyright (c) 2013, 2015, 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 */
78 OutputAnalyzer output = new OutputAnalyzer(pb.start());
79 output.shouldContain("Narrow klass base:");
80 output.shouldHaveExitValue(0);
81 }
82
83 public static void heapBaseMinAddressTest() throws Exception {
84 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
85 "-XX:HeapBaseMinAddress=1m",
86 "-XX:+UnlockDiagnosticVMOptions",
87 "-XX:+PrintCompressedOopsMode",
88 "-version");
89 OutputAnalyzer output = new OutputAnalyzer(pb.start());
90 output.shouldContain("HeapBaseMinAddress must be at least");
91 output.shouldHaveExitValue(0);
92 }
93
94 public static void sharingTest() throws Exception {
95 // Test small heaps
96 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
97 "-XX:+UnlockDiagnosticVMOptions",
98 "-XX:SharedArchiveFile=./CompressedClassPointers.jsa",
99 "-Xmx128m",
100 "-XX:SharedBaseAddress=8g",
101 "-XX:+PrintCompressedOopsMode",
102 "-XX:+VerifyBeforeGC",
103 "-Xshare:dump");
104 OutputAnalyzer output = new OutputAnalyzer(pb.start());
105 try {
106 output.shouldContain("Loading classes to share");
107 output.shouldHaveExitValue(0);
108
109 pb = ProcessTools.createJavaProcessBuilder(
110 "-XX:+UnlockDiagnosticVMOptions",
111 "-XX:SharedArchiveFile=./CompressedClassPointers.jsa",
112 "-Xmx128m",
113 "-XX:SharedBaseAddress=8g",
114 "-XX:+PrintCompressedOopsMode",
115 "-Xshare:on",
116 "-version");
117 output = new OutputAnalyzer(pb.start());
118 output.shouldContain("sharing");
119 output.shouldHaveExitValue(0);
120
121 } catch (RuntimeException e) {
122 output.shouldContain("Unable to use shared archive");
123 output.shouldHaveExitValue(1);
124 }
125 }
126
127 public static void main(String[] args) throws Exception {
128 if (!Platform.is64bit()) {
129 // Can't test this on 32 bit, just pass
130 System.out.println("Skipping test on 32bit");
131 return;
|