8152169: LockCompilationTest.java fails due method present in the compiler queue

Too many compiles waiting, wait time not enough

Reviewed-by: twisti
This commit is contained in:
Nils Eliasson 2016-03-18 15:54:47 +01:00
parent 1c19fa8c18
commit f058b201f6

View File

@ -23,12 +23,12 @@
/*
* @test LockCompilationTest
* @bug 8059624
* @bug 8059624 8152169
* @library /testlibrary /test/lib /
* @modules java.management
* @build LockCompilationTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI LockCompilationTest
* @summary testing of WB::lock/unlockCompilation()
*/
@ -42,10 +42,25 @@ import compiler.whitebox.CompilerWhiteBoxTest;
import jdk.test.lib.Asserts;
public class LockCompilationTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
// This case waits for 10 seconds and verifies that the method hasn't been
// This case waits for 5 seconds and verifies that the method hasn't been
// compiled during that time. Only do that for one of the test cases.
CompilerWhiteBoxTest.main(LockCompilationTest::new, new String[] {"METHOD_TEST"});
// Only compile SimpleTestCase$Helper.method and exclude all other to ensure no
// contention on the compile queue causes problems.
String directive =
"[{ match:\"*SimpleTestCase$Helper.method\", Exclude:false}, " +
" { match:\"*.*\", Exclude:true}]";
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
throw new RuntimeException("Could not add directive");
}
try {
CompilerWhiteBoxTest.main(LockCompilationTest::new, new String[] {"METHOD_TEST"});
} finally {
WHITE_BOX.removeCompilerDirective(2);
}
}
private LockCompilationTest(TestCase testCase) {
@ -66,7 +81,9 @@ public class LockCompilationTest extends CompilerWhiteBoxTest {
// to check if it works correctly w/ safepoints
System.out.println("going to safepoint");
WHITE_BOX.fullGC();
waitBackgroundCompilation();
// Sleep a while and then make sure the compile is still waiting
Thread.sleep(5000);
Asserts.assertTrue(
WHITE_BOX.isMethodQueuedForCompilation(method),
method + " must be in queue");