hotspot/test/gc/arguments/TestInitialTenuringThreshold.java
author chegar
Sat, 09 Apr 2016 23:03:39 +0100
changeset 36851 03e2f4d0a421
parent 35488 bca41d0c2a15
child 39414 4adf52148100
permissions -rw-r--r--
8153737: Unsupported Module Reviewed-by: alanb, mchung, psandoz
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
/*
35488
bca41d0c2a15 8146889: Update @requires expression for GC tests to run if GC is default
dfazunen
parents: 33144
diff changeset
     2
* Copyright (c) 2013, 2016, 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
35488
bca41d0c2a15 8146889: Update @requires expression for GC tests to run if GC is default
dfazunen
parents: 33144
diff changeset
    28
 * @requires vm.gc=="Parallel" | vm.gc=="null"
17397
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    29
 * @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
    30
 * @library /testlibrary
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 35488
diff changeset
    31
 * @modules java.base/jdk.internal.misc
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 23506
diff changeset
    32
 *          java.management
17397
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    33
 * @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
    34
 * @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
    35
 */
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    36
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 30169
diff changeset
    37
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
    38
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    39
public class TestInitialTenuringThreshold {
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    40
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    41
  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
    42
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
33144
c56850e328fc 8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents: 32613
diff changeset
    43
      "-XX:+UseParallelGC",
17397
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    44
      "-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
    45
      "-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
    46
      "-version"
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    47
      );
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    48
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    49
    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
    50
    if (shouldfail) {
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    51
      output.shouldHaveExitValue(1);
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    52
    } else {
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    53
      output.shouldHaveExitValue(0);
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
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    57
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    58
  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
    59
    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
    60
      // 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
    61
      "-XX:MaxTenuringThreshold=1",
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    62
      "-version"
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    63
      );
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    64
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    65
    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
    66
    output.shouldHaveExitValue(0);
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    67
    // successful tests
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    68
    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
    69
    runWithThresholds(5, 5, false);
23506
9b98355e9060 6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents: 17397
diff changeset
    70
    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
    71
    // failing tests
609242d28659 8014765: VM exits if MaxTenuringThreshold is set below the default InitialTenuringThreshold, and InitialTenuringThreshold is not set
tschatzl
parents:
diff changeset
    72
    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
    73
    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
    74
    runWithThresholds(-1, 8, true);
30169
736fe315ddcb 8076311: Java 9 process negative MaxTenuringThreshold in different way than Java 8
ddmitriev
parents: 29678
diff changeset
    75
    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
    76
    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
    77
    runWithThresholds(16, 8, true);
23506
9b98355e9060 6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents: 17397
diff changeset
    78
    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
    79
  }
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 23506
diff changeset
    80
}