8240634: event/runtime/TestMetaspaceAllocationFailure.java times out
Limit number of iterations Reviewed-by: egahlin, stuefe
This commit is contained in:
parent
54e2c6fe3e
commit
098b48b7db
@ -29,9 +29,11 @@
|
||||
* @modules java.base/jdk.internal.misc java.compiler
|
||||
* @run main/othervm -Xmx1G -XX:MaxMetaspaceSize=200M
|
||||
* -XX:StartFlightRecording -Xshare:off
|
||||
* -Xlog:gc+metaspace*=debug
|
||||
* jdk.jfr.event.runtime.TestMetaspaceAllocationFailure
|
||||
* @run main/othervm -Xmx1G -XX:CompressedClassSpaceSize=200M
|
||||
* @run main/othervm -Xmx1G -XX:CompressedClassSpaceSize=10M
|
||||
* -XX:StartFlightRecording -Xshare:off
|
||||
* -Xlog:gc+metaspace*=debug
|
||||
* jdk.jfr.event.runtime.TestMetaspaceAllocationFailure
|
||||
*/
|
||||
package jdk.jfr.event.runtime;
|
||||
@ -40,21 +42,27 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import jdk.jfr.consumer.RecordingStream;
|
||||
import jdk.test.lib.classloader.GeneratingCompilingClassLoader;
|
||||
import jdk.test.lib.Asserts;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
|
||||
public class TestMetaspaceAllocationFailure {
|
||||
private static final int MAX_ITERATIONS = 100;
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
AtomicBoolean eventArrived = new AtomicBoolean(false);
|
||||
|
||||
try (RecordingStream r = new RecordingStream()) {
|
||||
r.onEvent("jdk.MetaspaceAllocationFailure", e -> eventArrived.set(true));
|
||||
r.startAsync();
|
||||
|
||||
try {
|
||||
int iteration = 0;
|
||||
while (!eventArrived.get()) {
|
||||
GeneratingCompilingClassLoader cl = new GeneratingCompilingClassLoader();
|
||||
cl.getGeneratedClasses(50, 20);
|
||||
Thread.sleep(100);
|
||||
System.out.println("Iteration");
|
||||
System.out.println("Iteration:" + iteration++);
|
||||
if (iteration > MAX_ITERATIONS) {
|
||||
throw new SkippedException("Exceeded MAX_ITERATIONS of " + MAX_ITERATIONS);
|
||||
}
|
||||
}
|
||||
System.gc();
|
||||
System.out.println("main(): Event arrived");
|
||||
|
Loading…
x
Reference in New Issue
Block a user