author | chegar |
Sat, 09 Apr 2016 23:03:39 +0100 | |
changeset 36851 | 03e2f4d0a421 |
parent 35459 | e5554d76304a |
child 40631 | ed82623d7831 |
permissions | -rw-r--r-- |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
1 |
/* |
35459
e5554d76304a
8145093: [TESTBUG] Remove test skip code for Solaris SPARC in runtime/SharedArchiveFile/SharedBaseAddress.java
minqi
parents:
30604
diff
changeset
|
2 |
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
24840
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 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
24 |
/* |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
25 |
* @test SharedBaseAddress |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
26 |
* @summary Test variety of values for SharedBaseAddress, making sure |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
27 |
* VM handles normal values as well as edge values w/o a crash. |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
28 |
* @library /testlibrary |
36851 | 29 |
* @modules java.base/jdk.internal.misc |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
24840
diff
changeset
|
30 |
* java.management |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
31 |
* @run main SharedBaseAddress |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
32 |
*/ |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
33 |
|
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30146
diff
changeset
|
34 |
import jdk.test.lib.*; |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
35 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
36 |
public class SharedBaseAddress { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
37 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
38 |
// shared base address test table |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
39 |
private static final String[] testTable = { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
40 |
"1g", "8g", "64g","512g", "4t", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
41 |
"32t", "128t", "0", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
42 |
"1", "64k", "64M" |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
43 |
}; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
44 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
45 |
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
|
46 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
47 |
for (String testEntry : testTable) { |
30123
7a8b6bd85e24
8075438: [TESTBUG] Hotspot JTREG tests should use unique CDS archive names
ctornqvi
parents:
24840
diff
changeset
|
48 |
String filename = "SharedBaseAddress" + testEntry + ".jsa"; |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
49 |
System.out.println("sharedBaseAddress = " + testEntry); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
50 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
51 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
52 |
"-XX:+UnlockDiagnosticVMOptions", |
30123
7a8b6bd85e24
8075438: [TESTBUG] Hotspot JTREG tests should use unique CDS archive names
ctornqvi
parents:
24840
diff
changeset
|
53 |
"-XX:SharedArchiveFile=" + filename, |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
54 |
"-XX:SharedBaseAddress=" + testEntry, |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
55 |
"-Xshare:dump"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
56 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
57 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
58 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
59 |
output.shouldContain("Loading classes to share"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
60 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
61 |
try { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
62 |
pb = ProcessTools.createJavaProcessBuilder( |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
63 |
"-XX:+UnlockDiagnosticVMOptions", |
30123
7a8b6bd85e24
8075438: [TESTBUG] Hotspot JTREG tests should use unique CDS archive names
ctornqvi
parents:
24840
diff
changeset
|
64 |
"-XX:SharedArchiveFile=" + filename, |
24840
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
65 |
"-Xshare:on", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
66 |
"-version"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
67 |
output = new OutputAnalyzer(pb.start()); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
68 |
output.shouldContain("sharing"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
69 |
output.shouldHaveExitValue(0); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
70 |
} catch (RuntimeException e) { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
71 |
output.shouldContain("Unable to use shared archive"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
72 |
output.shouldHaveExitValue(1); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
73 |
} |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
74 |
} |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
75 |
} |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
76 |
} |