author | ykantser |
Fri, 13 Feb 2015 13:17:13 +0100 | |
changeset 29069 | 938c1c97ad3b |
parent 24840 | 96be34dfc72a |
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 |
|
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 |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
29 |
* @run main SharedBaseAddress |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
30 |
*/ |
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 |
import com.oracle.java.testlibrary.*; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
33 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
34 |
public class SharedBaseAddress { |
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 |
// shared base address test table |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
37 |
private static final String[] testTable = { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
38 |
"1g", "8g", "64g","512g", "4t", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
39 |
"32t", "128t", "0", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
40 |
"1", "64k", "64M" |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
41 |
}; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
42 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
43 |
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
|
44 |
// Known issue on Solaris-Sparc |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
45 |
// @ignore JDK-8044600 |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
46 |
if (Platform.isSolaris() && Platform.isSparc()) |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
47 |
return; |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
48 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
49 |
for (String testEntry : testTable) { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
50 |
System.out.println("sharedBaseAddress = " + testEntry); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
51 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
52 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
53 |
"-XX:+UnlockDiagnosticVMOptions", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
54 |
"-XX:SharedArchiveFile=test.jsa", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
55 |
"-XX:SharedBaseAddress=" + testEntry, |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
56 |
"-Xshare:dump"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
57 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
58 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
59 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
60 |
output.shouldContain("Loading classes to share"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
61 |
|
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
62 |
try { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
63 |
pb = ProcessTools.createJavaProcessBuilder( |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
64 |
"-XX:+UnlockDiagnosticVMOptions", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
65 |
"-XX:SharedArchiveFile=test.jsa", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
66 |
"-Xshare:on", |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
67 |
"-version"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
68 |
output = new OutputAnalyzer(pb.start()); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
69 |
output.shouldContain("sharing"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
70 |
output.shouldHaveExitValue(0); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
71 |
} catch (RuntimeException e) { |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
72 |
output.shouldContain("Unable to use shared archive"); |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
73 |
output.shouldHaveExitValue(1); |
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 |
} |
96be34dfc72a
8038587: [TESTBUG] Create CDS tests to exercise region sizes and base address
mseledtsov
parents:
diff
changeset
|
77 |
} |