Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/options/TestVerboseGC.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 TestVerboseGC25* @summary Test that Shenandoah reacts properly on -verbose:gc26* @key gc27* @library /testlibrary28*29* @run driver TestVerboseGC30*/3132import com.oracle.java.testlibrary.*;3334public class TestVerboseGC {35static volatile Object sink;3637public static void main(String[] args) throws Exception {38if (args.length > 0) {39for (int c = 0; c < 1_000; c++) {40sink = new byte[1_000_000];41Thread.sleep(1);42}43return;44}4546{47ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",48"-XX:+UseShenandoahGC",49"-Xmx128m",50TestVerboseGC.class.getName(),51"test");52OutputAnalyzer output = new OutputAnalyzer(pb.start());53output.shouldNotContain("Concurrent marking");54output.shouldNotContain("Collectable Garbage");55output.shouldNotContain("GC STATISTICS");56output.shouldHaveExitValue(0);57}5859{60ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",61"-XX:+UseShenandoahGC",62"-Xmx128m",63"-verbose:gc",64TestVerboseGC.class.getName(),65"test");66OutputAnalyzer output = new OutputAnalyzer(pb.start());67output.shouldContain("Concurrent marking");68output.shouldNotContain("Collectable Garbage");69output.shouldContain("GC STATISTICS");70output.shouldHaveExitValue(0);71}7273{74ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",75"-XX:+UseShenandoahGC",76"-Xmx128m",77"-XX:+PrintGC",78TestVerboseGC.class.getName(),79"test");80OutputAnalyzer output = new OutputAnalyzer(pb.start());81output.shouldContain("Concurrent marking");82output.shouldNotContain("Collectable Garbage");83output.shouldContain("GC STATISTICS");84output.shouldHaveExitValue(0);85}8687{88ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",89"-XX:+UseShenandoahGC",90"-Xmx128m",91"-XX:+PrintGCDetails",92TestVerboseGC.class.getName(),93"test");94OutputAnalyzer output = new OutputAnalyzer(pb.start());95output.shouldContain("Concurrent marking");96output.shouldContain("Collectable Garbage");97output.shouldContain("GC STATISTICS");98output.shouldHaveExitValue(0);99}100}101}102103104