hotspot/test/compiler/arguments/CheckCICompilerCount.java
author chegar
Tue, 22 Mar 2016 15:26:07 +0000
changeset 36694 182a5e7a519e
parent 32585 cffadc776803
child 37253 45e69c7b0bac
child 36851 03e2f4d0a421
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
     1
/*
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
     4
 *
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
     8
 *
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    13
 * accompanied this code).
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    14
 *
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    18
 *
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    21
 * questions.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    22
 */
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    23
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    24
import jdk.test.lib.*;
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    25
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    26
/*
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    27
 * @test CheckCheckCICompilerCount
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    28
 * @bug 8130858
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    29
 * @bug 8132525
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    30
 * @summary Check that correct range of values for CICompilerCount are allowed depending on whether tiered is enabled or not
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    31
 * @library /testlibrary
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    32
 * @modules java.base/sun.misc
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    33
 *          java.management
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    34
 * @run main CheckCICompilerCount
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    35
 */
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    36
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    37
public class CheckCICompilerCount {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    38
    private static final String[][] NON_TIERED_ARGUMENTS = {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    39
        {
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    40
            "-server",
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    41
            "-XX:-TieredCompilation",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    42
            "-XX:+PrintFlagsFinal",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    43
            "-XX:CICompilerCount=0",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    44
            "-version"
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    45
        },
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    46
        {
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    47
            "-server",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    48
            "-XX:-TieredCompilation",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    49
            "-XX:+PrintFlagsFinal",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    50
            "-XX:CICompilerCount=1",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    51
            "-version"
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    52
        },
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    53
        {
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    54
            "-client",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    55
            "-XX:-TieredCompilation",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    56
            "-XX:+PrintFlagsFinal",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    57
            "-XX:CICompilerCount=0",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    58
            "-version"
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    59
        },
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    60
        {
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    61
            "-client",
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    62
            "-XX:-TieredCompilation",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    63
            "-XX:+PrintFlagsFinal",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    64
            "-XX:CICompilerCount=1",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    65
            "-version"
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    66
        }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    67
    };
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    68
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    69
    private static final String[][] NON_TIERED_EXPECTED_OUTPUTS = {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    70
        {
32365
5ac17a803e1c 8133678: test fails due to 'CICompilerCount=0 must be at least 1' missing from stdout/stderr
gziemski
parents: 32083
diff changeset
    71
            "CICompilerCount (0) must be at least 1",
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    72
            "Improperly specified VM option 'CICompilerCount=0'"
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    73
        },
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    74
        {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    75
            "intx CICompilerCount                          := 1                                   {product}"
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    76
        },
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    77
        {
32585
cffadc776803 8134239: compiler/arguments/CheckCICompilerCount.java still fails
gziemski
parents: 32365
diff changeset
    78
            "CICompilerCount (0) must be at least 1",
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    79
            "Improperly specified VM option 'CICompilerCount=0'"
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    80
        },
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    81
        {
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    82
            "intx CICompilerCount                          := 1                                   {product}"
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    83
        }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    84
    };
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    85
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    86
    private static final int[] NON_TIERED_EXIT = {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    87
        1,
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    88
        0,
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    89
        1,
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    90
        0
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    91
    };
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    92
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    93
    private static final String[][] TIERED_ARGUMENTS = {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    94
        {
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
    95
            "-server",
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    96
            "-XX:+TieredCompilation",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    97
            "-XX:+PrintFlagsFinal",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    98
            "-XX:CICompilerCount=1",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
    99
            "-version"
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   100
        },
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   101
        {
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   102
            "-server",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   103
            "-XX:+TieredCompilation",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   104
            "-XX:+PrintFlagsFinal",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   105
            "-XX:CICompilerCount=2",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   106
            "-version"
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   107
        },
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   108
        {
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   109
            "-client",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   110
            "-XX:+TieredCompilation",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   111
            "-XX:+PrintFlagsFinal",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   112
            "-XX:CICompilerCount=1",
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   113
            "-version"
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   114
        },
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   115
        {
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   116
            "-client",
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   117
            "-XX:+TieredCompilation",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   118
            "-XX:+PrintFlagsFinal",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   119
            "-XX:CICompilerCount=2",
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   120
            "-version"
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   121
        }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   122
    };
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   123
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   124
    private static final String[][] TIERED_EXPECTED_OUTPUTS = {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   125
        {
32365
5ac17a803e1c 8133678: test fails due to 'CICompilerCount=0 must be at least 1' missing from stdout/stderr
gziemski
parents: 32083
diff changeset
   126
            "CICompilerCount (1) must be at least 2",
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   127
            "Improperly specified VM option 'CICompilerCount=1'"
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   128
        },
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   129
        {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   130
            "intx CICompilerCount                          := 2                                   {product}"
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   131
        },
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   132
        {
32585
cffadc776803 8134239: compiler/arguments/CheckCICompilerCount.java still fails
gziemski
parents: 32365
diff changeset
   133
            "CICompilerCount (1) must be at least 2",
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   134
            "Improperly specified VM option 'CICompilerCount=1'"
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   135
        },
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   136
        {
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   137
            "intx CICompilerCount                          := 2                                   {product}"
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   138
        }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   139
    };
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   140
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   141
    private static final int[] TIERED_EXIT = {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   142
        1,
32083
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   143
        0,
1796911eb140 8132525: java -client -XX:+TieredCompilation -XX:CICompilerCount=1 -version asserts since 8130858
roland
parents: 31959
diff changeset
   144
        1,
31959
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   145
        0
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   146
    };
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   147
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   148
    private static void verifyValidOption(String[] arguments, String[] expected_outputs, int exit, boolean tiered) throws Exception {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   149
        ProcessBuilder pb;
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   150
        OutputAnalyzer out;
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   151
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   152
        pb = ProcessTools.createJavaProcessBuilder(arguments);
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   153
        out = new OutputAnalyzer(pb.start());
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   154
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   155
        try {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   156
            out.shouldHaveExitValue(exit);
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   157
            for (String expected_output : expected_outputs) {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   158
                out.shouldContain(expected_output);
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   159
            }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   160
        } catch (RuntimeException e) {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   161
            // Check if tiered compilation is available in this JVM
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   162
            // Version. Throw exception only if it is available.
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   163
            if (!(tiered && out.getOutput().contains("TieredCompilation is disabled in this release."))) {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   164
                throw new RuntimeException(e);
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   165
            }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   166
        }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   167
    }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   168
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   169
    public static void main(String[] args) throws Exception {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   170
        if (NON_TIERED_ARGUMENTS.length != NON_TIERED_EXPECTED_OUTPUTS.length || NON_TIERED_ARGUMENTS.length != NON_TIERED_EXIT.length) {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   171
            throw new RuntimeException("Test is set up incorrectly: length of arguments, expected outputs and exit codes in non-tiered mode of operation do not match.");
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   172
        }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   173
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   174
        if (TIERED_ARGUMENTS.length != TIERED_EXPECTED_OUTPUTS.length || TIERED_ARGUMENTS.length != TIERED_EXIT.length) {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   175
            throw new RuntimeException("Test is set up incorrectly: length of arguments, expected outputs and exit codes in tiered mode of operation do not match.");
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   176
        }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   177
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   178
        for (int i = 0; i < NON_TIERED_ARGUMENTS.length; i++) {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   179
            verifyValidOption(NON_TIERED_ARGUMENTS[i], NON_TIERED_EXPECTED_OUTPUTS[i], NON_TIERED_EXIT[i], false);
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   180
        }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   181
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   182
        for (int i = 0; i < TIERED_ARGUMENTS.length; i++) {
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   183
            verifyValidOption(TIERED_ARGUMENTS[i], TIERED_EXPECTED_OUTPUTS[i], TIERED_EXIT[i], true);
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   184
        }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   185
    }
34180370555e 8130858: CICompilerCount=1 when tiered is off is not allowed any more
roland
parents:
diff changeset
   186
}