Mercurial > hg > truffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
12117:f92b82d454fa | 12118:5fd8e2fbafd4 |
---|---|
43 OutputAnalyzer output; | 43 OutputAnalyzer output; |
44 | 44 |
45 String pid = Integer.toString(ProcessTools.getProcessId()); | 45 String pid = Integer.toString(ProcessTools.getProcessId()); |
46 ProcessBuilder pb = new ProcessBuilder(); | 46 ProcessBuilder pb = new ProcessBuilder(); |
47 | 47 |
48 boolean has_nmt_detail = wb.NMTIsDetailSupported(); | |
49 if (has_nmt_detail) { | |
50 System.out.println("NMT detail support detected."); | |
51 } else { | |
52 System.out.println("NMT detail support not detected."); | |
53 } | |
54 | |
48 Thread reserveThread = new Thread() { | 55 Thread reserveThread = new Thread() { |
49 public void run() { | 56 public void run() { |
50 addr = wb.NMTReserveMemory(reserveSize); | 57 addr = wb.NMTReserveMemory(reserveSize); |
51 } | 58 } |
52 }; | 59 }; |
56 mergeData(); | 63 mergeData(); |
57 | 64 |
58 pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"}); | 65 pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"}); |
59 output = new OutputAnalyzer(pb.start()); | 66 output = new OutputAnalyzer(pb.start()); |
60 output.shouldContain("Test (reserved=512KB, committed=0KB)"); | 67 output.shouldContain("Test (reserved=512KB, committed=0KB)"); |
61 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test"); | 68 if (has_nmt_detail) { |
69 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test"); | |
70 } | |
62 | 71 |
63 Thread commitThread = new Thread() { | 72 Thread commitThread = new Thread() { |
64 public void run() { | 73 public void run() { |
65 wb.NMTCommitMemory(addr, commitSize); | 74 wb.NMTCommitMemory(addr, commitSize); |
66 } | 75 } |
70 | 79 |
71 mergeData(); | 80 mergeData(); |
72 | 81 |
73 output = new OutputAnalyzer(pb.start()); | 82 output = new OutputAnalyzer(pb.start()); |
74 output.shouldContain("Test (reserved=512KB, committed=128KB)"); | 83 output.shouldContain("Test (reserved=512KB, committed=128KB)"); |
75 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB"); | 84 if (has_nmt_detail) { |
85 output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB"); | |
86 } | |
76 | 87 |
77 Thread uncommitThread = new Thread() { | 88 Thread uncommitThread = new Thread() { |
78 public void run() { | 89 public void run() { |
79 wb.NMTUncommitMemory(addr, commitSize); | 90 wb.NMTUncommitMemory(addr, commitSize); |
80 } | 91 } |