test/runtime/NMT/NMTWithCDS.java

Wed, 17 Sep 2014 05:30:19 -0700

author
gtriantafill
date
Wed, 17 Sep 2014 05:30:19 -0700
changeset 7197
be71c49ae55a
parent 7082
357af5b6d80a
child 9660
f54baa81b631
permissions
-rw-r--r--

8056263: [TESTBUG] Re-enable NMTWithCDS.java test
Reviewed-by: lfoltan, hseigel

zgu@7079 1 /*
zgu@7079 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
zgu@7079 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
zgu@7079 4 *
zgu@7079 5 * This code is free software; you can redistribute it and/or modify it
zgu@7079 6 * under the terms of the GNU General Public License version 2 only, as
zgu@7079 7 * published by the Free Software Foundation.
zgu@7079 8 *
zgu@7079 9 * This code is distributed in the hope that it will be useful, but WITHOUT
zgu@7079 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
zgu@7079 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
zgu@7079 12 * version 2 for more details (a copy is included in the LICENSE file that
zgu@7079 13 * accompanied this code).
zgu@7079 14 *
zgu@7079 15 * You should have received a copy of the GNU General Public License version
zgu@7079 16 * 2 along with this work; if not, write to the Free Software Foundation,
zgu@7079 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
zgu@7079 18 *
zgu@7079 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
zgu@7079 20 * or visit www.oracle.com if you need additional information or have any
zgu@7079 21 * questions.
zgu@7079 22 */
zgu@7079 23
zgu@7079 24 /*
zgu@7079 25 * @test
zgu@7079 26 * @bug 8055061
zgu@7079 27 * @key nmt
zgu@7079 28 * @library /testlibrary
zgu@7079 29 * @run main NMTWithCDS
zgu@7079 30 */
zgu@7079 31 import com.oracle.java.testlibrary.*;
zgu@7079 32
zgu@7079 33 public class NMTWithCDS {
zgu@7079 34
zgu@7079 35 public static void main(String[] args) throws Exception {
zgu@7079 36 ProcessBuilder pb;
zgu@7079 37 pb = ProcessTools.createJavaProcessBuilder("-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump");
zgu@7079 38 OutputAnalyzer output = new OutputAnalyzer(pb.start());
zgu@7079 39 try {
zgu@7079 40 output.shouldContain("Loading classes to share");
zgu@7079 41 output.shouldHaveExitValue(0);
zgu@7079 42
zgu@7079 43 pb = ProcessTools.createJavaProcessBuilder(
zgu@7079 44 "-XX:NativeMemoryTracking=detail", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:on", "-version");
zgu@7079 45 output = new OutputAnalyzer(pb.start());
zgu@7079 46 output.shouldContain("sharing");
zgu@7079 47 output.shouldHaveExitValue(0);
zgu@7079 48
zgu@7079 49 } catch (RuntimeException e) {
zgu@7079 50 // Report 'passed' if CDS was turned off.
zgu@7079 51 output.shouldContain("Unable to use shared archive");
zgu@7079 52 output.shouldHaveExitValue(1);
zgu@7079 53 }
zgu@7079 54 }
zgu@7079 55 }

mercurial