< prev index next >

test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java

Print this page

        

*** 31,57 **** import java.util.regex.Matcher; import jdk.test.lib.Asserts; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import sun.hotspot.WhiteBox; /* * @test TestMetaSpaceLog * @bug 8211123 * @summary Ensure that the Metaspace is updated in the log * @key gc * @library /test/lib * @modules java.base/jdk.internal.misc * java.management - * @requires vm.gc != "Epsilon" - * @requires vm.gc != "Z" - * @requires vm.gc != "Shenandoah" * * @compile TestMetaSpaceLog.java * @run driver ClassFileInstaller sun.hotspot.WhiteBox ! * @run driver gc.logging.TestMetaSpaceLog */ public class TestMetaSpaceLog { private static Pattern metaSpaceRegexp; --- 31,56 ---- import java.util.regex.Matcher; import jdk.test.lib.Asserts; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; + import jtreg.SkippedException; + import sun.hotspot.gc.GC; import sun.hotspot.WhiteBox; /* * @test TestMetaSpaceLog * @bug 8211123 * @summary Ensure that the Metaspace is updated in the log * @key gc * @library /test/lib * @modules java.base/jdk.internal.misc * java.management * * @compile TestMetaSpaceLog.java * @run driver ClassFileInstaller sun.hotspot.WhiteBox ! * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.logging.TestMetaSpaceLog */ public class TestMetaSpaceLog { private static Pattern metaSpaceRegexp;
*** 59,69 **** // Do this once here. metaSpaceRegexp = Pattern.compile(".*Metaspace: ([0-9]+).*->([0-9]+).*"); } public static void main(String[] args) throws Exception { ! testMetaSpaceUpdate(); } private static void verifyContainsMetaSpaceUpdate(OutputAnalyzer output) { // At least one metaspace line from GC should show GC being collected. boolean foundCollectedMetaSpace = output.asLines().stream() --- 58,88 ---- // Do this once here. metaSpaceRegexp = Pattern.compile(".*Metaspace: ([0-9]+).*->([0-9]+).*"); } public static void main(String[] args) throws Exception { ! boolean noneGCSupported = true; ! ! if (GC.Parallel.isSupported()) { ! noneGCSupported = false; ! testMetaSpaceUpdate("UseParallelGC"); ! } ! if (GC.G1.isSupported()) { ! noneGCSupported = false; ! testMetaSpaceUpdate("UseG1GC"); ! } ! if (GC.ConcMarkSweep.isSupported()) { ! noneGCSupported = false; ! testMetaSpaceUpdate("UseConcMarkSweepGC"); ! } ! if (GC.Serial.isSupported()) { ! noneGCSupported = false; ! testMetaSpaceUpdate("UseSerialGC"); ! } ! if (noneGCSupported) { ! throw new SkippedException("Skipping test because none of Parallel/G1/ConcMarkSweep/Serial is supported."); ! } } private static void verifyContainsMetaSpaceUpdate(OutputAnalyzer output) { // At least one metaspace line from GC should show GC being collected. boolean foundCollectedMetaSpace = output.asLines().stream()
*** 78,94 **** long before = Long.parseLong(m.group(1)); long after = Long.parseLong(m.group(2)); return before > after; } ! private static void testMetaSpaceUpdate() throws Exception { // Propagate test.src for the jar file. String testSrc= "-Dtest.src=" + System.getProperty("test.src", "."); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( ! true, "-Xlog:gc*", "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", "-Xmx1000M", --- 97,114 ---- long before = Long.parseLong(m.group(1)); long after = Long.parseLong(m.group(2)); return before > after; } ! private static void testMetaSpaceUpdate(String gcFlag) throws Exception { // Propagate test.src for the jar file. String testSrc= "-Dtest.src=" + System.getProperty("test.src", "."); + System.err.println("Testing with GC Flag: " + gcFlag); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( ! "-XX:+" + gcFlag, "-Xlog:gc*", "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", "-Xmx1000M",
< prev index next >