hotspot/test/runtime/contended/Options.java
author duke
Wed, 05 Jul 2017 20:01:44 +0200
changeset 26660 5e174bbfc03a
parent 19679 23a7ef6ca0f9
child 29678 dd2f3932c21e
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19679
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
     1
/*
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
     4
 *
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
     7
 * published by the Free Software Foundation.
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
     8
 *
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    13
 * accompanied this code).
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    14
 *
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    18
 *
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    21
 * questions.
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    22
 */
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    23
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    24
import com.oracle.java.testlibrary.*;
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    25
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    26
/*
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    27
 * @test
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    28
 * @bug     8006997
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    29
 * @summary ContendedPaddingWidth should be range-checked
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    30
 *
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    31
 * @library /testlibrary
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    32
 * @run main Options
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    33
 */
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    34
public class Options {
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    35
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    36
    public static void main(String[] args) throws Exception {
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    37
        ProcessBuilder pb;
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    38
        OutputAnalyzer output;
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    39
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    40
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-128", "-version");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    41
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    42
        output.shouldContain("ContendedPaddingWidth");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    43
        output.shouldContain("must be in between");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    44
        output.shouldHaveExitValue(1);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    45
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    46
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-8", "-version");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    47
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    48
        output.shouldContain("ContendedPaddingWidth");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    49
        output.shouldContain("must be in between");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    50
        output.shouldHaveExitValue(1);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    51
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    52
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-1", "-version");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    53
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    54
        output.shouldContain("ContendedPaddingWidth");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    55
        output.shouldContain("must be in between");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    56
        output.shouldContain("must be a multiple of 8");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    57
        output.shouldHaveExitValue(1);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    58
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    59
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=0", "-version");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    60
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    61
        output.shouldHaveExitValue(0);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    62
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    63
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=1", "-version");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    64
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    65
        output.shouldContain("ContendedPaddingWidth");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    66
        output.shouldContain("must be a multiple of 8");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    67
        output.shouldHaveExitValue(1);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    68
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    69
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8", "-version");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    70
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    71
        output.shouldHaveExitValue(0);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    72
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    73
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8184", "-version"); // 8192-8 = 8184
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    74
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    75
        output.shouldHaveExitValue(0);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    76
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    77
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8191", "-version");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    78
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    79
        output.shouldContain("ContendedPaddingWidth");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    80
        output.shouldContain("must be a multiple of 8");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    81
        output.shouldHaveExitValue(1);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    82
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    83
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8192", "-version");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    84
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    85
        output.shouldHaveExitValue(0);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    86
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    87
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8193", "-version");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    88
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    89
        output.shouldContain("ContendedPaddingWidth");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    90
        output.shouldContain("must be in between");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    91
        output.shouldContain("must be a multiple of 8");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    92
        output.shouldHaveExitValue(1);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    93
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    94
        pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8200", "-version"); // 8192+8 = 8200
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    95
        output = new OutputAnalyzer(pb.start());
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    96
        output.shouldContain("ContendedPaddingWidth");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    97
        output.shouldContain("must be in between");
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    98
        output.shouldHaveExitValue(1);
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
    99
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
   100
   }
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
   101
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
   102
}
23a7ef6ca0f9 8023638: Add the regression test for 8006997
shade
parents:
diff changeset
   103