diff test/runtime/NMT/PrintNMTStatistics.java @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 e244cb6bdedf
children
line wrap: on
line diff
--- a/test/runtime/NMT/PrintNMTStatistics.java	Tue Apr 07 11:20:51 2015 +0200
+++ b/test/runtime/NMT/PrintNMTStatistics.java	Tue Apr 07 14:58:49 2015 +0200
@@ -1,5 +1,5 @@
 /*
- * 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.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,46 +24,40 @@
 /*
  * @test
  * @key nmt regression
- * @bug 8005936
- * @summary Make sure PrintNMTStatistics works on normal JVM exit
- * @library /testlibrary /testlibrary/whitebox
- * @build PrintNMTStatistics
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * @run main PrintNMTStatistics
+ * @bug 8005936 8058606
+ * @summary Verify PrintNMTStatistics on normal JVM exit for detail and summary tracking level
+ * @library /testlibrary
  */
 
 import com.oracle.java.testlibrary.*;
 
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import sun.hotspot.WhiteBox;
-
 public class PrintNMTStatistics {
 
-  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) {
-      // Use WB API to ensure that all data has been merged before we continue
-      if (!WhiteBox.getWhiteBox().NMTWaitForDataMerge()) {
-        throw new Exception("Call to WB API NMTWaitForDataMerge() failed");
-      }
-      return;
-    }
+    public static void main(String args[]) throws Exception {
 
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:+UnlockDiagnosticVMOptions",
-        "-Xbootclasspath/a:.",
-        "-XX:+WhiteBoxAPI",
-        "-XX:NativeMemoryTracking=summary",
-        "-XX:+PrintNMTStatistics",
-        "PrintNMTStatistics",
-        "test");
+      "-XX:+UnlockDiagnosticVMOptions",
+      "-XX:+PrintNMTStatistics",
+      "-XX:NativeMemoryTracking=detail",
+      "-version");
+
+    OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
+    output_detail.shouldContain("Virtual memory map:");
+    output_detail.shouldContain("Details:");
+    output_detail.shouldNotContain("error");
+    output_detail.shouldHaveExitValue(0);
 
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("Java Heap (reserved=");
-    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);
+    }
 }