8157984: [TESTBUG] Several compiler tests fails when are executed with -XX:TieredStopAtLevel=1
Reviewed-by: vlivanov
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java Thu Jul 14 14:44:53 2016 +0000
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java Thu Jul 14 20:10:16 2016 +0300
@@ -28,7 +28,6 @@
* @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
- * @ignore 8157984
* @build compiler.rangechecks.TestRangeCheckSmearing
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* jdk.test.lib.Platform
@@ -41,6 +40,7 @@
package compiler.rangechecks;
import compiler.whitebox.CompilerWhiteBoxTest;
+import compiler.testlibrary.CompilerUtils;
import jdk.test.lib.Platform;
import sun.hotspot.WhiteBox;
@@ -402,7 +402,7 @@
System.out.println("ArrayIndexOutOfBoundsException was not thrown in "+name);
}
- if (Platform.isServer()) {
+ if (CompilerUtils.getMaxCompilationLevel() == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) {
if (exceptionRequired == WHITE_BOX.isMethodCompiled(m)) {
System.out.println((exceptionRequired?"Didn't deoptimized":"deoptimized") + " in "+name);
test_success = false;
--- a/hotspot/test/compiler/testlibrary/CompilerUtils.java Thu Jul 14 14:44:53 2016 +0000
+++ b/hotspot/test/compiler/testlibrary/CompilerUtils.java Thu Jul 14 20:10:16 2016 +0300
@@ -23,6 +23,7 @@
package compiler.testlibrary;
+import java.util.Arrays;
import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
import sun.hotspot.WhiteBox;
@@ -61,4 +62,14 @@
}
return new int[0];
}
+
+ /**
+ * Returns maximum compilation level available
+ * @return an int value representing maximum compilation level available
+ */
+ public static int getMaxCompilationLevel() {
+ return Arrays.stream(getAvailableCompilationLevels())
+ .max()
+ .getAsInt();
+ }
}
--- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java Thu Jul 14 14:44:53 2016 +0000
+++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java Thu Jul 14 20:10:16 2016 +0300
@@ -27,7 +27,7 @@
* @library /testlibrary /test/lib /
* @modules java.base/jdk.internal.misc
* java.management
- * @ignore 8157984
+ * @requires vm.opt.TieredStopAtLevel==null
* @build compiler.tiered.NonTieredLevelsTest
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission