test/compiler/arguments/CheckCICompilerCount.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff test/compiler/arguments

test/compiler/arguments/CheckCICompilerCount.java

Print this page
rev 8835 : 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
Summary: TieredCompilation not validated when CICompilerCount is processed
Reviewed-by:


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import jdk.test.lib.*;
  25 
  26 /*
  27  * @test CheckCheckCICompilerCount
  28  * @bug 8130858

  29  * @summary Check that correct range of values for CICompilerCount are allowed depending on whether tiered is enabled or not
  30  * @library /testlibrary
  31  * @modules java.base/sun.misc
  32  *          java.management
  33  * @run main CheckCICompilerCount
  34  */
  35 
  36 public class CheckCICompilerCount {
  37     private static final String[][] NON_TIERED_ARGUMENTS = {
  38         {

  39             "-XX:-TieredCompilation",
  40             "-XX:+PrintFlagsFinal",
  41             "-XX:CICompilerCount=0",
  42             "-version"
  43         },
  44         {















  45             "-XX:-TieredCompilation",
  46             "-XX:+PrintFlagsFinal",
  47             "-XX:CICompilerCount=1",
  48             "-version"
  49         }
  50     };
  51 
  52     private static final String[][] NON_TIERED_EXPECTED_OUTPUTS = {
  53         {
  54             "CICompilerCount=0 must be at least 1",
  55             "Improperly specified VM option 'CICompilerCount=0'"
  56         },
  57         {
  58             "intx CICompilerCount                          := 1                                   {product}"







  59         }
  60     };
  61 
  62     private static final int[] NON_TIERED_EXIT = {
  63         1,


  64         0
  65     };
  66 
  67     private static final String[][] TIERED_ARGUMENTS = {
  68         {

  69             "-XX:+TieredCompilation",
  70             "-XX:+PrintFlagsFinal",
  71             "-XX:CICompilerCount=1",
  72             "-version"
  73         },
  74         {















  75             "-XX:+TieredCompilation",
  76             "-XX:+PrintFlagsFinal",
  77             "-XX:CICompilerCount=2",
  78             "-version"
  79         }
  80     };
  81 
  82     private static final String[][] TIERED_EXPECTED_OUTPUTS = {
  83         {
  84             "CICompilerCount=1 must be at least 2",
  85             "Improperly specified VM option 'CICompilerCount=1'"
  86         },
  87         {
  88             "intx CICompilerCount                          := 2                                   {product}"







  89         }
  90     };
  91 
  92     private static final int[] TIERED_EXIT = {


  93         1,
  94         0
  95     };
  96 
  97     private static void verifyValidOption(String[] arguments, String[] expected_outputs, int exit, boolean tiered) throws Exception {
  98         ProcessBuilder pb;
  99         OutputAnalyzer out;
 100 
 101         pb = ProcessTools.createJavaProcessBuilder(arguments);
 102         out = new OutputAnalyzer(pb.start());
 103 
 104         try {
 105             out.shouldHaveExitValue(exit);
 106             for (String expected_output : expected_outputs) {
 107                 out.shouldContain(expected_output);
 108             }
 109         } catch (RuntimeException e) {
 110             // Check if tiered compilation is available in this JVM
 111             // Version. Throw exception only if it is available.
 112             if (!(tiered && out.getOutput().contains("TieredCompilation is disabled in this release."))) {




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import jdk.test.lib.*;
  25 
  26 /*
  27  * @test CheckCheckCICompilerCount
  28  * @bug 8130858
  29  * @bug 8132525
  30  * @summary Check that correct range of values for CICompilerCount are allowed depending on whether tiered is enabled or not
  31  * @library /testlibrary
  32  * @modules java.base/sun.misc
  33  *          java.management
  34  * @run main CheckCICompilerCount
  35  */
  36 
  37 public class CheckCICompilerCount {
  38     private static final String[][] NON_TIERED_ARGUMENTS = {
  39         {
  40             "-server",
  41             "-XX:-TieredCompilation",
  42             "-XX:+PrintFlagsFinal",
  43             "-XX:CICompilerCount=0",
  44             "-version"
  45         },
  46         {
  47             "-server",
  48             "-XX:-TieredCompilation",
  49             "-XX:+PrintFlagsFinal",
  50             "-XX:CICompilerCount=1",
  51             "-version"
  52         },
  53         {
  54             "-client",
  55             "-XX:-TieredCompilation",
  56             "-XX:+PrintFlagsFinal",
  57             "-XX:CICompilerCount=0",
  58             "-version"
  59         },
  60         {
  61             "-client",
  62             "-XX:-TieredCompilation",
  63             "-XX:+PrintFlagsFinal",
  64             "-XX:CICompilerCount=1",
  65             "-version"
  66         }
  67     };
  68 
  69     private static final String[][] NON_TIERED_EXPECTED_OUTPUTS = {
  70         {
  71             "CICompilerCount=0 must be at least 1",
  72             "Improperly specified VM option 'CICompilerCount=0'"
  73         },
  74         {
  75             "intx CICompilerCount                          := 1                                   {product}"
  76         },
  77         {
  78             "CICompilerCount=0 must be at least 1",
  79             "Improperly specified VM option 'CICompilerCount=0'"
  80         },
  81         {
  82             "intx CICompilerCount                          := 1                                   {product}"
  83         }
  84     };
  85 
  86     private static final int[] NON_TIERED_EXIT = {
  87         1,
  88         0,
  89         1,
  90         0
  91     };
  92 
  93     private static final String[][] TIERED_ARGUMENTS = {
  94         {
  95             "-server",
  96             "-XX:+TieredCompilation",
  97             "-XX:+PrintFlagsFinal",
  98             "-XX:CICompilerCount=1",
  99             "-version"
 100         },
 101         {
 102             "-server",
 103             "-XX:+TieredCompilation",
 104             "-XX:+PrintFlagsFinal",
 105             "-XX:CICompilerCount=2",
 106             "-version"
 107         },
 108         {
 109             "-client",
 110             "-XX:+TieredCompilation",
 111             "-XX:+PrintFlagsFinal",
 112             "-XX:CICompilerCount=1",
 113             "-version"
 114         },
 115         {
 116             "-client",
 117             "-XX:+TieredCompilation",
 118             "-XX:+PrintFlagsFinal",
 119             "-XX:CICompilerCount=2",
 120             "-version"
 121         }
 122     };
 123 
 124     private static final String[][] TIERED_EXPECTED_OUTPUTS = {
 125         {
 126             "CICompilerCount=1 must be at least 2",
 127             "Improperly specified VM option 'CICompilerCount=1'"
 128         },
 129         {
 130             "intx CICompilerCount                          := 2                                   {product}"
 131         },
 132         {
 133             "CICompilerCount=1 must be at least 2",
 134             "Improperly specified VM option 'CICompilerCount=1'"
 135         },
 136         {
 137             "intx CICompilerCount                          := 2                                   {product}"
 138         }
 139     };
 140 
 141     private static final int[] TIERED_EXIT = {
 142         1,
 143         0,
 144         1,
 145         0
 146     };
 147 
 148     private static void verifyValidOption(String[] arguments, String[] expected_outputs, int exit, boolean tiered) throws Exception {
 149         ProcessBuilder pb;
 150         OutputAnalyzer out;
 151 
 152         pb = ProcessTools.createJavaProcessBuilder(arguments);
 153         out = new OutputAnalyzer(pb.start());
 154 
 155         try {
 156             out.shouldHaveExitValue(exit);
 157             for (String expected_output : expected_outputs) {
 158                 out.shouldContain(expected_output);
 159             }
 160         } catch (RuntimeException e) {
 161             // Check if tiered compilation is available in this JVM
 162             // Version. Throw exception only if it is available.
 163             if (!(tiered && out.getOutput().contains("TieredCompilation is disabled in this release."))) {


test/compiler/arguments/CheckCICompilerCount.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File