author | ykantser |
Wed, 25 Mar 2015 15:22:45 +0000 | |
changeset 30331 | f07d88b6243c |
parent 28018 | abc067cd68fd |
child 29678 | dd2f3932c21e |
child 30123 | 7a8b6bd85e24 |
permissions | -rw-r--r-- |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
1 |
/* |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
4 |
* |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
8 |
* |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
13 |
* accompanied this code). |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
14 |
* |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
18 |
* |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
21 |
* questions. |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
22 |
*/ |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
23 |
|
25896
5f21a029fdeb
8053956: [TESTBUG] Remove @ignore tag from fixed runtime issues
ctornqvi
parents:
24840
diff
changeset
|
24 |
/* @test LimitSharedSizes |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
25 |
* @summary Test handling of limits on shared space size |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
26 |
* @library /testlibrary |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
27 |
* @run main LimitSharedSizes |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
28 |
*/ |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
29 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
30 |
import com.oracle.java.testlibrary.*; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
31 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
32 |
public class LimitSharedSizes { |
28018
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
33 |
static enum Region { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
34 |
RO, RW, MD, MC |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
35 |
} |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
36 |
|
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
37 |
private static class SharedSizeTestData { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
38 |
public String optionName; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
39 |
public String optionValue; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
40 |
public String expectedErrorMsg; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
41 |
|
28018
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
42 |
public SharedSizeTestData(Region region, String value, String msg) { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
43 |
optionName = getName(region); |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
44 |
optionValue = value; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
45 |
expectedErrorMsg = msg; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
46 |
} |
28018
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
47 |
|
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
48 |
public SharedSizeTestData(Region region, String msg) { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
49 |
optionName = getName(region); |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
50 |
optionValue = getValue(region); |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
51 |
expectedErrorMsg = msg; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
52 |
} |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
53 |
|
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
54 |
private String getName(Region region) { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
55 |
String name; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
56 |
switch (region) { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
57 |
case RO: |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
58 |
name = "-XX:SharedReadOnlySize"; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
59 |
break; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
60 |
case RW: |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
61 |
name = "-XX:SharedReadWriteSize"; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
62 |
break; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
63 |
case MD: |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
64 |
name = "-XX:SharedMiscDataSize"; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
65 |
break; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
66 |
case MC: |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
67 |
name = "-XX:SharedMiscCodeSize"; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
68 |
break; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
69 |
default: |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
70 |
name = "Unknown"; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
71 |
break; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
72 |
} |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
73 |
return name; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
74 |
} |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
75 |
|
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
76 |
private String getValue(Region region) { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
77 |
String value; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
78 |
switch (region) { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
79 |
case RO: |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
80 |
value = Platform.is64bit() ? "9M" : "8M"; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
81 |
break; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
82 |
case RW: |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
83 |
value = Platform.is64bit() ? "12M" : "7M"; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
84 |
break; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
85 |
case MD: |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
86 |
value = Platform.is64bit() ? "4M" : "2M"; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
87 |
break; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
88 |
case MC: |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
89 |
value = "120k"; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
90 |
break; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
91 |
default: |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
92 |
value = "0M"; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
93 |
break; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
94 |
} |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
95 |
return value; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
96 |
} |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
97 |
} |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
98 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
99 |
private static final SharedSizeTestData[] testTable = { |
28018
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
100 |
// Too small of a region size should not cause a vm crash. |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
101 |
// It should result in an error message like the following: |
27404
33c0f343cd5c
8038268: VM Crashes in MetaspaceShared::generate_vtable_methods while creating CDS archive with limiting SharedMiscCodeSize
ccheung
parents:
25896
diff
changeset
|
102 |
// The shared miscellaneous code space is not large enough |
33c0f343cd5c
8038268: VM Crashes in MetaspaceShared::generate_vtable_methods while creating CDS archive with limiting SharedMiscCodeSize
ccheung
parents:
25896
diff
changeset
|
103 |
// to preload requested classes. Use -XX:SharedMiscCodeSize= |
33c0f343cd5c
8038268: VM Crashes in MetaspaceShared::generate_vtable_methods while creating CDS archive with limiting SharedMiscCodeSize
ccheung
parents:
25896
diff
changeset
|
104 |
// to increase the initial size of shared miscellaneous code space. |
28018
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
105 |
new SharedSizeTestData(Region.RO, "4M", "read only"), |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
106 |
new SharedSizeTestData(Region.RW, "4M", "read write"), |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
107 |
new SharedSizeTestData(Region.MD, "50k", "miscellaneous data"), |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
108 |
new SharedSizeTestData(Region.MC, "20k", "miscellaneous code"), |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
109 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
110 |
// these values are larger than default ones, but should |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
111 |
// be acceptable and not cause failure |
28018
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
112 |
new SharedSizeTestData(Region.RO, "20M", null), |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
113 |
new SharedSizeTestData(Region.RW, "20M", null), |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
114 |
new SharedSizeTestData(Region.MD, "20M", null), |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
115 |
new SharedSizeTestData(Region.MC, "20M", null), |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
116 |
|
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
117 |
// test with sizes which just meet the minimum required sizes |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
118 |
// the following tests also attempt to use the shared archive |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
119 |
new SharedSizeTestData(Region.RO, "UseArchive"), |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
120 |
new SharedSizeTestData(Region.RW, "UseArchive"), |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
121 |
new SharedSizeTestData(Region.MD, "UseArchive"), |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
122 |
new SharedSizeTestData(Region.MC, "UseArchive") |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
123 |
}; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
124 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
125 |
public static void main(String[] args) throws Exception { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
126 |
String fileName = "test.jsa"; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
127 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
128 |
for (SharedSizeTestData td : testTable) { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
129 |
String option = td.optionName + "=" + td.optionValue; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
130 |
System.out.println("testing option <" + option + ">"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
131 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
132 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
133 |
"-XX:+UnlockDiagnosticVMOptions", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
134 |
"-XX:SharedArchiveFile=./" + fileName, |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
135 |
option, |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
136 |
"-Xshare:dump"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
137 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
138 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
139 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
140 |
if (td.expectedErrorMsg != null) { |
28018
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
141 |
if (!td.expectedErrorMsg.equals("UseArchive")) { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
142 |
output.shouldContain("The shared " + td.expectedErrorMsg |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
143 |
+ " space is not large enough"); |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
144 |
|
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
145 |
output.shouldHaveExitValue(2); |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
146 |
} else { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
147 |
output.shouldNotContain("space is not large enough"); |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
148 |
output.shouldHaveExitValue(0); |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
149 |
|
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
150 |
// try to use the archive |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
151 |
pb = ProcessTools.createJavaProcessBuilder( |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
152 |
"-XX:+UnlockDiagnosticVMOptions", |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
153 |
"-XX:SharedArchiveFile=./" + fileName, |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
154 |
"-XX:+PrintSharedArchiveAndExit", |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
155 |
"-version"); |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
156 |
|
28018
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
157 |
try { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
158 |
output = new OutputAnalyzer(pb.start()); |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
159 |
output.shouldContain("archive is valid"); |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
160 |
} catch (RuntimeException e) { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
161 |
// if sharing failed due to ASLR or similar reasons, |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
162 |
// check whether sharing was attempted at all (UseSharedSpaces) |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
163 |
if ((output.getOutput().contains("Unable to use shared archive") || |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
164 |
output.getOutput().contains("Unable to map ReadOnly shared space at required address.") || |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
165 |
output.getOutput().contains("Unable to map ReadWrite shared space at required address.") || |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
166 |
output.getOutput().contains("Unable to reserve shared space at required address")) && |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
167 |
output.getExitValue() == 1) { |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
168 |
System.out.println("Unable to use shared archive: test not executed; assumed passed"); |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
169 |
return; |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
170 |
} |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
171 |
} |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
172 |
output.shouldHaveExitValue(0); |
abc067cd68fd
8065050: vm crashes during CDS dump when very small SharedMiscDataSize is specified
ccheung
parents:
27404
diff
changeset
|
173 |
} |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
174 |
} else { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
175 |
output.shouldNotContain("space is not large enough"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
176 |
output.shouldHaveExitValue(0); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
177 |
} |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
178 |
} |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
179 |
} |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
180 |
} |