author | naoto |
Tue, 05 Apr 2016 09:13:30 -0700 | |
changeset 36860 | dad1a46b0a88 |
parent 31995 | aa4049b4184a |
child 36851 | 03e2f4d0a421 |
permissions | -rw-r--r-- |
19679 | 1 |
/* |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
19679
diff
changeset
|
2 |
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
19679 | 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 |
*/ |
|
23 |
||
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
29678
diff
changeset
|
24 |
import jdk.test.lib.*; |
19679 | 25 |
|
26 |
/* |
|
27 |
* @test |
|
28 |
* @bug 8006997 |
|
29 |
* @summary ContendedPaddingWidth should be range-checked |
|
30 |
* |
|
31 |
* @library /testlibrary |
|
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
19679
diff
changeset
|
32 |
* @modules java.base/sun.misc |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
19679
diff
changeset
|
33 |
* java.management |
19679 | 34 |
* @run main Options |
35 |
*/ |
|
36 |
public class Options { |
|
37 |
||
38 |
public static void main(String[] args) throws Exception { |
|
39 |
ProcessBuilder pb; |
|
40 |
OutputAnalyzer output; |
|
41 |
||
42 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-128", "-version"); |
|
43 |
output = new OutputAnalyzer(pb.start()); |
|
44 |
output.shouldContain("ContendedPaddingWidth"); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
30604
diff
changeset
|
45 |
output.shouldContain("outside the allowed range"); |
19679 | 46 |
output.shouldHaveExitValue(1); |
47 |
||
48 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-8", "-version"); |
|
49 |
output = new OutputAnalyzer(pb.start()); |
|
50 |
output.shouldContain("ContendedPaddingWidth"); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
30604
diff
changeset
|
51 |
output.shouldContain("outside the allowed range"); |
19679 | 52 |
output.shouldHaveExitValue(1); |
53 |
||
54 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=-1", "-version"); |
|
55 |
output = new OutputAnalyzer(pb.start()); |
|
56 |
output.shouldContain("ContendedPaddingWidth"); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
30604
diff
changeset
|
57 |
output.shouldContain("outside the allowed range"); |
19679 | 58 |
output.shouldHaveExitValue(1); |
59 |
||
60 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=0", "-version"); |
|
61 |
output = new OutputAnalyzer(pb.start()); |
|
62 |
output.shouldHaveExitValue(0); |
|
63 |
||
64 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=1", "-version"); |
|
65 |
output = new OutputAnalyzer(pb.start()); |
|
66 |
output.shouldContain("ContendedPaddingWidth"); |
|
67 |
output.shouldContain("must be a multiple of 8"); |
|
68 |
output.shouldHaveExitValue(1); |
|
69 |
||
70 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8", "-version"); |
|
71 |
output = new OutputAnalyzer(pb.start()); |
|
72 |
output.shouldHaveExitValue(0); |
|
73 |
||
74 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8184", "-version"); // 8192-8 = 8184 |
|
75 |
output = new OutputAnalyzer(pb.start()); |
|
76 |
output.shouldHaveExitValue(0); |
|
77 |
||
78 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8191", "-version"); |
|
79 |
output = new OutputAnalyzer(pb.start()); |
|
80 |
output.shouldContain("ContendedPaddingWidth"); |
|
81 |
output.shouldContain("must be a multiple of 8"); |
|
82 |
output.shouldHaveExitValue(1); |
|
83 |
||
84 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8192", "-version"); |
|
85 |
output = new OutputAnalyzer(pb.start()); |
|
86 |
output.shouldHaveExitValue(0); |
|
87 |
||
88 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8193", "-version"); |
|
89 |
output = new OutputAnalyzer(pb.start()); |
|
90 |
output.shouldContain("ContendedPaddingWidth"); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
30604
diff
changeset
|
91 |
output.shouldContain("outside the allowed range"); |
19679 | 92 |
output.shouldHaveExitValue(1); |
93 |
||
94 |
pb = ProcessTools.createJavaProcessBuilder("-XX:ContendedPaddingWidth=8200", "-version"); // 8192+8 = 8200 |
|
95 |
output = new OutputAnalyzer(pb.start()); |
|
96 |
output.shouldContain("ContendedPaddingWidth"); |
|
31371
311143309e73
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments.
gziemski
parents:
30604
diff
changeset
|
97 |
output.shouldContain("outside the allowed range"); |
19679 | 98 |
output.shouldHaveExitValue(1); |
99 |
||
100 |
} |
|
101 |
||
102 |
} |