提交 cb271a88 编写于 作者: G gtriantafill

8058606: [TESTBUG] Detailed Native Memory Tracking (NMT) data is not verified as output at VM exit

Reviewed-by: coleenp, hseigel
上级 e0acdd88
/* /*
* Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -24,42 +24,40 @@ ...@@ -24,42 +24,40 @@
/* /*
* @test * @test
* @key nmt regression * @key nmt regression
* @bug 8005936 * @bug 8005936 8058606
* @summary Make sure PrintNMTStatistics works on normal JVM exit * @summary Verify PrintNMTStatistics on normal JVM exit for detail and summary tracking level
* @library /testlibrary /testlibrary/whitebox * @library /testlibrary
* @build PrintNMTStatistics
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main PrintNMTStatistics
*/ */
import com.oracle.java.testlibrary.*; import com.oracle.java.testlibrary.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import sun.hotspot.WhiteBox;
public class PrintNMTStatistics { public class PrintNMTStatistics {
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
// We start a new java process running with an argument and use WB API to ensure
// we have data for NMT on VM exit
if (args.length > 0) {
return;
}
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+UnlockDiagnosticVMOptions", "-XX:+UnlockDiagnosticVMOptions",
"-Xbootclasspath/a:.", "-XX:+PrintNMTStatistics",
"-XX:+WhiteBoxAPI", "-XX:NativeMemoryTracking=detail",
"-XX:NativeMemoryTracking=summary", "-version");
"-XX:+PrintNMTStatistics",
"PrintNMTStatistics", OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
"test"); output_detail.shouldContain("Virtual memory map:");
output_detail.shouldContain("Details:");
OutputAnalyzer output = new OutputAnalyzer(pb.start()); output_detail.shouldNotContain("error");
output.shouldContain("Java Heap (reserved="); output_detail.shouldHaveExitValue(0);
output.shouldNotContain("error");
output.shouldHaveExitValue(0); ProcessBuilder pb1 = ProcessTools.createJavaProcessBuilder(
} "-XX:+UnlockDiagnosticVMOptions",
"-XX:+PrintNMTStatistics",
"-XX:NativeMemoryTracking=summary",
"-version");
OutputAnalyzer output_summary = new OutputAnalyzer(pb1.start());
output_summary.shouldContain("Java Heap (reserved=");
output_summary.shouldNotContain("Virtual memory map:");
output_summary.shouldNotContain("Details:");
output_summary.shouldNotContain("error");
output_summary.shouldHaveExitValue(0);
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册