Path: blob/master/test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java
40942 views
/*1* Copyright (c) 2013, 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.g1;2425/*26* @test TestRemsetLoggingThreads27* @requires vm.gc.G128* @bug 8025441 814553429* @library /test/lib30* @modules java.base/jdk.internal.misc31* java.management/sun.management32* @summary Ensure that various values of worker threads/concurrent33* refinement threads do not crash the VM.34* @run driver gc.g1.TestRemsetLoggingThreads35*/3637import java.util.regex.Matcher;38import java.util.regex.Pattern;3940import jdk.test.lib.process.OutputAnalyzer;41import jdk.test.lib.process.ProcessTools;4243public class TestRemsetLoggingThreads {4445private static void runTest(int refinementThreads, int workerThreads) throws Exception {46ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",47"-XX:+UnlockDiagnosticVMOptions",48"-Xlog:gc+remset+exit=trace",49"-XX:G1ConcRefinementThreads=" + refinementThreads,50"-XX:ParallelGCThreads=" + workerThreads,51"-version");5253OutputAnalyzer output = new OutputAnalyzer(pb.start());5455String pattern = "Concurrent refinement threads times \\(s\\)$";56Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());5758if (!m.find()) {59throw new Exception("Could not find correct output for concurrent RS threads times in stdout," +60" should match the pattern \"" + pattern + "\", but stdout is \n" + output.getStdout());61}62output.shouldHaveExitValue(0);63}6465public static void main(String[] args) throws Exception {66// different valid combinations of number of refinement and gc worker threads67runTest(1, 1);68runTest(1, 5);69runTest(5, 1);70runTest(10, 10);71runTest(1, 2);72runTest(4, 3);73}74}757677