mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-15 16:44:36 +02:00
8271015: Split cds/SharedBaseAddress.java test into smaller parts
Reviewed-by: ccheung, minqi
This commit is contained in:
parent
024c4027d8
commit
0790f04d8a
1 changed files with 64 additions and 24 deletions
|
@ -28,7 +28,39 @@
|
||||||
* VM handles normal values as well as edge values w/o a crash.
|
* VM handles normal values as well as edge values w/o a crash.
|
||||||
* @requires vm.cds
|
* @requires vm.cds
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @run driver SharedBaseAddress
|
* @run driver SharedBaseAddress 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test SharedBaseAddress
|
||||||
|
* @bug 8265705 8267351
|
||||||
|
* @summary Test variety of values for SharedBaseAddress, making sure
|
||||||
|
* VM handles normal values as well as edge values w/o a crash.
|
||||||
|
* @requires vm.cds
|
||||||
|
* @library /test/lib
|
||||||
|
* @run driver SharedBaseAddress 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test SharedBaseAddress
|
||||||
|
* @bug 8265705 8267351
|
||||||
|
* @summary Test variety of values for SharedBaseAddress, making sure
|
||||||
|
* VM handles normal values as well as edge values w/o a crash.
|
||||||
|
* @requires vm.cds
|
||||||
|
* @requires vm.bits == 64
|
||||||
|
* @library /test/lib
|
||||||
|
* @run driver SharedBaseAddress 0 provoke
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test SharedBaseAddress
|
||||||
|
* @bug 8265705 8267351
|
||||||
|
* @summary Test variety of values for SharedBaseAddress, making sure
|
||||||
|
* VM handles normal values as well as edge values w/o a crash.
|
||||||
|
* @requires vm.cds
|
||||||
|
* @requires vm.bits == 64
|
||||||
|
* @library /test/lib
|
||||||
|
* @run driver SharedBaseAddress 1 provoke
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import jdk.test.lib.cds.CDSTestUtils;
|
import jdk.test.lib.cds.CDSTestUtils;
|
||||||
|
@ -58,16 +90,20 @@ public class SharedBaseAddress {
|
||||||
private static String failedPattern = "os::release_memory\\(0x[0-9a-fA-F]*,\\s[0-9]*\\)\\sfailed";
|
private static String failedPattern = "os::release_memory\\(0x[0-9a-fA-F]*,\\s[0-9]*\\)\\sfailed";
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
int mid = testTable.length / 2;
|
||||||
|
int start = args[0].equals("0") ? 0 : mid;
|
||||||
|
int end = args[0].equals("0") ? mid : testTable.length;
|
||||||
|
boolean provoke = (args.length > 1 && args[1].equals("provoke"));
|
||||||
|
|
||||||
for (int run = 0; run < 2; run ++) {
|
// provoke == true: we want to increase the chance that mapping the generated archive at the designated base
|
||||||
// We run twice:
|
|
||||||
// Once, where we want to increase the chance that mapping the generated archive at the designated base
|
|
||||||
// succeeds, to test Klass pointer encoding at that weird location. We do this by sizing heap + class space
|
// succeeds, to test Klass pointer encoding at that weird location. We do this by sizing heap + class space
|
||||||
// small, and by switching off compressed oops.
|
// small, and by switching off compressed oops.
|
||||||
// On the second run, we don't do this but instead go with default parameters. This is more of a test of
|
|
||||||
|
// provoke == false: we just go with default parameters. This is more of a test of
|
||||||
// CDS' ability to recover if mapping at runtime fails.
|
// CDS' ability to recover if mapping at runtime fails.
|
||||||
for (String testEntry : testTable) {
|
for (int i = start; i < end; i++) {
|
||||||
String filename = "SharedBaseAddress-base" + testEntry + "-run" + run + ".jsa";
|
String testEntry = testTable[i];
|
||||||
|
String filename = "SharedBaseAddress-base" + testEntry + ".jsa";
|
||||||
System.out.println("sharedBaseAddress = " + testEntry);
|
System.out.println("sharedBaseAddress = " + testEntry);
|
||||||
CDSOptions opts = (new CDSOptions())
|
CDSOptions opts = (new CDSOptions())
|
||||||
.setArchiveName(filename)
|
.setArchiveName(filename)
|
||||||
|
@ -79,11 +115,16 @@ public class SharedBaseAddress {
|
||||||
.addPrefix("-Xlog:gc+metaspace")
|
.addPrefix("-Xlog:gc+metaspace")
|
||||||
.addPrefix("-XX:NativeMemoryTracking=detail");
|
.addPrefix("-XX:NativeMemoryTracking=detail");
|
||||||
|
|
||||||
if (run == 0 && Platform.is64bit()) {
|
if (provoke) {
|
||||||
opts.addPrefix("-Xmx128m")
|
opts.addPrefix("-Xmx128m")
|
||||||
.addPrefix("-XX:CompressedClassSpaceSize=32m")
|
.addPrefix("-XX:CompressedClassSpaceSize=32m")
|
||||||
.addPrefix("-XX:-UseCompressedOops");
|
.addPrefix("-XX:-UseCompressedOops");
|
||||||
}
|
}
|
||||||
|
if (Platform.isDebugBuild()) {
|
||||||
|
// Make VM start faster in debug build with large heap.
|
||||||
|
opts.addPrefix("-XX:-ZapUnusedHeapArea");
|
||||||
|
}
|
||||||
|
|
||||||
CDSTestUtils.createArchiveAndCheck(opts);
|
CDSTestUtils.createArchiveAndCheck(opts);
|
||||||
OutputAnalyzer out = CDSTestUtils.runWithArchiveAndCheck(opts);
|
OutputAnalyzer out = CDSTestUtils.runWithArchiveAndCheck(opts);
|
||||||
if (testEntry.equals("0")) {
|
if (testEntry.equals("0")) {
|
||||||
|
@ -94,4 +135,3 @@ public class SharedBaseAddress {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue