18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test HeapChangeLogging.java
26 * @bug 8027440
27 * @library /testlibrary
28 * @modules java.base/sun.misc
29 * java.management
30 * @build HeapChangeLogging
31 * @summary Allocate to get a promotion failure and verify that that heap change logging is present.
32 * @run main HeapChangeLogging
33 */
34
35 import java.util.regex.Matcher;
36 import java.util.regex.Pattern;
37
38 import com.oracle.java.testlibrary.*;
39
40 public class HeapChangeLogging {
41 public static void main(String[] args) throws Exception {
42 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx128m", "-Xmn100m", "-XX:+UseSerialGC", "-XX:+PrintGC", "HeapFiller");
43 OutputAnalyzer output = new OutputAnalyzer(pb.start());
44 String stdout = output.getStdout();
45 System.out.println(stdout);
46 Matcher stdoutMatcher = Pattern.compile("\\[GC .Allocation Failure.*K->.*K\\(.*K\\), .* secs\\]", Pattern.MULTILINE).matcher(stdout);
47 if (!stdoutMatcher.find()) {
48 throw new RuntimeException("No proper GC log line found");
49 }
50 output.shouldHaveExitValue(0);
51 }
52 }
53
54 class HeapFiller {
55 public static Entry root;
56 private static final int PAYLOAD_SIZE = 1000;
57
58 public static void main(String[] args) {
|
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test HeapChangeLogging.java
26 * @bug 8027440
27 * @library /testlibrary
28 * @modules java.base/sun.misc
29 * java.management
30 * @build HeapChangeLogging
31 * @summary Allocate to get a promotion failure and verify that that heap change logging is present.
32 * @run main HeapChangeLogging
33 */
34
35 import java.util.regex.Matcher;
36 import java.util.regex.Pattern;
37
38 import jdk.test.lib.*;
39
40 public class HeapChangeLogging {
41 public static void main(String[] args) throws Exception {
42 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xmx128m", "-Xmn100m", "-XX:+UseSerialGC", "-XX:+PrintGC", "HeapFiller");
43 OutputAnalyzer output = new OutputAnalyzer(pb.start());
44 String stdout = output.getStdout();
45 System.out.println(stdout);
46 Matcher stdoutMatcher = Pattern.compile("\\[GC .Allocation Failure.*K->.*K\\(.*K\\), .* secs\\]", Pattern.MULTILINE).matcher(stdout);
47 if (!stdoutMatcher.find()) {
48 throw new RuntimeException("No proper GC log line found");
49 }
50 output.shouldHaveExitValue(0);
51 }
52 }
53
54 class HeapFiller {
55 public static Entry root;
56 private static final int PAYLOAD_SIZE = 1000;
57
58 public static void main(String[] args) {
|