Path: blob/master/test/hotspot/jtreg/gc/TestVerifySubSet.java
40930 views
/*1* Copyright (c) 2016, 2020, 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*/2223package gc;2425/* @test TestVerifySubSet.java26* @bug 807272527* @summary Test VerifySubSet option28* @library /test/lib29* @modules java.base/jdk.internal.misc30* @run main gc.TestVerifySubSet31*/3233import jdk.test.lib.process.ProcessTools;34import jdk.test.lib.process.OutputAnalyzer;35import java.util.ArrayList;36import java.util.Collections;37import jdk.test.lib.Utils;3839class TestVerifySubSetRunSystemGC {40public static void main(String args[]) throws Exception {41System.gc();42}43}4445public class TestVerifySubSet {4647private static OutputAnalyzer runTest(String subset) throws Exception {48ArrayList<String> vmOpts = new ArrayList<>();4950Collections.addAll(vmOpts, Utils.getFilteredTestJavaOpts("-Xlog.*"));51Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions",52"-XX:+VerifyBeforeGC",53"-XX:+VerifyAfterGC",54"-Xlog:gc+verify=debug",55"-XX:VerifySubSet="+subset,56TestVerifySubSetRunSystemGC.class.getName()});57ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts);58OutputAnalyzer output = new OutputAnalyzer(pb.start());5960System.out.println("Output:\n" + output.getOutput());61return output;62}6364public static void main(String args[]) throws Exception {6566OutputAnalyzer output;6768output = runTest("heap, threads, codecache, metaspace");69output.shouldContain("Heap");70output.shouldContain("Threads");71output.shouldContain("CodeCache");72output.shouldContain("MetaspaceUtils");73output.shouldNotContain("SymbolTable");74output.shouldNotContain("StringTable");75output.shouldNotContain("SystemDictionary");76output.shouldNotContain("CodeCache Oops");77output.shouldHaveExitValue(0);7879output = runTest("hello, threads, codecache, metaspace");80output.shouldContain("memory sub-system is unknown, please correct it");81output.shouldNotContain("Threads");82output.shouldNotContain("CodeCache");83output.shouldNotContain("MetaspaceUtils");84output.shouldHaveExitValue(1);85}86}878889