author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 55618 | 978b2201984c |
permissions | -rw-r--r-- |
55283 | 1 |
/* |
2 |
* Copyright (c) 2019, 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 |
*/ |
|
23 |
||
24 |
package gc.arguments; |
|
25 |
||
26 |
/* |
|
27 |
* @test TestSoftMaxHeapSizeFlag |
|
28 |
* @key gc |
|
29 |
* @library /test/lib |
|
30 |
* @modules java.base/jdk.internal.misc |
|
31 |
* java.management |
|
32 |
* @run main/othervm gc.arguments.TestSoftMaxHeapSizeFlag |
|
33 |
*/ |
|
34 |
||
35 |
import jdk.test.lib.process.ProcessTools; |
|
36 |
||
37 |
public class TestSoftMaxHeapSizeFlag { |
|
55618
978b2201984c
8226302: Test failures on IBM platforms (power and s/390) after JDK-8223837
mdoerr
parents:
55283
diff
changeset
|
38 |
// Note: Xms and Xmx values get aligned up by HeapAlignment which is 32M with 64k pages. |
978b2201984c
8226302: Test failures on IBM platforms (power and s/390) after JDK-8223837
mdoerr
parents:
55283
diff
changeset
|
39 |
private static final long Xms = 224 * 1024 * 1024; |
978b2201984c
8226302: Test failures on IBM platforms (power and s/390) after JDK-8223837
mdoerr
parents:
55283
diff
changeset
|
40 |
private static final long Xmx = 320 * 1024 * 1024; |
55283 | 41 |
private static final long greaterThanXmx = Xmx + 1; |
42 |
private static final long betweenXmsAndXmx = (Xms + Xmx) / 2; |
|
43 |
||
44 |
public static void main(String args[]) throws Exception { |
|
45 |
// Test default value |
|
46 |
ProcessTools.executeTestJvm(new String[]{ "-Xms" + Xms, "-Xmx" + Xmx, |
|
47 |
"-XX:+PrintFlagsFinal", "-version" }) |
|
48 |
.shouldMatch("SoftMaxHeapSize[ ]+=[ ]+" + Xmx) |
|
49 |
.shouldHaveExitValue(0); |
|
50 |
||
51 |
// Test setting small value |
|
52 |
ProcessTools.executeTestJvm(new String[]{ "-Xms" + Xms, "-Xmx" + Xmx, |
|
53 |
"-XX:SoftMaxHeapSize=" + Xms, |
|
54 |
"-XX:+PrintFlagsFinal", "-version" }) |
|
55 |
.shouldMatch("SoftMaxHeapSize[ ]+=[ ]+" + Xms) |
|
56 |
.shouldHaveExitValue(0); |
|
57 |
||
58 |
// Test setting middle value |
|
59 |
ProcessTools.executeTestJvm(new String[]{ "-Xms" + Xms, "-Xmx" + Xmx, |
|
60 |
"-XX:SoftMaxHeapSize=" + betweenXmsAndXmx, |
|
61 |
"-XX:+PrintFlagsFinal", "-version" }) |
|
62 |
.shouldMatch("SoftMaxHeapSize[ ]+=[ ]+" + betweenXmsAndXmx) |
|
63 |
.shouldHaveExitValue(0); |
|
64 |
||
65 |
// Test setting largest value |
|
66 |
ProcessTools.executeTestJvm(new String[]{ "-Xms" + Xms, "-Xmx" + Xmx, |
|
67 |
"-XX:SoftMaxHeapSize=" + Xmx, |
|
68 |
"-XX:+PrintFlagsFinal", "-version" }) |
|
69 |
.shouldMatch("SoftMaxHeapSize[ ]+=[ ]+" + Xmx) |
|
70 |
.shouldHaveExitValue(0); |
|
71 |
||
72 |
// Test setting a too large value |
|
73 |
ProcessTools.executeTestJvm(new String[]{ "-Xms" + Xms, "-Xmx" + Xmx, |
|
74 |
"-XX:SoftMaxHeapSize=" + greaterThanXmx, |
|
75 |
"-XX:+PrintFlagsFinal", "-version" }) |
|
76 |
.shouldContain("SoftMaxHeapSize must be less than or equal to the maximum heap size") |
|
77 |
.shouldHaveExitValue(1); |
|
78 |
} |
|
79 |
} |