1 /*
2 * Copyright (c) 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 */
106 new SharedSizeTestData(Region.RW, "4M", "read write"),
107 new SharedSizeTestData(Region.MD, "50k", "miscellaneous data"),
108 new SharedSizeTestData(Region.MC, "20k", "miscellaneous code"),
109
110 // these values are larger than default ones, but should
111 // be acceptable and not cause failure
112 new SharedSizeTestData(Region.RO, "20M", null),
113 new SharedSizeTestData(Region.RW, "20M", null),
114 new SharedSizeTestData(Region.MD, "20M", null),
115 new SharedSizeTestData(Region.MC, "20M", null),
116
117 // test with sizes which just meet the minimum required sizes
118 // the following tests also attempt to use the shared archive
119 new SharedSizeTestData(Region.RO, "UseArchive"),
120 new SharedSizeTestData(Region.RW, "UseArchive"),
121 new SharedSizeTestData(Region.MD, "UseArchive"),
122 new SharedSizeTestData(Region.MC, "UseArchive")
123 };
124
125 public static void main(String[] args) throws Exception {
126 String fileName = "test.jsa";
127
128 for (SharedSizeTestData td : testTable) {
129 String option = td.optionName + "=" + td.optionValue;
130 System.out.println("testing option <" + option + ">");
131
132 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
133 "-XX:+UnlockDiagnosticVMOptions",
134 "-XX:SharedArchiveFile=./" + fileName,
135 option,
136 "-Xshare:dump");
137
138 OutputAnalyzer output = new OutputAnalyzer(pb.start());
139
140 if (td.expectedErrorMsg != null) {
141 if (!td.expectedErrorMsg.equals("UseArchive")) {
142 output.shouldContain("The shared " + td.expectedErrorMsg
143 + " space is not large enough");
144
145 output.shouldHaveExitValue(2);
146 } else {
147 output.shouldNotContain("space is not large enough");
148 output.shouldHaveExitValue(0);
|
1 /*
2 * Copyright (c) 2014, 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 */
106 new SharedSizeTestData(Region.RW, "4M", "read write"),
107 new SharedSizeTestData(Region.MD, "50k", "miscellaneous data"),
108 new SharedSizeTestData(Region.MC, "20k", "miscellaneous code"),
109
110 // these values are larger than default ones, but should
111 // be acceptable and not cause failure
112 new SharedSizeTestData(Region.RO, "20M", null),
113 new SharedSizeTestData(Region.RW, "20M", null),
114 new SharedSizeTestData(Region.MD, "20M", null),
115 new SharedSizeTestData(Region.MC, "20M", null),
116
117 // test with sizes which just meet the minimum required sizes
118 // the following tests also attempt to use the shared archive
119 new SharedSizeTestData(Region.RO, "UseArchive"),
120 new SharedSizeTestData(Region.RW, "UseArchive"),
121 new SharedSizeTestData(Region.MD, "UseArchive"),
122 new SharedSizeTestData(Region.MC, "UseArchive")
123 };
124
125 public static void main(String[] args) throws Exception {
126 int counter = 0;
127 for (SharedSizeTestData td : testTable) {
128 String fileName = "LimitSharedSizes" + counter + ".jsa";
129 counter++;
130
131 String option = td.optionName + "=" + td.optionValue;
132 System.out.println("testing option <" + option + ">");
133
134 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
135 "-XX:+UnlockDiagnosticVMOptions",
136 "-XX:SharedArchiveFile=./" + fileName,
137 option,
138 "-Xshare:dump");
139
140 OutputAnalyzer output = new OutputAnalyzer(pb.start());
141
142 if (td.expectedErrorMsg != null) {
143 if (!td.expectedErrorMsg.equals("UseArchive")) {
144 output.shouldContain("The shared " + td.expectedErrorMsg
145 + " space is not large enough");
146
147 output.shouldHaveExitValue(2);
148 } else {
149 output.shouldNotContain("space is not large enough");
150 output.shouldHaveExitValue(0);
|