8311240: Eliminate usage of testcases.jar from TestMetaSpaceLog.java
Reviewed-by: ayang, tschatzl
This commit is contained in:
parent
3e1b1bf94e
commit
6b9df037e4
@ -31,6 +31,8 @@ import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.ByteCodeLoader;
|
||||
import jdk.test.lib.compiler.InMemoryJavaCompiler;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.whitebox.WhiteBox;
|
||||
@ -91,9 +93,6 @@ public class TestMetaSpaceLog {
|
||||
}
|
||||
|
||||
private static void testMetaSpaceUpdate() throws Exception {
|
||||
// Propagate test.src for the jar file.
|
||||
String testSrc= "-Dtest.src=" + System.getProperty("test.src", ".");
|
||||
|
||||
ProcessBuilder pb =
|
||||
ProcessTools.createTestJvm(
|
||||
"-Xlog:gc*",
|
||||
@ -102,7 +101,7 @@ public class TestMetaSpaceLog {
|
||||
"-XX:+WhiteBoxAPI",
|
||||
"-Xmx1000M",
|
||||
"-Xms1000M",
|
||||
testSrc, StressMetaSpace.class.getName());
|
||||
StressMetaSpace.class.getName());
|
||||
|
||||
OutputAnalyzer output = null;
|
||||
try {
|
||||
@ -117,29 +116,20 @@ public class TestMetaSpaceLog {
|
||||
}
|
||||
|
||||
static class StressMetaSpace {
|
||||
private static URL[] urls = new URL[1];
|
||||
|
||||
static {
|
||||
try {
|
||||
File jarFile = new File(System.getProperty("test.src") + "/testcases.jar");
|
||||
urls[0] = jarFile.toURI().toURL();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
WhiteBox wb = WhiteBox.getWhiteBox();
|
||||
for(int i = 0; i < 10000; i++) {
|
||||
loadClass(wb);
|
||||
}
|
||||
wb.fullGC();
|
||||
loadManyClasses();
|
||||
WhiteBox.getWhiteBox().fullGC();
|
||||
}
|
||||
|
||||
public static void loadClass(WhiteBox wb) {
|
||||
public static void loadManyClasses() {
|
||||
String className = "Tmp";
|
||||
String sourceCode = "public class Tmp {}";
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile(className, sourceCode);
|
||||
try {
|
||||
URLClassLoader ucl = new URLClassLoader(urls);
|
||||
Class.forName("case00", false, ucl);
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
ByteCodeLoader.load(className, byteCode);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user