Mercurial > hg > truffle
diff test/runtime/NMT/VirtualAllocTestType.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/VirtualAllocTestType.java Fri Aug 23 20:33:02 2013 -0400 +++ b/test/runtime/NMT/VirtualAllocTestType.java Fri Aug 23 12:36:32 2013 -0700 @@ -46,13 +46,22 @@ 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."); + } + addr = wb.NMTReserveMemory(reserveSize); mergeData(); + pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"}); - pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"}); output = new OutputAnalyzer(pb.start()); output.shouldContain("Test (reserved=256KB, committed=0KB)"); - output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 256KB for Test"); + if (has_nmt_detail) { + output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 256KB for Test"); + } wb.NMTCommitMemory(addr, commitSize); @@ -60,7 +69,9 @@ output = new OutputAnalyzer(pb.start()); output.shouldContain("Test (reserved=256KB, 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"); + } wb.NMTUncommitMemory(addr, commitSize); @@ -71,7 +82,6 @@ output.shouldNotMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed"); wb.NMTReleaseMemory(addr, reserveSize); - mergeData(); output = new OutputAnalyzer(pb.start());