Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/options/TestSoftMaxHeapSize.java
32285 views
/*1* Copyright (c) 2020, 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 TestSoftMaxHeapSize26* @summary Test that Shenandoah checks SoftMaxHeapSize27* @library /testlibrary28* @modules java.base/jdk.internal.misc29* java.management30* @run driver TestSoftMaxHeapSize31*/3233import com.oracle.java.testlibrary.*;3435public class TestSoftMaxHeapSize {36public static void main(String[] args) throws Exception {37{38ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",39"-XX:+UseShenandoahGC",40"-Xms4m",41"-Xmx128m",42"-XX:ShenandoahSoftMaxHeapSize=4m",43"-version");44OutputAnalyzer output = new OutputAnalyzer(pb.start());45output.shouldHaveExitValue(0);46}4748{49ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",50"-XX:+UseShenandoahGC",51"-Xms4m",52"-Xmx128m",53"-XX:ShenandoahSoftMaxHeapSize=128m",54"-version");55OutputAnalyzer output = new OutputAnalyzer(pb.start());56output.shouldHaveExitValue(0);57}5859{60ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",61"-XX:+UseShenandoahGC",62"-Xms4m",63"-Xmx128m",64"-XX:ShenandoahSoftMaxHeapSize=129m",65"-version");66OutputAnalyzer output = new OutputAnalyzer(pb.start());67output.shouldHaveExitValue(1);68output.shouldContain("SoftMaxHeapSize must be less than or equal to the maximum heap size");69}70}71}727374