1 /*
2 * Copyright (c) 2013, 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 */
89 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
90 "-XX:HeapBaseMinAddress=1m",
91 "-Xlog:gc+heap+coops=debug",
92 "-version");
93 OutputAnalyzer output = new OutputAnalyzer(pb.start());
94 output.shouldContain("HeapBaseMinAddress must be at least");
95 output.shouldHaveExitValue(0);
96 }
97
98 public static void sharingTest() throws Exception {
99 // Test small heaps
100 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
101 "-XX:+UnlockDiagnosticVMOptions",
102 "-XX:SharedArchiveFile=./CompressedClassPointers.jsa",
103 "-Xmx128m",
104 "-XX:SharedBaseAddress=8g",
105 "-XX:+PrintCompressedOopsMode",
106 "-XX:+VerifyBeforeGC",
107 "-Xshare:dump");
108 OutputAnalyzer output = new OutputAnalyzer(pb.start());
109 try {
110 output.shouldContain("Loading classes to share");
111 output.shouldHaveExitValue(0);
112
113 pb = ProcessTools.createJavaProcessBuilder(
114 "-XX:+UnlockDiagnosticVMOptions",
115 "-XX:SharedArchiveFile=./CompressedClassPointers.jsa",
116 "-Xmx128m",
117 "-XX:SharedBaseAddress=8g",
118 "-XX:+PrintCompressedOopsMode",
119 "-Xshare:on",
120 "-version");
121 output = new OutputAnalyzer(pb.start());
122 output.shouldContain("sharing");
123 output.shouldHaveExitValue(0);
124
125 } catch (RuntimeException e) {
126 output.shouldContain("Unable to use shared archive");
127 output.shouldHaveExitValue(1);
128 }
|
1 /*
2 * Copyright (c) 2013, 2017, 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 */
89 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
90 "-XX:HeapBaseMinAddress=1m",
91 "-Xlog:gc+heap+coops=debug",
92 "-version");
93 OutputAnalyzer output = new OutputAnalyzer(pb.start());
94 output.shouldContain("HeapBaseMinAddress must be at least");
95 output.shouldHaveExitValue(0);
96 }
97
98 public static void sharingTest() throws Exception {
99 // Test small heaps
100 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
101 "-XX:+UnlockDiagnosticVMOptions",
102 "-XX:SharedArchiveFile=./CompressedClassPointers.jsa",
103 "-Xmx128m",
104 "-XX:SharedBaseAddress=8g",
105 "-XX:+PrintCompressedOopsMode",
106 "-XX:+VerifyBeforeGC",
107 "-Xshare:dump");
108 OutputAnalyzer output = new OutputAnalyzer(pb.start());
109 if (output.firstMatch("Shared spaces are not supported in this VM") != null) {
110 return;
111 }
112 try {
113 output.shouldContain("Loading classes to share");
114 output.shouldHaveExitValue(0);
115
116 pb = ProcessTools.createJavaProcessBuilder(
117 "-XX:+UnlockDiagnosticVMOptions",
118 "-XX:SharedArchiveFile=./CompressedClassPointers.jsa",
119 "-Xmx128m",
120 "-XX:SharedBaseAddress=8g",
121 "-XX:+PrintCompressedOopsMode",
122 "-Xshare:on",
123 "-version");
124 output = new OutputAnalyzer(pb.start());
125 output.shouldContain("sharing");
126 output.shouldHaveExitValue(0);
127
128 } catch (RuntimeException e) {
129 output.shouldContain("Unable to use shared archive");
130 output.shouldHaveExitValue(1);
131 }
|