hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java
author hseigel
Tue, 26 Nov 2013 16:03:57 -0500
changeset 21769 61c68af507c9
parent 19532 6a9f968b7b05
child 22196 b48393754f75
permissions -rw-r--r--
8028160: [TESTBUG] Exclude failing (runtime) jtreg tests using @ignore Summary: Use @ignore to exclude failing tests Reviewed-by: coleenp, ctornqvi, mseledtsov Contributed-by: george.triantafillou@oracle.com
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
/*
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
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
/*
21769
61c68af507c9 8028160: [TESTBUG] Exclude failing (runtime) jtreg tests using @ignore
hseigel
parents: 19532
diff changeset
    25
 * @ignore 8023735
19532
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    26
 * @test
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    27
 * @bug 7051189 8023393
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    28
 * @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
    29
 * @library /testlibrary
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    30
 * @run main XCheckJSig
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    31
 */
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
import java.util.*;
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    34
import com.oracle.java.testlibrary.*;
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    35
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    36
public class XCheckJSig {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    37
    public static void main(String args[]) throws Throwable {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    38
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    39
        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
    40
        if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX()) {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    41
            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
    42
            return;
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    43
        }
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    44
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    45
        String jdk_path = System.getProperty("test.jdk");
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    46
        String os_arch = Platform.getOsArch();
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    47
        String libjsig;
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    48
        String env_var;
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    49
        if (Platform.isOSX()) {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    50
            libjsig = jdk_path + "/jre/lib/server/libjsig.dylib";
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    51
            env_var = "DYLD_INSERT_LIBRARIES";
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    52
        } else {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    53
            libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so";
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    54
            env_var = "LD_PRELOAD";
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    55
        }
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    56
        String java_program;
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    57
        if (Platform.isSolaris()) {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    58
            // On Solaris, need to call the 64-bit Java directly in order for
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    59
            // LD_PRELOAD to work because libjsig.so is 64-bit.
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    60
            java_program = jdk_path + "/jre/bin/" + os_arch + "/java";
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    61
        } else {
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    62
            java_program = JDKToolFinder.getJDKTool("java");
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
        System.out.println("java_program: " + java_program);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    68
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    69
        ProcessBuilder pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-version");
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    70
        Map<String, String> env = pb.environment();
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    71
        env.put(env_var, libjsig);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    72
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    73
        output.shouldNotContain("libjsig is activated");
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    74
        output.shouldHaveExitValue(0);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    75
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    76
        pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-verbose:jni", "-version");
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    77
        env = pb.environment();
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    78
        env.put(env_var, libjsig);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    79
        output = new OutputAnalyzer(pb.start());
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    80
        output.shouldContain("libjsig is activated");
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    81
        output.shouldHaveExitValue(0);
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    82
    }
6a9f968b7b05 7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff changeset
    83
}