Path: blob/master/test/hotspot/jtreg/gc/shenandoah/options/TestHumongousThresholdArgs.java
41153 views
/*1* Copyright (c) 2017, 2018, Red Hat, Inc. 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*22*/2324/*25* @test TestHumongousThresholdArgs26* @summary Test that Shenandoah humongous threshold args are checked27* @requires vm.gc.Shenandoah28* @library /test/lib29* @modules java.base/jdk.internal.misc30* java.management31* @run driver TestHumongousThresholdArgs32*/3334import jdk.test.lib.process.ProcessTools;35import jdk.test.lib.process.OutputAnalyzer;3637public class TestHumongousThresholdArgs {38public static void main(String[] args) throws Exception {39{40ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(41"-Xmx128m",42"-XX:+UnlockExperimentalVMOptions",43"-XX:+UseShenandoahGC",44"-version");45OutputAnalyzer output = new OutputAnalyzer(pb.start());46output.shouldHaveExitValue(0);47}4849int[] valid = new int[] {1, 10, 50, 90, 100};50int[] invalid = new int[] {-100, -1, 0, 101, 1000};5152for (int v : valid) {53ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(54"-Xmx128m",55"-XX:+UnlockExperimentalVMOptions",56"-XX:+UseShenandoahGC",57"-XX:ShenandoahHumongousThreshold=" + v,58"-version");59OutputAnalyzer output = new OutputAnalyzer(pb.start());60output.shouldHaveExitValue(0);61}6263for (int v : invalid) {64ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(65"-Xmx128m",66"-XX:+UnlockExperimentalVMOptions",67"-XX:+UseShenandoahGC",68"-XX:ShenandoahHumongousThreshold=" + v,69"-version");70OutputAnalyzer output = new OutputAnalyzer(pb.start());71output.shouldHaveExitValue(1);72}73}74}757677