hotspot/test/gc/arguments/TestInitialTenuringThreshold.java
author sangheki
Wed, 02 Sep 2015 17:49:46 -0700
changeset 32613 73bec9f941d7
parent 32601 c5df671276bd
child 33144 c56850e328fc
permissions -rw-r--r--
8134972: [BACKOUT] GC: implement ranges (optionally constraints) for those flags that have them missing Reviewed-by: jwilhelm
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17397
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
     1
/*
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 23506
diff changeset
     2
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
17397
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
     3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
     4
*
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
     5
* This code is free software; you can redistribute it and/or modify it
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
     6
* under the terms of the GNU General Public License version 2 only, as
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
     7
* published by the Free Software Foundation.
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
     8
*
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
     9
* This code is distributed in the hope that it will be useful, but WITHOUT
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    11
* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    12
* version 2 for more details (a copy is included in the LICENSE file that
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    13
* accompanied this code).
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    14
*
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    15
* You should have received a copy of the GNU General Public License version
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    16
* 2 along with this work; if not, write to the Free Software Foundation,
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    18
*
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    20
* or visit www.oracle.com if you need additional information or have any
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    21
* questions.
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    22
*/
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    23
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    24
/*
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    25
 * @test TestInitialTenuringThreshold
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    26
 * @key gc
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    27
 * @bug 8014765
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    28
 * @summary Tests argument processing for initial tenuring threshold
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    29
 * @library /testlibrary
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 23506
diff changeset
    30
 * @modules java.base/sun.misc
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 23506
diff changeset
    31
 *          java.management
17397
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    32
 * @run main/othervm TestInitialTenuringThreshold
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    33
 * @author thomas.schatzl@oracle.com
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    34
 */
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    35
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 30169
diff changeset
    36
import jdk.test.lib.*;
17397
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    37
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    38
public class TestInitialTenuringThreshold {
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    39
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    40
  public static void runWithThresholds(int initial, int max, boolean shouldfail) throws Exception {
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    41
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    42
      "-XX:InitialTenuringThreshold=" + String.valueOf(initial),
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    43
      "-XX:MaxTenuringThreshold=" + String.valueOf(max),
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    44
      "-version"
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    45
      );
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    46
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    47
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    48
    if (shouldfail) {
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    49
      output.shouldHaveExitValue(1);
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    50
    } else {
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    51
      output.shouldHaveExitValue(0);
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    52
    }
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    53
  }
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    54
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    55
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    56
  public static void main(String args[]) throws Exception {
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    57
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    58
      // some value below the default value of InitialTenuringThreshold of 7
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    59
      "-XX:MaxTenuringThreshold=1",
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    60
      "-version"
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    61
      );
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    62
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    63
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    64
    output.shouldHaveExitValue(0);
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    65
    // successful tests
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    66
    runWithThresholds(0, 10, false);
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    67
    runWithThresholds(5, 5, false);
23506
9b98355e9060 6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents: 17397
diff changeset
    68
    runWithThresholds(8, 16, false);
17397
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    69
    // failing tests
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    70
    runWithThresholds(10, 0, true);
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    71
    runWithThresholds(9, 8, true);
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    72
    runWithThresholds(-1, 8, true);
30169
736fe315ddcb 8076311: Java 9 process negative MaxTenuringThreshold in different way than Java 8
ddmitriev
parents: 29678
diff changeset
    73
    runWithThresholds(0, -1, true);
17397
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    74
    runWithThresholds(8, -1, true);
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    75
    runWithThresholds(16, 8, true);
23506
9b98355e9060 6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents: 17397
diff changeset
    76
    runWithThresholds(8, 17, true);
17397
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    77
  }
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 23506
diff changeset
    78
}