--- old/test/compiler/whitebox/LockCompilationTest.java 2016-03-18 15:53:48.075568122 +0100 +++ new/test/compiler/whitebox/LockCompilationTest.java 2016-03-18 15:53:47.951568117 +0100 @@ -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 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,12 @@ // 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 + try { + Thread.sleep(5000); + } catch (Exception e) { + System.out.println("Thread sleep interrupted"); + } Asserts.assertTrue( WHITE_BOX.isMethodQueuedForCompilation(method), method + " must be in queue");