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