8151280: update hotspot tests to use vm.compMode instead of their own logic
authortpivovarova
Wed, 13 Jul 2016 18:03:15 +0300
changeset 40067 db6c74a53556
parent 40063 813343dec9dd
child 40068 073a1353b51d
8151280: update hotspot tests to use vm.compMode instead of their own logic Summary: Update hs compiler tests to use vm.compMode instead of their own logic and to get VM mode using j.t.l.Platform Reviewed-by: kvn, dpochepk Contributed-by: igor.ignatyev@oracle.com
hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java
hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java
hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java
hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java
hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java
hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java
hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java
hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java
hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java
hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java
hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java
hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java
hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java
hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java
hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java
hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java
hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java
hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java
hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java
hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java
hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java
hotspot/test/compiler/tiered/NonTieredLevelsTest.java
hotspot/test/compiler/types/correctness/CorrectnessTest.java
hotspot/test/compiler/unsafe/UnsafeGetConstantField.java
hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java
hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java
hotspot/test/compiler/whitebox/IsMethodCompilableTest.java
hotspot/test/testlibrary/jdk/test/lib/Platform.java
hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java	Wed Jul 13 18:03:15 2016 +0300
@@ -25,6 +25,7 @@
  * @test
  * @bug 8072016
  * @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
@@ -86,9 +87,11 @@
     }
 
     static public void main(String[] args) throws Exception {
+        if (!Platform.isServer()) {
+            throw new Error("TESTBUG: Not server VM");
+        }
         // Only execute if C2 is available
-        if (Platform.isServer() &&
-            TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) {
+        if (TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) {
             int[] src = new int[10];
             Object src_obj = new Object();
             Method method_m1 = TestArrayCopyNoInitDeopt.class.getMethod("m1", Object.class);
--- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Wed Jul 13 18:03:15 2016 +0300
@@ -57,8 +57,6 @@
     private static final String METHOD_TO_ENQUEUE = "method";
     private static final int LEVEL_SIMPLE = 1;
     private static final int LEVEL_FULL_OPTIMIZATION = 4;
-    private static final boolean INTERPRETED
-            = System.getProperty("java.vm.info").startsWith("interpreted ");
     private static final boolean TIERED_COMPILATION
             = Helper.WHITE_BOX.getBooleanVMFlag("TieredCompilation");
     private static final int TIERED_STOP_AT_LEVEL
@@ -74,15 +72,13 @@
         } else if (Platform.isClient() || Platform.isMinimal()) {
             AVAILABLE_LEVELS = new int[] { LEVEL_SIMPLE };
         } else {
-            throw new Error(String.format(
-                    "TESTBUG: unknown VM: %s", System.getProperty("java.vm.name")));
+            throw new Error("TESTBUG: unknown VM: " + Platform.vmName);
         }
     }
 
     public static void main(String[] args) {
-        if (INTERPRETED) {
-            System.err.println("Test isn't applicable for interpreter. Skip test.");
-            return;
+        if (Platform.isInt()) {
+            throw new Error("TESTBUG: test can not be run in interpreter");
         }
         new CodeCacheStressRunner(new OverloadCompileQueueTest()).runTest();
     }
--- a/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/escapeAnalysis/TestEscapeThroughInvoke.java	Wed Jul 13 18:03:15 2016 +0300
@@ -78,4 +78,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
--- a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java	Wed Jul 13 18:03:15 2016 +0300
@@ -52,11 +52,9 @@
 import java.util.concurrent.Callable;
 
 public class IntrinsicAvailableTest extends CompilerWhiteBoxTest {
-    protected String VMName;
 
     public IntrinsicAvailableTest(IntrinsicAvailableTestTestCase testCase) {
         super(testCase);
-        VMName = System.getProperty("java.vm.name");
     }
 
     public static class IntrinsicAvailableTestTestCase implements TestCase {
--- a/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bigInteger/MontgomeryMultiplyTest.java	Wed Jul 13 18:03:15 2016 +0300
@@ -26,6 +26,7 @@
  * @test
  * @bug 8130150 8131779 8139907
  * @summary Verify that the Montgomery multiply and square intrinsic works and correctly checks their arguments.
+ * @requires vm.flavor == "server"
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary /test/lib
  *
@@ -314,9 +315,11 @@
     }
 
     public static void main(String args[]) {
-        if (Platform.isServer() &&
-            wb.isIntrinsicAvailable(getExecutable(true), COMP_LEVEL_FULL_OPTIMIZATION) &&
-            wb.isIntrinsicAvailable(getExecutable(false), COMP_LEVEL_FULL_OPTIMIZATION)) {
+        if (!Platform.isServer()) {
+            throw new Error("TESTBUG: Not server VM");
+        }
+        if (wb.isIntrinsicAvailable(getExecutable(true), COMP_LEVEL_FULL_OPTIMIZATION) &&
+                wb.isIntrinsicAvailable(getExecutable(false), COMP_LEVEL_FULL_OPTIMIZATION)) {
             try {
                 new MontgomeryMultiplyTest().testMontgomeryMultiplyChecks();
                 new MontgomeryMultiplyTest().testResultValues();
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java	Wed Jul 13 18:03:15 2016 +0300
@@ -60,8 +60,11 @@
         }
 
         if (!Platform.isServer()) {
-            System.out.println("Not server VM, test SKIPPED");
-            return;
+            throw new Error("TESTBUG: Not server VM");
+        }
+
+        if (Platform.isInt()) {
+            throw new Error("TESTBUG: test can not be run in interpreter");
         }
 
         if (!CPUInfo.hasFeature(bmiTestCase.getCpuFlag())) {
@@ -76,22 +79,12 @@
 
         System.out.println(testCase.name());
 
-        switch (MODE) {
-            case "compiled mode":
-            case "mixed mode":
-                if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) {
-                    System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED");
-                    return;
-                }
-                deoptimize();
-                compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
-                break;
-            case "interpreted mode": // test is not applicable in this mode;
-                System.err.println("Warning: This test is not applicable in mode: " + MODE);
-                break;
-            default:
-                throw new AssertionError("Test bug, unknown VM mode: " + MODE);
+        if (TIERED_COMPILATION && TIERED_STOP_AT_LEVEL != CompilerWhiteBoxTest.COMP_LEVEL_MAX) {
+            System.out.println("TieredStopAtLevel value (" + TIERED_STOP_AT_LEVEL + ") is too low, test SKIPPED");
+            return;
         }
+        deoptimize();
+        compileAtLevelAndCheck(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
     }
 
     protected void compileAtLevelAndCheck(int level) {
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java	Wed Jul 13 18:03:15 2016 +0300
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8031321
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/klass/CastNullCheckDroppingsTest.java	Wed Jul 13 18:03:15 2016 +0300
@@ -25,6 +25,7 @@
  * @test NullCheckDroppingsTest
  * @bug 8054492
  * @summary Casting can result in redundant null checks in generated code
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
@@ -85,18 +86,16 @@
     int[]   asink;
 
     public static void main(String[] args) throws Exception {
-
-        // Only test C2 in Server VM
         if (!Platform.isServer()) {
-            return;
+            throw new Error("TESTBUG: Not server VM");
         }
         // Make sure background compilation is disabled
         if (WHITE_BOX.getBooleanVMFlag("BackgroundCompilation")) {
-            throw new AssertionError("Background compilation enabled");
+            throw new Error("TESTBUG: Background compilation enabled");
         }
         // Make sure Tiered compilation is disabled
         if (WHITE_BOX.getBooleanVMFlag("TieredCompilation")) {
-            throw new AssertionError("Tiered compilation enabled");
+            throw new Error("TESTBUG: Tiered compilation enabled");
         }
 
         Method methodClassCast = CastNullCheckDroppingsTest.class.getDeclaredMethod("testClassCast", String.class);
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IntrinsicBase.java	Wed Jul 13 18:03:15 2016 +0300
@@ -32,12 +32,10 @@
 import java.util.Properties;
 
 public abstract class IntrinsicBase extends CompilerWhiteBoxTest {
-    protected String javaVmName;
     protected String useMathExactIntrinsics;
 
     protected IntrinsicBase(TestCase testCase) {
         super(testCase);
-        javaVmName = System.getProperty("java.vm.name");
         useMathExactIntrinsics = getVMOption("UseMathExactIntrinsics");
     }
 
@@ -46,39 +44,32 @@
         //java.lang.Math should be loaded to allow a compilation of the methods that use Math's method
         System.out.println("class java.lang.Math should be loaded. Proof: " + Math.class);
         printEnvironmentInfo();
+        if (Platform.isInt()) {
+            throw new Error("TESTBUG: test can not be run in interpreter");
+        }
 
         int expectedIntrinsicCount = 0;
 
-        switch (MODE) {
-            case "compiled mode":
-            case "mixed mode":
-                if (isServerVM()) {
-                    if (TIERED_COMPILATION) {
-                        int max_level = TIERED_STOP_AT_LEVEL;
-                        expectedIntrinsicCount = (max_level == COMP_LEVEL_MAX) ? 1 : 0;
-                        for (int i = CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE; i <= max_level; ++i) {
-                            deoptimize();
-                            compileAtLevel(i);
-                        }
-                    } else {
-                        expectedIntrinsicCount = 1;
-                        deoptimize();
-                        compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
-                    }
-                } else {
+        if (Platform.isServer()) {
+            if (TIERED_COMPILATION) {
+                int max_level = TIERED_STOP_AT_LEVEL;
+                expectedIntrinsicCount = (max_level == COMP_LEVEL_MAX) ? 1 : 0;
+                for (int i = CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE; i <= max_level; ++i) {
                     deoptimize();
-                    compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
-                }
-
-                if (!isIntrinsicAvailable()) {
-                    expectedIntrinsicCount = 0;
+                    compileAtLevel(i);
                 }
-                break;
-            case "interpreted mode": //test is not applicable in this mode;
-                System.err.println("Warning: This test is not applicable in mode: " + MODE);
-                break;
-            default:
-                throw new RuntimeException("Test bug, unknown VM mode: " + MODE);
+            } else {
+                expectedIntrinsicCount = 1;
+                deoptimize();
+                compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_MAX);
+            }
+        } else {
+            deoptimize();
+            compileAtLevel(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE);
+        }
+
+        if (!isIntrinsicAvailable()) {
+            expectedIntrinsicCount = 0;
         }
 
         System.out.println("Expected intrinsic count is " + expectedIntrinsicCount + " name " + getIntrinsicId());
@@ -93,9 +84,8 @@
     }
 
     protected void printEnvironmentInfo() {
-        System.out.println("java.vm.name=" + javaVmName);
         System.out.println("os.arch=" + Platform.getOsArch());
-        System.out.println("java.vm.info=" + MODE);
+        System.out.println("java.vm.info=" + Platform.vmInfo);
         System.out.println("useMathExactIntrinsics=" + useMathExactIntrinsics);
     }
 
@@ -125,10 +115,6 @@
 
     protected abstract String getIntrinsicId();
 
-    protected boolean isServerVM() {
-        return javaVmName.toLowerCase().contains("server");
-    }
-
     static class IntTest extends IntrinsicBase {
 
         protected boolean isIntrinsicAvailable; // The tested intrinsic is available on the current platform.
--- a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java	Wed Jul 13 18:03:15 2016 +0300
@@ -26,14 +26,15 @@
  * @bug 8136421
  * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
- * @library ../common/patches
+ *          ../common/patches
  * @modules java.base/jdk.internal.misc
- * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.hotspot
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
- * @build compiler.jvmci.compilerToVM.IsMatureTest
- * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ *        compiler.jvmci.compilerToVM.IsMatureTest
+ *        sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
@@ -45,6 +46,7 @@
 import compiler.jvmci.common.testcases.SimpleClass;
 import compiler.whitebox.CompilerWhiteBoxTest;
 import jdk.test.lib.Asserts;
+import jdk.test.lib.Platform;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import sun.hotspot.WhiteBox;
 
@@ -52,8 +54,6 @@
 
 public class IsMatureTest {
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
-    private static final boolean IS_XCOMP
-            = System.getProperty("java.vm.info").contains("compiled mode");
     private static final boolean TIERED
             = WB.getBooleanVMFlag("TieredCompilation");
 
@@ -82,7 +82,7 @@
                     "Multiple times invoked method should have method data");
             /* a method is not mature in Xcomp mode with tiered compilation disabled,
                see NonTieredCompPolicy::is_mature */
-            Asserts.assertEQ(isMature, !(IS_XCOMP && !TIERED),
+            Asserts.assertEQ(isMature, !(Platform.isComp() && !TIERED),
                     "Unexpected isMature state for multiple times invoked method");
         }
     }
--- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java	Wed Jul 13 18:03:15 2016 +0300
@@ -41,22 +41,21 @@
 
 import java.util.function.IntPredicate;
 import compiler.whitebox.CompilerWhiteBoxTest;
+import jdk.test.lib.Platform;
 
 public class NonTieredLevelsTest extends CompLevelsTest {
     private static final int AVAILABLE_COMP_LEVEL;
     private static final IntPredicate IS_AVAILABLE_COMPLEVEL;
     static {
-        String vmName = System.getProperty("java.vm.name");
-        if (vmName.endsWith(" Server VM")) {
+        if (Platform.isServer()) {
             AVAILABLE_COMP_LEVEL = COMP_LEVEL_FULL_OPTIMIZATION;
             IS_AVAILABLE_COMPLEVEL = x -> x == COMP_LEVEL_FULL_OPTIMIZATION;
-        } else if (vmName.endsWith(" Client VM")
-                || vmName.endsWith(" Minimal VM")) {
+        } else if (Platform.isClient() || Platform.isMinimal()) {
             AVAILABLE_COMP_LEVEL = COMP_LEVEL_SIMPLE;
             IS_AVAILABLE_COMPLEVEL = x -> x >= COMP_LEVEL_SIMPLE
                     && x <= COMP_LEVEL_FULL_PROFILE;
         } else {
-            throw new RuntimeException("Unknown VM: " + vmName);
+            throw new Error("TESTBUG: unknown VM: " + Platform.vmName);
         }
 
     }
--- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java	Wed Jul 13 18:03:15 2016 +0300
@@ -25,9 +25,11 @@
  * @test CorrectnessTest
  * @bug 8038418
  * @summary Tests correctness of type usage with type profiling and speculations
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
  * @ignore 8066173
  * @build compiler.types.correctness.CorrectnessTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
@@ -88,7 +90,7 @@
 
     public static void main(String[] args) {
         if (!Platform.isServer()) {
-            System.out.println("ALL TESTS SKIPPED");
+            throw new Error("TESTBUG: Not server VM");
         }
         Asserts.assertGTE(args.length, 1);
         ProfilingType profilingType = ProfilingType.valueOf(args[0]);
--- a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java	Wed Jul 13 18:03:15 2016 +0300
@@ -28,7 +28,7 @@
  * @summary tests on constant folding of unsafe get operations
  * @library /testlibrary
  *
- * @requires vm.flavor != "client"
+ * @requires vm.flavor == "server"
  *
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.vm.annotation
@@ -93,11 +93,12 @@
     static final Unsafe U = Unsafe.getUnsafe();
 
     public static void main(String[] args) {
-        if (Platform.isServer()) {
-            testUnsafeGetAddress();
-            testUnsafeGetField();
-            testUnsafeGetFieldUnaligned();
+        if (!Platform.isServer()) {
+            throw new Error("TESTBUG: Not server VM");
         }
+        testUnsafeGetAddress();
+        testUnsafeGetField();
+        testUnsafeGetFieldUnaligned();
         System.out.println("TEST PASSED");
     }
 
--- a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java	Wed Jul 13 18:03:15 2016 +0300
@@ -28,7 +28,7 @@
  * @summary tests on constant folding of unsafe get operations from stable arrays
  * @library /testlibrary
  *
- * @requires vm.flavor != "client"
+ * @requires vm.flavor == "server"
  *
  * @modules java.base/jdk.internal.vm.annotation
  *          java.base/jdk.internal.misc
@@ -332,9 +332,10 @@
     }
 
     public static void main(String[] args) throws Exception {
-        if (Platform.isServer()) {
-            testUnsafeAccess();
+        if (!Platform.isServer()) {
+            throw new Error("TESTBUG: Not server VM");
         }
+        testUnsafeAccess();
         System.out.println("TEST PASSED");
     }
 }
--- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java	Wed Jul 13 18:03:15 2016 +0300
@@ -23,6 +23,7 @@
 
 package compiler.whitebox;
 
+import jdk.test.lib.Platform;
 import sun.hotspot.WhiteBox;
 import sun.hotspot.code.NMethod;
 
@@ -33,6 +34,7 @@
 
 /**
  * Abstract class for WhiteBox testing of JIT.
+ * Depends on jdk.test.lib.Platform from testlibrary.
  *
  * @author igor.ignatyev@oracle.com
  */
@@ -75,8 +77,6 @@
     public static final int THRESHOLD;
     /** invocation count to trigger OSR compilation */
     protected static final long BACKEDGE_THRESHOLD;
-    /** Value of {@code java.vm.info} (interpreted|mixed|comp mode) */
-    protected static final String MODE = System.getProperty("java.vm.info");
 
     static {
         if (TIERED_COMPILATION) {
@@ -165,10 +165,8 @@
      * @see #test()
      */
     protected final void runTest() {
-        if (CompilerWhiteBoxTest.MODE.startsWith("interpreted ")) {
-            System.err.println(
-                    "Warning: test is not applicable in interpreted mode");
-            return;
+        if (Platform.isInt()) {
+            throw new Error("TESTBUG: test can not be run in interpreter");
         }
         System.out.println("at test's start:");
         printInfo();
@@ -431,11 +429,10 @@
      *          Xcomp, otherwise {@code false}
      */
     protected boolean skipXcompOSR() {
-        boolean result =  testCase.isOsr()
-                && CompilerWhiteBoxTest.MODE.startsWith("compiled ");
+        boolean result = testCase.isOsr() && Platform.isComp();
         if (result && IS_VERBOSE) {
             System.err.printf("Warning: %s is not applicable in %s%n",
-                    testCase.name(), CompilerWhiteBoxTest.MODE);
+                    testCase.name(), Platform.vmInfo);
         }
         return result;
     }
--- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Wed Jul 13 18:03:15 2016 +0300
@@ -25,9 +25,11 @@
  * @test IsMethodCompilableTest
  * @bug 8007270 8006683 8007288 8022832
  * @summary testing of WB::isMethodCompilable()
+ * @requires vm.flavor == "server"
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *
  * @build jdk.test.lib.*
  *        sun.hotspot.WhiteBox
  * @build compiler.whitebox.IsMethodCompilableTest
@@ -84,7 +86,7 @@
 
         // Only c2 compilations can be disabled through PerMethodRecompilationCutoff
         if (!Platform.isServer()) {
-            return;
+            throw new Error("TESTBUG: Not server VM");
         }
 
         if (skipXcompOSR()) {
--- a/hotspot/test/testlibrary/jdk/test/lib/Platform.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/testlibrary/jdk/test/lib/Platform.java	Wed Jul 13 18:03:15 2016 +0300
@@ -31,12 +31,13 @@
  */
 @Deprecated
 public class Platform {
+    public  static final String vmName      = System.getProperty("java.vm.name");
+    public  static final String vmInfo      = System.getProperty("java.vm.info");
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
     private static final String vmVersion   = System.getProperty("java.vm.version");
     private static final String jdkDebug    = System.getProperty("jdk.debug");
     private static final String osArch      = System.getProperty("os.arch");
-    private static final String vmName      = System.getProperty("java.vm.name");
     private static final String userName    = System.getProperty("user.name");
     private static final String compiler    = System.getProperty("sun.management.compiler");
 
@@ -68,6 +69,18 @@
         return compiler.contains("Tiered Compilers");
     }
 
+    public static boolean isInt() {
+        return vmInfo.contains("interpreted");
+    }
+
+    public static boolean isMixed() {
+        return vmInfo.contains("mixed");
+    }
+
+    public static boolean isComp() {
+        return vmInfo.contains("compiled");
+    }
+
     public static boolean is32bit() {
         return dataModel.equals("32");
     }
--- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Thu Jul 14 08:33:08 2016 +0200
+++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Wed Jul 13 18:03:15 2016 +0300
@@ -49,6 +49,7 @@
         BITNESS("is32bit", "is64bit"),
         OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"),
         VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero"),
+        MODE("isInt", "isMixed", "isComp"),
         IGNORED("isEmbedded", "isDebugBuild", "shouldSAAttach",
                 "canPtraceAttachLinux", "canAttachOSX", "isTieredSupported");