test/runtime/contended/Options.java

Sat, 11 Jan 2014 17:18:22 +0000

author
coffeys
date
Sat, 11 Jan 2014 17:18:22 +0000
changeset 6202
cb2e4b603dcb
parent 0
f90c822e73f8
permissions
-rw-r--r--

Added tag jdk8u20-b00 for changeset c89630a122b4

     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     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  */
    24 import com.oracle.java.testlibrary.*;
    26 /*
    27  * @test
    28  * @bug     8006997
    29  * @summary ContendedPaddingWidth should be range-checked
    30  *
    31  * @library /testlibrary
    32  * @run main Options
    33  */
    34 public class Options {
    36     public static void main(String[] args) throws Exception {
    37         ProcessBuilder pb;
    38         OutputAnalyzer output;
    40         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-128", "-version");
    41         output = new OutputAnalyzer(pb.start());
    42         output.shouldContain("ContendedPaddingWidth");
    43         output.shouldContain("must be in between");
    44         output.shouldHaveExitValue(1);
    46         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-8", "-version");
    47         output = new OutputAnalyzer(pb.start());
    48         output.shouldContain("ContendedPaddingWidth");
    49         output.shouldContain("must be in between");
    50         output.shouldHaveExitValue(1);
    52         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-1", "-version");
    53         output = new OutputAnalyzer(pb.start());
    54         output.shouldContain("ContendedPaddingWidth");
    55         output.shouldContain("must be in between");
    56         output.shouldContain("must be a multiple of 8");
    57         output.shouldHaveExitValue(1);
    59         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=0", "-version");
    60         output = new OutputAnalyzer(pb.start());
    61         output.shouldHaveExitValue(0);
    63         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=1", "-version");
    64         output = new OutputAnalyzer(pb.start());
    65         output.shouldContain("ContendedPaddingWidth");
    66         output.shouldContain("must be a multiple of 8");
    67         output.shouldHaveExitValue(1);
    69         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8", "-version");
    70         output = new OutputAnalyzer(pb.start());
    71         output.shouldHaveExitValue(0);
    73         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8184", "-version"); // 8192-8 = 8184
    74         output = new OutputAnalyzer(pb.start());
    75         output.shouldHaveExitValue(0);
    77         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8191", "-version");
    78         output = new OutputAnalyzer(pb.start());
    79         output.shouldContain("ContendedPaddingWidth");
    80         output.shouldContain("must be a multiple of 8");
    81         output.shouldHaveExitValue(1);
    83         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8192", "-version");
    84         output = new OutputAnalyzer(pb.start());
    85         output.shouldHaveExitValue(0);
    87         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8193", "-version");
    88         output = new OutputAnalyzer(pb.start());
    89         output.shouldContain("ContendedPaddingWidth");
    90         output.shouldContain("must be in between");
    91         output.shouldContain("must be a multiple of 8");
    92         output.shouldHaveExitValue(1);
    94         pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8200", "-version"); // 8192+8 = 8200
    95         output = new OutputAnalyzer(pb.start());
    96         output.shouldContain("ContendedPaddingWidth");
    97         output.shouldContain("must be in between");
    98         output.shouldHaveExitValue(1);
   100    }
   102 }

mercurial