diff test/runtime/NMT/ThreadedVirtualAllocTestType.java @ 12118:5fd8e2fbafd4

8020829: JT_HS: 2 runtime NMT tests fail on platforms if NMT detail is not supported Summary: Make tests query a new WhiteBox API to see if NMT detail is supported, and behave properly if it is not supported. Reviewed-by: dholmes, coleenp
author cjplummer
date Fri, 23 Aug 2013 12:36:32 -0700
parents 3b890cd4da64
children ac12996df59b
line wrap: on
line diff
--- a/test/runtime/NMT/ThreadedVirtualAllocTestType.java	Fri Aug 23 20:33:02 2013 -0400
+++ b/test/runtime/NMT/ThreadedVirtualAllocTestType.java	Fri Aug 23 12:36:32 2013 -0700
@@ -45,6 +45,13 @@
     String pid = Integer.toString(ProcessTools.getProcessId());
     ProcessBuilder pb = new ProcessBuilder();
 
+    boolean has_nmt_detail = wb.NMTIsDetailSupported();
+    if (has_nmt_detail) {
+      System.out.println("NMT detail support detected.");
+    } else {
+      System.out.println("NMT detail support not detected.");
+    }
+
     Thread reserveThread = new Thread() {
       public void run() {
         addr = wb.NMTReserveMemory(reserveSize);
@@ -58,7 +65,9 @@
     pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
     output = new OutputAnalyzer(pb.start());
     output.shouldContain("Test (reserved=512KB, committed=0KB)");
-    output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test");
+    if (has_nmt_detail) {
+      output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test");
+    }
 
     Thread commitThread = new Thread() {
       public void run() {
@@ -72,7 +81,9 @@
 
     output = new OutputAnalyzer(pb.start());
     output.shouldContain("Test (reserved=512KB, committed=128KB)");
-    output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
+    if (has_nmt_detail) {
+      output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
+    }
 
     Thread uncommitThread = new Thread() {
       public void run() {