hotspot/test/runtime/NMT/NMTWithCDS.java
author ccheung
Fri, 03 Apr 2015 13:45:33 -0700
changeset 30146 a5809dde4617
parent 30123 7a8b6bd85e24
parent 29678 dd2f3932c21e
child 30604 b8d532cb6420
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26146
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
     1
/*
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 26297
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
26146
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
     4
 *
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
     8
 *
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    13
 * accompanied this code).
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    14
 *
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    18
 *
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    21
 * questions.
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    22
 */
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    23
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    24
/*
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    25
 * @test
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    26
 * @bug 8055061
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    27
 * @key nmt
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    28
 * @library /testlibrary
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 26297
diff changeset
    29
 * @modules java.base/sun.misc
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 26297
diff changeset
    30
 *          java.management
26146
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    31
 * @run main NMTWithCDS
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    32
 */
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    33
import com.oracle.java.testlibrary.*;
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    34
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    35
public class NMTWithCDS {
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    36
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    37
  public static void main(String[] args) throws Exception {
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    38
    ProcessBuilder pb;
26297
5f5878285770 8055814: [TESTBUG] runtime/NMT/NMTWithCDS.java fails with product builds due to missing UnlockDiagnosticVMOptions
ctornqvi
parents: 26146
diff changeset
    39
    pb = ProcessTools.createJavaProcessBuilder(
30123
7a8b6bd85e24 8075438: [TESTBUG] Hotspot JTREG tests should use unique CDS archive names
ctornqvi
parents: 26297
diff changeset
    40
        "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./NMTWithCDS.jsa", "-Xshare:dump");
26146
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    41
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    42
    try {
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    43
      output.shouldContain("Loading classes to share");
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    44
      output.shouldHaveExitValue(0);
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    45
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    46
      pb = ProcessTools.createJavaProcessBuilder(
30123
7a8b6bd85e24 8075438: [TESTBUG] Hotspot JTREG tests should use unique CDS archive names
ctornqvi
parents: 26297
diff changeset
    47
        "-XX:+UnlockDiagnosticVMOptions", "-XX:NativeMemoryTracking=detail", "-XX:SharedArchiveFile=./NMTWithCDS.jsa", "-Xshare:on", "-version");
26146
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    48
      output = new OutputAnalyzer(pb.start());
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    49
      output.shouldContain("sharing");
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    50
      output.shouldHaveExitValue(0);
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    51
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    52
    } catch (RuntimeException e) {
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    53
      // Report 'passed' if CDS was turned off.
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    54
      output.shouldContain("Unable to use shared archive");
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    55
      output.shouldHaveExitValue(1);
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    56
    }
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    57
  }
ce3202564442 8055061: assert at share/vm/services/virtualMemoryTracker.cpp:332 Error: ShouldNotReachHere() when running NMT tests
zgu
parents:
diff changeset
    58
}