Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java
32285 views
/*1* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test TestInitialTenuringThreshold25* @key gc26* @bug 801476527* @summary Tests argument processing for initial tenuring threshold28* @library /testlibrary29* @run main/othervm TestInitialTenuringThreshold30* @author [email protected]31*/3233import com.oracle.java.testlibrary.*;3435public class TestInitialTenuringThreshold {3637public static void runWithThresholds(int initial, int max, boolean shouldfail) throws Exception {38ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(39"-XX:InitialTenuringThreshold=" + String.valueOf(initial),40"-XX:MaxTenuringThreshold=" + String.valueOf(max),41"-version"42);4344OutputAnalyzer output = new OutputAnalyzer(pb.start());45if (shouldfail) {46output.shouldHaveExitValue(1);47} else {48output.shouldHaveExitValue(0);49}50}515253public static void main(String args[]) throws Exception {54ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(55// some value below the default value of InitialTenuringThreshold of 756"-XX:MaxTenuringThreshold=1",57"-version"58);5960OutputAnalyzer output = new OutputAnalyzer(pb.start());61output.shouldHaveExitValue(0);62// successful tests63runWithThresholds(0, 10, false);64runWithThresholds(5, 5, false);65// failing tests66runWithThresholds(10, 0, true);67runWithThresholds(9, 8, true);68runWithThresholds(-1, 8, true);69runWithThresholds(8, -1, true);70runWithThresholds(8, 16, true);71runWithThresholds(16, 8, true);72}73}74757677