24
25 /*
26 * @test SharedBaseAddress
27 * @summary Test variety of values for SharedBaseAddress, in AppCDS mode,
28 * making sure VM handles normal values as well as edge values
29 * w/o a crash.
30 * @requires vm.cds
31 * @library /test/lib
32 * @compile test-classes/Hello.java
33 * @run main/timeout=240 SharedBaseAddress
34 */
35
36 import jdk.test.lib.process.OutputAnalyzer;
37
38 public class SharedBaseAddress {
39
40 // shared base address test table
41 private static final String[] testTable = {
42 "1g", "8g", "64g","512g", "4t",
43 "32t", "128t", "0",
44 "1", "64k", "64M", "320g"
45 };
46
47 public static void main(String[] args) throws Exception {
48 String appJar = JarBuilder.getOrCreateHelloJar();
49
50 for (String testEntry : testTable) {
51 System.out.println("sharedBaseAddress = " + testEntry);
52
53 // Note: some platforms may restrict valid values for SharedBaseAddress; the VM should print
54 // a warning and use the default value instead. Similar, ASLR may prevent the given address
55 // from being used; this too should handled gracefully by using the default base address.
56 OutputAnalyzer dumpOutput = TestCommon.dump(
57 appJar, new String[] {"Hello"}, "-XX:SharedBaseAddress=" + testEntry);
58 TestCommon.checkDump(dumpOutput, "Loading classes to share");
59
60 OutputAnalyzer execOutput = TestCommon.exec(appJar, "Hello");
61 TestCommon.checkExec(execOutput, "Hello World");
62 }
63 }
64 }
|
24
25 /*
26 * @test SharedBaseAddress
27 * @summary Test variety of values for SharedBaseAddress, in AppCDS mode,
28 * making sure VM handles normal values as well as edge values
29 * w/o a crash.
30 * @requires vm.cds
31 * @library /test/lib
32 * @compile test-classes/Hello.java
33 * @run main/timeout=240 SharedBaseAddress
34 */
35
36 import jdk.test.lib.process.OutputAnalyzer;
37
38 public class SharedBaseAddress {
39
40 // shared base address test table
41 private static final String[] testTable = {
42 "1g", "8g", "64g","512g", "4t",
43 "32t", "128t", "0",
44 "1", "64k", "64M", "320g",
45 "0x800001000" // Default base address + 1 page - probably valid but unaligned to metaspace alignment, see JDK 8247522
46 };
47
48 public static void main(String[] args) throws Exception {
49 String appJar = JarBuilder.getOrCreateHelloJar();
50
51 for (String testEntry : testTable) {
52 System.out.println("sharedBaseAddress = " + testEntry);
53
54 // Note: some platforms may restrict valid values for SharedBaseAddress; the VM should print
55 // a warning and use the default value instead. Similar, ASLR may prevent the given address
56 // from being used; this too should handled gracefully by using the default base address.
57 OutputAnalyzer dumpOutput = TestCommon.dump(
58 appJar, new String[] {"Hello"}, "-XX:SharedBaseAddress=" + testEntry);
59 TestCommon.checkDump(dumpOutput, "Loading classes to share");
60
61 OutputAnalyzer execOutput = TestCommon.exec(appJar, "Hello");
62 TestCommon.checkExec(execOutput, "Hello World");
63 }
64 }
65 }
|