changeset 10511:1e385207d9f2

8152169: LockCompilationTest.java fails due method present in the compiler queue Summary: Too many compiles waiting, wait time not enough Reviewed-by: twisti
author neliasso
date Fri, 18 Mar 2016 15:54:47 +0100
parents d88920c25ca1
children a765ccf0f8f7 4226e949ec95
files test/compiler/whitebox/LockCompilationTest.java
diffstat 1 files changed, 23 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/compiler/whitebox/LockCompilationTest.java	Mon Mar 21 11:21:07 2016 +0100
+++ b/test/compiler/whitebox/LockCompilationTest.java	Fri Mar 18 15:54:47 2016 +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,9 @@
             // 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");