hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java
author mlarsson
Tue, 29 Mar 2016 09:43:05 +0200
changeset 37201 928cf689af1a
parent 30604 b8d532cb6420
child 36851 03e2f4d0a421
permissions -rw-r--r--
8151993: Remove inclusion of inline.hpp in log.hpp Reviewed-by: kbarrett, stefank
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19532
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
     1
/*
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 22196
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
19532
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
     4
 *
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
     8
 *
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    13
 * accompanied this code).
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    14
 *
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    18
 *
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    21
 * questions.
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    22
 */
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    23
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    24
/*
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    25
 * @test
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    26
 * @bug 7051189 8023393
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    27
 * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    28
 * @library /testlibrary
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 22196
diff changeset
    29
 * @modules java.base/sun.misc
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 22196
diff changeset
    30
 *          java.management
19532
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    31
 * @run main XCheckJSig
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    32
 */
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    33
22196
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    34
import java.io.File;
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    35
import java.util.Map;
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 29678
diff changeset
    36
import jdk.test.lib.*;
19532
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    37
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    38
public class XCheckJSig {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    39
    public static void main(String args[]) throws Throwable {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    40
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    41
        System.out.println("Regression test for bugs 7051189 and 8023393");
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    42
        if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX()) {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    43
            System.out.println("Test only applicable on Solaris, Linux, and Mac OSX, skipping");
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    44
            return;
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    45
        }
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    46
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    47
        String jdk_path = System.getProperty("test.jdk");
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    48
        String os_arch = Platform.getOsArch();
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    49
        String libjsig;
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    50
        String env_var;
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    51
        if (Platform.isOSX()) {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    52
            env_var = "DYLD_INSERT_LIBRARIES";
22196
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    53
            libjsig = jdk_path + "/jre/lib/libjsig.dylib"; // jdk location
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    54
            if (!(new File(libjsig).exists())) {
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    55
                libjsig = jdk_path + "/lib/libjsig.dylib"; // jre location
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    56
            }
19532
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    57
        } else {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    58
            env_var = "LD_PRELOAD";
22196
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    59
            libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so"; // jdk location
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    60
            if (!(new File(libjsig).exists())) {
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    61
                libjsig = jdk_path + "/lib/" + os_arch + "/libjsig.so"; // jre location
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    62
            }
19532
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    63
        }
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    64
        // If this test fails, these might be useful to know.
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    65
        System.out.println("libjsig: " + libjsig);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    66
        System.out.println("osArch: " + os_arch);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    67
22196
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    68
        // Make sure the libjsig file exists.
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    69
        if (!(new File(libjsig).exists())) {
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    70
            System.out.println("File " + libjsig + " not found, skipping");
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    71
            return;
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    72
        }
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    73
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    74
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-version");
19532
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    75
        Map<String, String> env = pb.environment();
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    76
        env.put(env_var, libjsig);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    77
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    78
        output.shouldNotContain("libjsig is activated");
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    79
        output.shouldHaveExitValue(0);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    80
22196
b48393754f75 8023735: [TESTBUG] runtime/XCheckJniJsig/XCheckJSig.java fails on MacOS X
hseigel
parents: 21769
diff changeset
    81
        pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-verbose:jni", "-version");
19532
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    82
        env = pb.environment();
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    83
        env.put(env_var, libjsig);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    84
        output = new OutputAnalyzer(pb.start());
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    85
        output.shouldContain("libjsig is activated");
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    86
        output.shouldHaveExitValue(0);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    87
    }
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    88
}