8269523: runtime/Safepoint/TestAbortOnVMOperationTimeout.java failed when expecting 'VM operation took too long'

Reviewed-by: shade, mseledtsov
This commit is contained in:
David Holmes 2021-07-30 04:03:11 +00:00
parent 77fbd99f79
commit 4f42eb6601

View File

@ -26,7 +26,7 @@ import jdk.test.lib.process.*;
/*
* @test TestAbortOnVMOperationTimeout
* @bug 8181143
* @bug 8181143 8269523
* @summary Check abort on VM timeout is working
* @library /test/lib
* @modules java.base/jdk.internal.misc
@ -36,12 +36,17 @@ import jdk.test.lib.process.*;
public class TestAbortOnVMOperationTimeout {
// A static array is unlikely to be optimised away by the JIT.
static Object[] arr;
public static void main(String[] args) throws Exception {
if (args.length > 0) {
Object[] arr = new Object[10_000_000];
arr = new Object[10_000_000];
for (int i = 0; i < arr.length; i++) {
arr[i] = new Object();
}
// Try to force at least one full GC cycle.
System.gc();
return;
}
@ -51,9 +56,9 @@ public class TestAbortOnVMOperationTimeout {
testWith(delay, true);
}
// These should fail: Serial is not very fast. Traversing 10M objects in 5 ms
// means less than 0.5 ns per object, which is not doable.
for (int delay : new int[]{0, 1, 5}) {
// These should fail: Serial is not very fast but we have seen the test
// execute as quickly as 2ms!
for (int delay : new int[]{0, 1}) {
testWith(delay, false);
}
}
@ -66,6 +71,7 @@ public class TestAbortOnVMOperationTimeout {
"-Xmx256m",
"-XX:+UseSerialGC",
"-XX:-CreateCoredumpOnCrash",
"-Xlog:gc",
"TestAbortOnVMOperationTimeout",
"foo"
);
@ -77,6 +83,6 @@ public class TestAbortOnVMOperationTimeout {
output.shouldContain("VM operation took too long");
output.shouldNotHaveExitValue(0);
}
output.reportDiagnosticSummary();
}
}