< prev index next >
test/gc/logging/TestDeprecatedPrintFlags.java
Print this page
*** 43,63 ****
public static void testPrintGC() throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintGC", "DoGC");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("-XX:+PrintGC is deprecated. Will use -Xlog:gc instead.");
output.shouldNotContain("PrintGCDetails");
! output.stdoutShouldMatch("\\[info.*\\]\\[gc\\]");
output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
output.shouldHaveExitValue(0);
}
public static void testPrintGCDetails() throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintGCDetails", "DoGC");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
output.shouldNotContain("PrintGC is deprecated");
! output.stdoutShouldMatch("\\[info.*\\]\\[gc\\]");
output.stdoutShouldMatch("\\[info.*\\]\\[gc\\,");
output.shouldHaveExitValue(0);
}
public static void testXloggc() throws Exception {
--- 43,63 ----
public static void testPrintGC() throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintGC", "DoGC");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("-XX:+PrintGC is deprecated. Will use -Xlog:gc instead.");
output.shouldNotContain("PrintGCDetails");
! output.stdoutShouldMatch("\\[info.*\\]\\[gc *\\]");
output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
output.shouldHaveExitValue(0);
}
public static void testPrintGCDetails() throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintGCDetails", "DoGC");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
output.shouldNotContain("PrintGC is deprecated");
! output.stdoutShouldMatch("\\[info.*\\]\\[gc *\\]");
output.stdoutShouldMatch("\\[info.*\\]\\[gc\\,");
output.shouldHaveExitValue(0);
}
public static void testXloggc() throws Exception {
*** 65,97 ****
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xloggc:" + fileName, "DoGC");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("-Xloggc is deprecated. Will use -Xlog:gc:gc-test.log instead.");
output.shouldNotContain("PrintGCDetails");
output.shouldNotContain("PrintGC");
! output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\]");
output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
output.shouldHaveExitValue(0);
String lines = Files.lines(Paths.get(fileName)).collect(Collectors.joining());
System.out.println("lines: " + lines);
OutputAnalyzer outputLog = new OutputAnalyzer(lines, "");
! outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc\\]");
outputLog.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
}
public static void testXloggcWithPrintGCDetails() throws Exception {
String fileName = "gc-test.log";
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintGCDetails", "-Xloggc:" + fileName, "DoGC");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
output.shouldContain("-Xloggc is deprecated. Will use -Xlog:gc:gc-test.log instead.");
output.shouldNotContain("PrintGC is deprecated");
! output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\]");
output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
output.shouldHaveExitValue(0);
String lines = Files.lines(Paths.get(fileName)).collect(Collectors.joining());
OutputAnalyzer outputLog = new OutputAnalyzer(lines, "");
! outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc\\]");
outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc\\,");
}
public static void main(String[] args) throws Exception {
testPrintGC();
--- 65,97 ----
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xloggc:" + fileName, "DoGC");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("-Xloggc is deprecated. Will use -Xlog:gc:gc-test.log instead.");
output.shouldNotContain("PrintGCDetails");
output.shouldNotContain("PrintGC");
! output.stdoutShouldNotMatch("\\[info.*\\]\\[gc *\\]");
output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
output.shouldHaveExitValue(0);
String lines = Files.lines(Paths.get(fileName)).collect(Collectors.joining());
System.out.println("lines: " + lines);
OutputAnalyzer outputLog = new OutputAnalyzer(lines, "");
! outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc *\\]");
outputLog.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
}
public static void testXloggcWithPrintGCDetails() throws Exception {
String fileName = "gc-test.log";
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+PrintGCDetails", "-Xloggc:" + fileName, "DoGC");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
output.shouldContain("-Xloggc is deprecated. Will use -Xlog:gc:gc-test.log instead.");
output.shouldNotContain("PrintGC is deprecated");
! output.stdoutShouldNotMatch("\\[info.*\\]\\[gc *\\]");
output.stdoutShouldNotMatch("\\[info.*\\]\\[gc\\,");
output.shouldHaveExitValue(0);
String lines = Files.lines(Paths.get(fileName)).collect(Collectors.joining());
OutputAnalyzer outputLog = new OutputAnalyzer(lines, "");
! outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc *\\]");
outputLog.stdoutShouldMatch("\\[info.*\\]\\[gc\\,");
}
public static void main(String[] args) throws Exception {
testPrintGC();
< prev index next >