test/runtime/XCheckJniJsig/XCheckJSig.java

Thu, 26 Sep 2013 10:25:02 -0400

author
hseigel
date
Thu, 26 Sep 2013 10:25:02 -0400
changeset 5784
190899198332
parent 5564
3a57fa7a4cd0
child 6133
e567d5afd4dd
permissions
-rw-r--r--

7195622: CheckUnhandledOops has limited usefulness now
Summary: Enable CHECK_UNHANDLED_OOPS in fastdebug builds across all supported platforms.
Reviewed-by: coleenp, hseigel, dholmes, stefank, twisti, ihse, rdurbin
Contributed-by: lois.foltan@oracle.com

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@5564 25 * @test
hseigel@5564 26 * @bug 7051189 8023393
hseigel@5564 27 * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so
hseigel@5564 28 * @library /testlibrary
hseigel@5564 29 * @run main XCheckJSig
hseigel@5564 30 */
hseigel@5564 31
hseigel@5564 32 import java.util.*;
hseigel@5564 33 import com.oracle.java.testlibrary.*;
hseigel@5564 34
hseigel@5564 35 public class XCheckJSig {
hseigel@5564 36 public static void main(String args[]) throws Throwable {
hseigel@5564 37
hseigel@5564 38 System.out.println("Regression test for bugs 7051189 and 8023393");
hseigel@5564 39 if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX()) {
hseigel@5564 40 System.out.println("Test only applicable on Solaris, Linux, and Mac OSX, skipping");
hseigel@5564 41 return;
hseigel@5564 42 }
hseigel@5564 43
hseigel@5564 44 String jdk_path = System.getProperty("test.jdk");
hseigel@5564 45 String os_arch = Platform.getOsArch();
hseigel@5564 46 String libjsig;
hseigel@5564 47 String env_var;
hseigel@5564 48 if (Platform.isOSX()) {
hseigel@5564 49 libjsig = jdk_path + "/jre/lib/server/libjsig.dylib";
hseigel@5564 50 env_var = "DYLD_INSERT_LIBRARIES";
hseigel@5564 51 } else {
hseigel@5564 52 libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so";
hseigel@5564 53 env_var = "LD_PRELOAD";
hseigel@5564 54 }
hseigel@5564 55 String java_program;
hseigel@5564 56 if (Platform.isSolaris()) {
hseigel@5564 57 // On Solaris, need to call the 64-bit Java directly in order for
hseigel@5564 58 // LD_PRELOAD to work because libjsig.so is 64-bit.
hseigel@5564 59 java_program = jdk_path + "/jre/bin/" + os_arch + "/java";
hseigel@5564 60 } else {
hseigel@5564 61 java_program = JDKToolFinder.getJDKTool("java");
hseigel@5564 62 }
hseigel@5564 63 // If this test fails, these might be useful to know.
hseigel@5564 64 System.out.println("libjsig: " + libjsig);
hseigel@5564 65 System.out.println("osArch: " + os_arch);
hseigel@5564 66 System.out.println("java_program: " + java_program);
hseigel@5564 67
hseigel@5564 68 ProcessBuilder pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-version");
hseigel@5564 69 Map<String, String> env = pb.environment();
hseigel@5564 70 env.put(env_var, libjsig);
hseigel@5564 71 OutputAnalyzer output = new OutputAnalyzer(pb.start());
hseigel@5564 72 output.shouldNotContain("libjsig is activated");
hseigel@5564 73 output.shouldHaveExitValue(0);
hseigel@5564 74
hseigel@5564 75 pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-verbose:jni", "-version");
hseigel@5564 76 env = pb.environment();
hseigel@5564 77 env.put(env_var, libjsig);
hseigel@5564 78 output = new OutputAnalyzer(pb.start());
hseigel@5564 79 output.shouldContain("libjsig is activated");
hseigel@5564 80 output.shouldHaveExitValue(0);
hseigel@5564 81 }
hseigel@5564 82 }

mercurial