hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java
author fzhinkin
Tue, 20 Jan 2015 11:26:20 +0300
changeset 28722 51fe60d9e30c
parent 17375 e9554fd82263
child 29678 dd2f3932c21e
child 30123 7a8b6bd85e24
permissions -rw-r--r--
8069126: compiler/rtm/locking/TestRTMTotalCountIncrRate.java nightly failure Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17375
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
     1
/*
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
     4
 *
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
     8
 *
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    13
 * accompanied this code).
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    14
 *
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    18
 *
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    21
 * questions.
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    22
 */
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    23
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    24
/*
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    25
 * @test
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    26
 * @bug 8014138
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    27
 * @summary Testing new -XX:SharedArchiveFile=<file-name> option
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    28
 * @library /testlibrary
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    29
 */
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    30
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    31
import com.oracle.java.testlibrary.*;
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    32
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    33
public class SharedArchiveFile {
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    34
  public static void main(String[] args) throws Exception {
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    35
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    36
        "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:dump");
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    37
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    38
    try {
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    39
      output.shouldContain("Loading classes to share");
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    40
      output.shouldHaveExitValue(0);
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    41
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    42
      pb = ProcessTools.createJavaProcessBuilder(
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    43
        "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./sample.jsa", "-Xshare:on", "-version");
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    44
      output = new OutputAnalyzer(pb.start());
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    45
      output.shouldContain("sharing");
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    46
      output.shouldHaveExitValue(0);
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    47
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    48
    } catch (RuntimeException e) {
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    49
      output.shouldContain("Unable to use shared archive");
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    50
      output.shouldHaveExitValue(1);
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    51
    }
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    52
  }
e9554fd82263 8014138: Add VM option to facilitate the writing of CDS tests
hseigel
parents:
diff changeset
    53
}