Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/options/TestExplicitGC.java
32285 views
'/*1* Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation.6*7* This code is distributed in the hope that it will be useful, but WITHOUT8* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10* version 2 for more details (a copy is included in the LICENSE file that11* accompanied this code).12*13* You should have received a copy of the GNU General Public License version14* 2 along with this work; if not, write to the Free Software Foundation,15* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16*17* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18* or visit www.oracle.com if you need additional information or have any19* questions.20*21*/2223/*24* @test TestExplicitGC25* @summary Test that Shenandoah reacts to explicit GC flags appropriately26* @key gc27* @library /testlibrary28*29* @run driver TestExplicitGC30*/3132import com.oracle.java.testlibrary.*;3334public class TestExplicitGC {3536enum Mode {37PRODUCT,38DIAGNOSTIC,39EXPERIMENTAL,40}4142public static void main(String[] args) throws Exception {43if (args.length > 0) {44System.out.println("Calling System.gc()");45System.gc();46return;47}4849String[] full = new String[] {50"Pause Full"51};5253String[] concNormal = new String[] {54"Pause Init Mark",55"Pause Final Mark",56};5758{59ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(60"-Xmx128m",61"-XX:+UnlockExperimentalVMOptions",62"-XX:+UseShenandoahGC",63"-verbose:gc",64TestExplicitGC.class.getName(),65"test");66OutputAnalyzer output = new OutputAnalyzer(pb.start());67for (String p : full) {68output.shouldNotContain(p);69}70for (String p : concNormal) {71output.shouldContain(p);72}73}7475{76ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(77"-Xmx128m",78"-XX:+UnlockExperimentalVMOptions",79"-XX:+UseShenandoahGC",80"-verbose:gc",81"-XX:+DisableExplicitGC",82TestExplicitGC.class.getName(),83"test");84OutputAnalyzer output = new OutputAnalyzer(pb.start());85for (String p : full) {86output.shouldNotContain(p);87}88for (String p : concNormal) {89output.shouldNotContain(p);90}91}9293{94ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(95"-Xmx128m",96"-XX:+UnlockExperimentalVMOptions",97"-XX:+UseShenandoahGC",98"-verbose:gc",99"-XX:+ExplicitGCInvokesConcurrent",100TestExplicitGC.class.getName(),101"test");102OutputAnalyzer output = new OutputAnalyzer(pb.start());103for (String p : full) {104output.shouldNotContain(p);105}106for (String p : concNormal) {107output.shouldContain(p);108}109}110111{112ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(113"-Xmx128m",114"-XX:+UnlockExperimentalVMOptions",115"-XX:+UseShenandoahGC",116"-verbose:gc",117"-XX:-ExplicitGCInvokesConcurrent",118TestExplicitGC.class.getName(),119"test");120OutputAnalyzer output = new OutputAnalyzer(pb.start());121for (String p : full) {122output.shouldContain(p);123}124for (String p : concNormal) {125output.shouldNotContain(p);126}127}128129{130ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(131"-Xmx128m",132"-XX:+UnlockExperimentalVMOptions",133"-XX:+UseShenandoahGC",134"-verbose:gc",135"-XX:+ExplicitGCInvokesConcurrent",136"-XX:ShenandoahGCMode=iu",137TestExplicitGC.class.getName(),138"test");139OutputAnalyzer output = new OutputAnalyzer(pb.start());140for (String p : full) {141output.shouldNotContain(p);142}143for (String p : concNormal) {144output.shouldContain(p);145}146}147}148}149150151