hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java
author gtriantafill
Tue, 12 Aug 2014 14:06:41 -0700
changeset 25952 25c2dca04a31
child 26300 a1dfa0b11526
permissions -rw-r--r--
8054952: [TESTBUG] Add missing NMT2 tests Summary: The new NMT2 tests got lost on the way into jdk9 yesterday, this change adds them. Reviewed-by: coleenp, zgu, ctornqvi
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25952
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
     1
/*
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
     4
 *
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
     7
 * published by the Free Software Foundation.
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
     8
 *
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    13
 * accompanied this code).
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    14
 *
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    18
 *
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    21
 * questions.
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    22
 */
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    23
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    24
/*
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    25
 * @test
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    26
 * @summary Test reserve/commit/uncommit/release of virtual memory and that we track it correctly
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    27
 * @key nmt jcmd
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    28
 * @library /testlibrary /testlibrary/whitebox
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    29
 * @ignore
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    30
 * @build VirtualAllocCommitUncommitRecommit
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    31
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    32
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail VirtualAllocCommitUncommitRecommit
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    33
 *
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    34
 */
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    35
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    36
import com.oracle.java.testlibrary.*;
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    37
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    38
import sun.hotspot.WhiteBox;
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    39
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    40
public class VirtualAllocCommitUncommitRecommit {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    41
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    42
    public static WhiteBox wb = WhiteBox.getWhiteBox();
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    43
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    44
    public static void main(String args[]) throws Exception {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    45
        OutputAnalyzer output;
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    46
        long commitSize = 4 * 1024; // 4KB
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    47
        long reserveSize = 1024 * 1024; // 1024KB
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    48
        long addr;
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    49
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    50
        String pid = Integer.toString(ProcessTools.getProcessId());
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    51
        ProcessBuilder pb = new ProcessBuilder();
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    52
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    53
        boolean has_nmt_detail = wb.NMTIsDetailSupported();
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    54
        if (has_nmt_detail) {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    55
            System.out.println("NMT detail support detected.");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    56
        } else {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    57
            System.out.println("NMT detail support not detected.");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    58
        }
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    59
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    60
        // reserve
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    61
        addr = wb.NMTReserveMemory(reserveSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    62
        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid,
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    63
                "VM.native_memory", "detail" });
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    64
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    65
        output = new OutputAnalyzer(pb.start());
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    66
        output.shouldContain("Test (reserved=1024KB, committed=0KB)");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    67
        if (has_nmt_detail) {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    68
            output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    69
                    + Long.toHexString(addr + reserveSize)
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    70
                    + "\\] reserved 1024KB for Test");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    71
        }
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    72
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    73
        long addrA = addr;
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    74
        long addrB = addr + commitSize;
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    75
        long addrC = addr + (2 * commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    76
        long addrD = addr + (3 * commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    77
        long addrE = addr + (4 * commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    78
        long addrF = addr + (5 * commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    79
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    80
        // commit ABCD
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    81
        wb.NMTCommitMemory(addrA, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    82
        wb.NMTCommitMemory(addrB, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    83
        wb.NMTCommitMemory(addrC, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    84
        wb.NMTCommitMemory(addrD, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    85
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    86
        output = new OutputAnalyzer(pb.start());
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    87
        output.shouldContain("Test (reserved=1024KB, committed=16KB)");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    88
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    89
        if (has_nmt_detail) {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    90
            output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    91
                    + Long.toHexString(addr + reserveSize)
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    92
                    + "\\] reserved 1024KB for Test");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    93
        }
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    94
        // uncommit BC
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    95
        wb.NMTUncommitMemory(addrB, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    96
        wb.NMTUncommitMemory(addrC, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    97
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    98
        output = new OutputAnalyzer(pb.start());
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
    99
        output.shouldContain("Test (reserved=1024KB, committed=8KB)");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   100
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   101
        if (has_nmt_detail) {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   102
            output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   103
                    + Long.toHexString(addr + reserveSize)
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   104
                    + "\\] reserved 1024KB for Test");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   105
        }
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   106
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   107
        // commit EF
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   108
        wb.NMTCommitMemory(addrE, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   109
        wb.NMTCommitMemory(addrF, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   110
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   111
        output = new OutputAnalyzer(pb.start());
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   112
        output.shouldContain("Test (reserved=1024KB, committed=16KB)");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   113
        if (has_nmt_detail) {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   114
            output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   115
                    + Long.toHexString(addr + reserveSize)
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   116
                    + "\\] reserved 1024KB for Test");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   117
        }
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   118
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   119
        // uncommit A
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   120
        wb.NMTUncommitMemory(addrA, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   121
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   122
        output = new OutputAnalyzer(pb.start());
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   123
        output.shouldContain("Test (reserved=1024KB, committed=12KB)");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   124
        if (has_nmt_detail) {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   125
            output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   126
                    + Long.toHexString(addr + reserveSize)
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   127
                    + "\\] reserved 1024KB for Test");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   128
        }
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   129
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   130
        // commit ABC
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   131
        wb.NMTCommitMemory(addrA, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   132
        wb.NMTCommitMemory(addrB, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   133
        wb.NMTCommitMemory(addrC, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   134
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   135
        output = new OutputAnalyzer(pb.start());
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   136
        output.shouldContain("Test (reserved=1024KB, committed=24KB)");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   137
        if (has_nmt_detail) {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   138
            output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   139
                    + Long.toHexString(addr + reserveSize)
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   140
                    + "\\] reserved 1024KB for Test");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   141
        }
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   142
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   143
        // uncommit ABCDEF
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   144
        wb.NMTUncommitMemory(addrA, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   145
        wb.NMTUncommitMemory(addrB, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   146
        wb.NMTUncommitMemory(addrC, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   147
        wb.NMTUncommitMemory(addrD, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   148
        wb.NMTUncommitMemory(addrE, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   149
        wb.NMTUncommitMemory(addrF, commitSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   150
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   151
        output = new OutputAnalyzer(pb.start());
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   152
        output.shouldContain("Test (reserved=1024KB, committed=0KB)");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   153
        if (has_nmt_detail) {
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   154
            output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   155
                    + Long.toHexString(addr + reserveSize)
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   156
                    + "\\] reserved 1024KB for Test");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   157
        }
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   158
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   159
        // release
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   160
        wb.NMTReleaseMemory(addr, reserveSize);
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   161
        output = new OutputAnalyzer(pb.start());
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   162
        output.shouldNotContain("Test (reserved=");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   163
        output.shouldNotMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   164
                + Long.toHexString(addr + reserveSize) + "\\] reserved");
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   165
    }
25c2dca04a31 8054952: [TESTBUG] Add missing NMT2 tests
gtriantafill
parents:
diff changeset
   166
}