annotate test/runtime/SharedArchiveFile/LimitSharedSizes.java @ 20555:e48395e6a91b

8059139: It should be possible to explicitly disable usage of TZCNT instr w/ -XX:-UseBMI1Instructions Reviewed-by: iveresov
author kvn
date Fri, 17 Oct 2014 15:35:25 -0700
parents 9c8439756c05
children 03e6d34be1f5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20488
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
1 /*
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
4 *
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
7 * published by the Free Software Foundation.
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
8 *
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
13 * accompanied this code).
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
14 *
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
18 *
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
21 * questions.
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
22 */
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
23
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
24 /* @test LimitSharedSizes
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
25 * @summary Test handling of limits on shared space size
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
26 * @library /testlibrary
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
27 * @run main LimitSharedSizes
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
28 */
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
29
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
30 import com.oracle.java.testlibrary.*;
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
31
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
32 public class LimitSharedSizes {
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
33 private static class SharedSizeTestData {
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
34 public String optionName;
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
35 public String optionValue;
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
36 public String expectedErrorMsg;
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
37
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
38 public SharedSizeTestData(String name, String value, String msg) {
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
39 optionName = name;
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
40 optionValue = value;
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
41 expectedErrorMsg = msg;
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
42 }
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
43 }
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
44
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
45 private static final SharedSizeTestData[] testTable = {
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
46 // values in this part of the test table should cause failure
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
47 // (shared space sizes are deliberately too small)
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
48 new SharedSizeTestData("-XX:SharedReadOnlySize", "4M", "read only"),
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
49 new SharedSizeTestData("-XX:SharedReadWriteSize","4M", "read write"),
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
50
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
51 // Known issue, JDK-8038422 (assert() on Windows)
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
52 // new SharedSizeTestData("-XX:SharedMiscDataSize", "500k", "miscellaneous data"),
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
53
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
54 // This will cause a VM crash; commenting out for now; see bug JDK-8038268
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
55 // @ignore JDK-8038268
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
56 // new SharedSizeTestData("-XX:SharedMiscCodeSize", "20k", "miscellaneous code"),
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
57
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
58 // these values are larger than default ones, but should
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
59 // be acceptable and not cause failure
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
60 new SharedSizeTestData("-XX:SharedReadOnlySize", "20M", null),
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
61 new SharedSizeTestData("-XX:SharedReadWriteSize", "20M", null),
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
62 new SharedSizeTestData("-XX:SharedMiscDataSize", "20M", null),
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
63 new SharedSizeTestData("-XX:SharedMiscCodeSize", "20M", null)
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
64 };
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
65
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
66 public static void main(String[] args) throws Exception {
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
67 String fileName = "test.jsa";
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
68
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
69 for (SharedSizeTestData td : testTable) {
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
70 String option = td.optionName + "=" + td.optionValue;
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
71 System.out.println("testing option <" + option + ">");
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
72
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
73 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
74 "-XX:+UnlockDiagnosticVMOptions",
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
75 "-XX:SharedArchiveFile=./" + fileName,
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
76 option,
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
77 "-Xshare:dump");
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
78
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
79 OutputAnalyzer output = new OutputAnalyzer(pb.start());
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
80
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
81 if (td.expectedErrorMsg != null) {
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
82 output.shouldContain("The shared " + td.expectedErrorMsg
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
83 + " space is not large enough");
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
84
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
85 output.shouldHaveExitValue(2);
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
86 } else {
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
87 output.shouldNotContain("space is not large enough");
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
88 output.shouldHaveExitValue(0);
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
89 }
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
90 }
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
91 }
9c8439756c05 8052313: Backport CDS tests from JDK-9 to jdk8_u40
mseledtsov
parents:
diff changeset
92 }