changeset 10473:ca0cd486254f

8066770: EnqueueMethodForCompilationTest.java fails to compile method Summary: Make compiles blocking and always check queue Reviewed-by: kvn
author neliasso
date Wed, 09 Mar 2016 21:20:43 +0100
parents fc4808355352
children af3712e4a548
files test/compiler/whitebox/ClearMethodStateTest.java test/compiler/whitebox/CompilerWhiteBoxTest.java test/compiler/whitebox/EnqueueMethodForCompilationTest.java test/compiler/whitebox/LockCompilationTest.java test/compiler/whitebox/MakeMethodNotCompilableTest.java
diffstat 5 files changed, 46 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/test/compiler/whitebox/ClearMethodStateTest.java	Wed Mar 09 21:19:13 2016 +0100
+++ b/test/compiler/whitebox/ClearMethodStateTest.java	Wed Mar 09 21:20:43 2016 +0100
@@ -22,6 +22,7 @@
  */
 
 import java.util.function.Function;
+
 import compiler.whitebox.CompilerWhiteBoxTest;
 
 /*
@@ -32,14 +33,24 @@
  * @build ClearMethodStateTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* ClearMethodStateTest
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest
  * @summary testing of WB::clearMethodState()
  * @author igor.ignatyev@oracle.com
  */
 public class ClearMethodStateTest extends CompilerWhiteBoxTest {
 
     public static void main(String[] args) throws Exception {
-        CompilerWhiteBoxTest.main(ClearMethodStateTest::new, args);
+        String directive =
+                "[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
+                " { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
+        if (WHITE_BOX.addCompilerDirective(directive) != 2) {
+            throw new RuntimeException("Could not add directive");
+        }
+        try {
+            CompilerWhiteBoxTest.main(ClearMethodStateTest::new, args);
+        } finally {
+            WHITE_BOX.removeCompilerDirective(2);
+        }
     }
 
     private ClearMethodStateTest(TestCase testCase) {
@@ -58,6 +69,7 @@
      */
     @Override
     protected void test() throws Exception {
+
         checkNotCompiled();
         compile();
         WHITE_BOX.clearMethodState(method);
--- a/test/compiler/whitebox/CompilerWhiteBoxTest.java	Wed Mar 09 21:19:13 2016 +0100
+++ b/test/compiler/whitebox/CompilerWhiteBoxTest.java	Wed Mar 09 21:20:43 2016 +0100
@@ -213,6 +213,7 @@
      *                          compilation level.
      */
     protected final void checkNotCompiled() {
+        waitBackgroundCompilation();
         checkNotCompiled(true);
         checkNotCompiled(false);
     }
@@ -226,7 +227,6 @@
      *                          compilation level.
      */
     protected final void checkNotCompiled(boolean isOsr) {
-        waitBackgroundCompilation();
         if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
             throw new RuntimeException(method + " must not be in queue");
         }
@@ -315,11 +315,11 @@
             return;
         }
         final Object obj = new Object();
-        for (int i = 0; i < 10
+        for (int i = 0; i < 100
                 && WHITE_BOX.isMethodQueuedForCompilation(executable); ++i) {
             synchronized (obj) {
                 try {
-                    obj.wait(1000);
+                    obj.wait(100);
                 } catch (InterruptedException e) {
                     Thread.currentThread().interrupt();
                 }
--- a/test/compiler/whitebox/EnqueueMethodForCompilationTest.java	Wed Mar 09 21:19:13 2016 +0100
+++ b/test/compiler/whitebox/EnqueueMethodForCompilationTest.java	Wed Mar 09 21:20:43 2016 +0100
@@ -31,14 +31,24 @@
  * @build EnqueueMethodForCompilationTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* EnqueueMethodForCompilationTest
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI EnqueueMethodForCompilationTest
  * @summary testing of WB::enqueueMethodForCompilation()
  * @author igor.ignatyev@oracle.com
  */
 public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
 
     public static void main(String[] args) throws Exception {
-        CompilerWhiteBoxTest.main(EnqueueMethodForCompilationTest::new, args);
+        String directive =
+                "[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
+                " { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
+        if (WHITE_BOX.addCompilerDirective(directive) != 2) {
+            throw new RuntimeException("Could not add directive");
+        }
+        try {
+            CompilerWhiteBoxTest.main(EnqueueMethodForCompilationTest::new, args);
+        } finally {
+            WHITE_BOX.removeCompilerDirective(2);
+        }
     }
 
     private EnqueueMethodForCompilationTest(TestCase testCase) {
--- a/test/compiler/whitebox/LockCompilationTest.java	Wed Mar 09 21:19:13 2016 +0100
+++ b/test/compiler/whitebox/LockCompilationTest.java	Wed Mar 09 21:20:43 2016 +0100
@@ -29,7 +29,7 @@
  * @build LockCompilationTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* LockCompilationTest
+ * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI LockCompilationTest
  * @summary testing of WB::lock/unlockCompilation()
  */
 
@@ -37,12 +37,15 @@
 import java.io.PrintWriter;
 import java.util.concurrent.BrokenBarrierException;
 import java.util.concurrent.CyclicBarrier;
+
 import compiler.whitebox.CompilerWhiteBoxTest;
 import jdk.test.lib.Asserts;
 
 public class LockCompilationTest extends CompilerWhiteBoxTest {
     public static void main(String[] args) throws Exception {
-        CompilerWhiteBoxTest.main(LockCompilationTest::new, args);
+        // This case waits for 10 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"});
     }
 
     private LockCompilationTest(TestCase testCase) {
--- a/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Wed Mar 09 21:19:13 2016 +0100
+++ b/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Wed Mar 09 21:20:43 2016 +0100
@@ -31,14 +31,24 @@
  * @build MakeMethodNotCompilableTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* MakeMethodNotCompilableTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI  -Xmixed MakeMethodNotCompilableTest
  * @summary testing of WB::makeMethodNotCompilable()
  * @author igor.ignatyev@oracle.com
  */
 public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
     private int bci;
     public static void main(String[] args) throws Exception {
-        CompilerWhiteBoxTest.main(MakeMethodNotCompilableTest::new, args);
+        String directive =
+                "[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
+                " { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
+        if (WHITE_BOX.addCompilerDirective(directive) != 2) {
+            throw new RuntimeException("Could not add directive");
+        }
+        try {
+            CompilerWhiteBoxTest.main(MakeMethodNotCompilableTest::new, args);
+        } finally {
+            WHITE_BOX.removeCompilerDirective(2);
+        }
     }
 
     private MakeMethodNotCompilableTest(TestCase testCase) {