test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java

test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java

Print this page
rev 10231 : 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
Summary: Add whitebox for checking available compilers
Reviewed-by:

*** 27,41 **** * @library /testlibrary /test/lib * @modules java.base/sun.misc * java.compiler * java.management * @build jdk.test.lib.* ! * @build jdk.test.lib.dcmd.* ! * @build sun.hotspot.WhiteBox ! * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission ! * @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestCompilerDirectivesCompatibilityBase * @summary Test compiler control compatibility with compile command */ import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor; --- 27,41 ---- * @library /testlibrary /test/lib * @modules java.base/sun.misc * java.compiler * java.management * @build jdk.test.lib.* ! * jdk.test.lib.dcmd.* ! * sun.hotspot.WhiteBox ! * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission ! * @run testng/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestCompilerDirectivesCompatibilityBase * @summary Test compiler control compatibility with compile command */ import jdk.test.lib.dcmd.CommandExecutor; import jdk.test.lib.dcmd.JMXExecutor;
*** 62,97 **** control_on = System.getProperty("test.src", ".") + File.separator + "control_on.txt"; control_off = System.getProperty("test.src", ".") + File.separator + "control_off.txt"; method = getMethod(TestCompilerDirectivesCompatibilityBase.class, "helper"); nomatch = getMethod(TestCompilerDirectivesCompatibilityBase.class, "another"); ! testCompatibility(executor); } ! public void testCompatibility(CommandExecutor executor) throws Exception { // Call all validation twice to catch error when overwriting a directive // Flag is default off expect(!WB.getBooleanVMFlag("PrintAssembly")); ! expect(!WB.shouldPrintAssembly(method)); ! expect(!WB.shouldPrintAssembly(nomatch)); ! expect(!WB.shouldPrintAssembly(method)); ! expect(!WB.shouldPrintAssembly(nomatch)); // load directives that turn it on executor.execute("Compiler.directives_add " + control_on); ! expect(WB.shouldPrintAssembly(method)); ! expect(!WB.shouldPrintAssembly(nomatch)); ! expect(WB.shouldPrintAssembly(method)); ! expect(!WB.shouldPrintAssembly(nomatch)); // remove and see that it is true again executor.execute("Compiler.directives_remove"); ! expect(!WB.shouldPrintAssembly(method)); ! expect(!WB.shouldPrintAssembly(nomatch)); ! expect(!WB.shouldPrintAssembly(method)); ! expect(!WB.shouldPrintAssembly(nomatch)); } public void expect(boolean test) throws Exception { if (!test) { throw new Exception("Test failed"); --- 62,105 ---- control_on = System.getProperty("test.src", ".") + File.separator + "control_on.txt"; control_off = System.getProperty("test.src", ".") + File.separator + "control_off.txt"; method = getMethod(TestCompilerDirectivesCompatibilityBase.class, "helper"); nomatch = getMethod(TestCompilerDirectivesCompatibilityBase.class, "another"); ! final int COMPLEVEL_SIMPLE = 1; ! final int COMPLEVEL_FULL = 4; ! ! if (WB.hasC1Compiler()) { ! testCompatibility(executor, COMPLEVEL_SIMPLE); ! } ! if (WB.hasC2Compiler()) { ! testCompatibility(executor, COMPLEVEL_FULL); ! } } ! public void testCompatibility(CommandExecutor executor, int comp_level) throws Exception { // Call all validation twice to catch error when overwriting a directive // Flag is default off expect(!WB.getBooleanVMFlag("PrintAssembly")); ! expect(!WB.shouldPrintAssembly(method, comp_level)); ! expect(!WB.shouldPrintAssembly(nomatch, comp_level)); ! expect(!WB.shouldPrintAssembly(method, comp_level)); ! expect(!WB.shouldPrintAssembly(nomatch, comp_level)); // load directives that turn it on executor.execute("Compiler.directives_add " + control_on); ! expect(WB.shouldPrintAssembly(method, comp_level)); ! expect(!WB.shouldPrintAssembly(nomatch, comp_level)); ! expect(WB.shouldPrintAssembly(method, comp_level)); ! expect(!WB.shouldPrintAssembly(nomatch, comp_level)); // remove and see that it is true again executor.execute("Compiler.directives_remove"); ! expect(!WB.shouldPrintAssembly(method, comp_level)); ! expect(!WB.shouldPrintAssembly(nomatch, comp_level)); ! expect(!WB.shouldPrintAssembly(method, comp_level)); ! expect(!WB.shouldPrintAssembly(nomatch, comp_level)); } public void expect(boolean test) throws Exception { if (!test) { throw new Exception("Test failed");
test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File