From cb271a889e348bc82b677471884ba917616aab2a Mon Sep 17 00:00:00 2001 From: gtriantafill Date: Tue, 28 Oct 2014 13:30:40 -0700 Subject: [PATCH] 8058606: [TESTBUG] Detailed Native Memory Tracking (NMT) data is not verified as output at VM exit Reviewed-by: coleenp, hseigel --- test/runtime/NMT/PrintNMTStatistics.java | 60 ++++++++++++------------ 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/test/runtime/NMT/PrintNMTStatistics.java b/test/runtime/NMT/PrintNMTStatistics.java index 3fac653d7..4b77303e0 100644 --- a/test/runtime/NMT/PrintNMTStatistics.java +++ b/test/runtime/NMT/PrintNMTStatistics.java @@ -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,42 +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) { - 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"); - - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("Java Heap (reserved="); - output.shouldNotContain("error"); - output.shouldHaveExitValue(0); - } + "-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); + + 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); + } } -- GitLab