author | ehelin |
Thu, 14 Nov 2013 21:05:16 +0100 | |
changeset 21571 | a3999342fb24 |
parent 19532 | 6a9f968b7b05 |
child 21769 | 61c68af507c9 |
permissions | -rw-r--r-- |
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 |
/* |
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 |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
29 |
* @run main XCheckJSig |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
30 |
*/ |
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 |
import java.util.*; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
33 |
import com.oracle.java.testlibrary.*; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
34 |
|
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
35 |
public class XCheckJSig { |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
36 |
public static void main(String args[]) throws Throwable { |
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 |
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
|
39 |
if (!Platform.isSolaris() && !Platform.isLinux() && !Platform.isOSX()) { |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
40 |
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
|
41 |
return; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
42 |
} |
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 |
String jdk_path = System.getProperty("test.jdk"); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
45 |
String os_arch = Platform.getOsArch(); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
46 |
String libjsig; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
47 |
String env_var; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
48 |
if (Platform.isOSX()) { |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
49 |
libjsig = jdk_path + "/jre/lib/server/libjsig.dylib"; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
50 |
env_var = "DYLD_INSERT_LIBRARIES"; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
51 |
} else { |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
52 |
libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so"; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
53 |
env_var = "LD_PRELOAD"; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
54 |
} |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
55 |
String java_program; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
56 |
if (Platform.isSolaris()) { |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
57 |
// 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
|
58 |
// 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
|
59 |
java_program = jdk_path + "/jre/bin/" + os_arch + "/java"; |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
60 |
} else { |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
61 |
java_program = JDKToolFinder.getJDKTool("java"); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
62 |
} |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
63 |
// 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
|
64 |
System.out.println("libjsig: " + libjsig); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
65 |
System.out.println("osArch: " + os_arch); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
66 |
System.out.println("java_program: " + java_program); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
67 |
|
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
68 |
ProcessBuilder pb = new ProcessBuilder(java_program, "-Xcheck:jni", "-version"); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
69 |
Map<String, String> env = pb.environment(); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
70 |
env.put(env_var, libjsig); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
71 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
72 |
output.shouldNotContain("libjsig is activated"); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
73 |
output.shouldHaveExitValue(0); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
74 |
|
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
75 |
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
|
76 |
env = pb.environment(); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
77 |
env.put(env_var, libjsig); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
78 |
output = new OutputAnalyzer(pb.start()); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
79 |
output.shouldContain("libjsig is activated"); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
80 |
output.shouldHaveExitValue(0); |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
81 |
} |
6a9f968b7b05
7121403: [TESTBUG] runtime/7051189/Xchecksig.sh fails on 64bit solaris
hseigel
parents:
diff
changeset
|
82 |
} |