test/runtime/XCheckJniJsig/XCheckJSig.java

Mon, 28 Jul 2014 15:06:38 -0700

author
fzhinkin
date
Mon, 28 Jul 2014 15:06:38 -0700
changeset 6997
dbb05f6d93c4
parent 6133
e567d5afd4dd
child 6876
710a3c8b516e
permissions
-rw-r--r--

8051344: JVM crashed in Compile::start() during method parsing w/ UseRTMDeopt turned on
Summary: call rtm_deopt() only if there were no compilation bailouts before.
Reviewed-by: kvn

hseigel@5564 1 /*
hseigel@5564 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
hseigel@5564 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hseigel@5564 4 *
hseigel@5564 5 * This code is free software; you can redistribute it and/or modify it
hseigel@5564 6 * under the terms of the GNU General Public License version 2 only, as
hseigel@5564 7 * published by the Free Software Foundation.
hseigel@5564 8 *
hseigel@5564 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hseigel@5564 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hseigel@5564 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hseigel@5564 12 * version 2 for more details (a copy is included in the LICENSE file that
hseigel@5564 13 * accompanied this code).
hseigel@5564 14 *
hseigel@5564 15 * You should have received a copy of the GNU General Public License version
hseigel@5564 16 * 2 along with this work; if not, write to the Free Software Foundation,
hseigel@5564 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hseigel@5564 18 *
hseigel@5564 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hseigel@5564 20 * or visit www.oracle.com if you need additional information or have any
hseigel@5564 21 * questions.
hseigel@5564 22 */
hseigel@5564 23
hseigel@5564 24 /*
hseigel@6133 25 * @ignore 8023735
hseigel@5564 26 * @test
hseigel@5564 27 * @bug 7051189 8023393
hseigel@5564 28 * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so
hseigel@5564 29 * @library /testlibrary
hseigel@5564 30 * @run main XCheckJSig
hseigel@5564 31 */
hseigel@5564 32
hseigel@5564 33 import java.util.*;
hseigel@5564 34 import com.oracle.java.testlibrary.*;
hseigel@5564 35
hseigel@5564 36 public class XCheckJSig {
hseigel@5564 37 public static void main(String args[]) throws Throwable {
hseigel@5564 38
hseigel@5564 39 System.out.println("Regression test for bugs 7051189 and 8023393");
hseigel@5564 40 if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX()) {
hseigel@5564 41 System.out.println("Test only applicable on Solaris, Linux, and Mac OSX, skipping");
hseigel@5564 42 return;
hseigel@5564 43 }
hseigel@5564 44
hseigel@5564 45 String jdk_path = System.getProperty("test.jdk");
hseigel@5564 46 String os_arch = Platform.getOsArch();
hseigel@5564 47 String libjsig;
hseigel@5564 48 String env_var;
hseigel@5564 49 if (Platform.isOSX()) {
hseigel@5564 50 libjsig = jdk_path + "/jre/lib/server/libjsig.dylib";
hseigel@5564 51 env_var = "DYLD_INSERT_LIBRARIES";
hseigel@5564 52 } else {
hseigel@5564 53 libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so";
hseigel@5564 54 env_var = "LD_PRELOAD";
hseigel@5564 55 }
hseigel@5564 56 String java_program;
hseigel@5564 57 if (Platform.isSolaris()) {
hseigel@5564 58 // On Solaris, need to call the 64-bit Java directly in order for
hseigel@5564 59 // LD_PRELOAD to work because libjsig.so is 64-bit.
hseigel@5564 60 java_program = jdk_path + "/jre/bin/" + os_arch + "/java";
hseigel@5564 61 } else {
hseigel@5564 62 java_program = JDKToolFinder.getJDKTool("java");
hseigel@5564 63 }
hseigel@5564 64 // If this test fails, these might be useful to know.
hseigel@5564 65 System.out.println("libjsig: " + libjsig);
hseigel@5564 66 System.out.println("osArch: " + os_arch);
hseigel@5564 67 System.out.println("java_program: " + java_program);
hseigel@5564 68
hseigel@5564 69 ProcessBuilder pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-version");
hseigel@5564 70 Map<String, String> env = pb.environment();
hseigel@5564 71 env.put(env_var, libjsig);
hseigel@5564 72 OutputAnalyzer output = new OutputAnalyzer(pb.start());
hseigel@5564 73 output.shouldNotContain("libjsig is activated");
hseigel@5564 74 output.shouldHaveExitValue(0);
hseigel@5564 75
hseigel@5564 76 pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-verbose:jni", "-version");
hseigel@5564 77 env = pb.environment();
hseigel@5564 78 env.put(env_var, libjsig);
hseigel@5564 79 output = new OutputAnalyzer(pb.start());
hseigel@5564 80 output.shouldContain("libjsig is activated");
hseigel@5564 81 output.shouldHaveExitValue(0);
hseigel@5564 82 }
hseigel@5564 83 }

mercurial