Mercurial > hg > graal-compiler
comparison test/runtime/7051189/Xchecksig.sh @ 3956:3607aac85aa9
7051189: Need to suppress info message if -xcheck:jni used with libjsig.so
Reviewed-by: coleenp, minqi
author | kevinw |
---|---|
date | Thu, 22 Sep 2011 16:48:41 +0100 |
parents | |
children | 037973617842 |
comparison
equal
deleted
inserted
replaced
3955:86cbe939f0c7 | 3956:3607aac85aa9 |
---|---|
1 # | |
2 # Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. | |
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 # | |
5 # This code is free software; you can redistribute it and/or modify it | |
6 # under the terms of the GNU General Public License version 2 only, as | |
7 # published by the Free Software Foundation. | |
8 # | |
9 # This code is distributed in the hope that it will be useful, but WITHOUT | |
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 # version 2 for more details (a copy is included in the LICENSE file that | |
13 # accompanied this code). | |
14 # | |
15 # You should have received a copy of the GNU General Public License version | |
16 # 2 along with this work; if not, write to the Free Software Foundation, | |
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 # | |
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 # or visit www.oracle.com if you need additional information or have any | |
21 # questions. | |
22 # | |
23 | |
24 | |
25 # @test Xchecksig.sh | |
26 # @bug 7051189 | |
27 # @summary Need to suppress info message if -xcheck:jni used with libjsig.so | |
28 # @run shell Xchecksig.sh | |
29 # | |
30 | |
31 if [ "${TESTSRC}" = "" ] | |
32 then TESTSRC=. | |
33 fi | |
34 | |
35 if [ "${TESTJAVA}" = "" ] | |
36 then | |
37 PARENT=`dirname \`which java\`` | |
38 TESTJAVA=`dirname ${PARENT}` | |
39 printf "TESTJAVA not set, selecting " ${TESTJAVA} | |
40 printf " If this is incorrect, try setting the variable manually.\n" | |
41 fi | |
42 | |
43 | |
44 BIT_FLAG="" | |
45 | |
46 OS=`uname -s` | |
47 case "$OS" in | |
48 SunOS | Linux ) | |
49 FS="/" | |
50 ## for solaris, linux it's HOME | |
51 FILE_LOCATION=$HOME | |
52 if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ] | |
53 then | |
54 BIT_FLAG=`cat ${FILE_LOCATION}${FS}JDK64BIT` | |
55 fi | |
56 ;; | |
57 Windows_* ) | |
58 printf "Not testing libjsig.so on Windows. PASSED.\n " | |
59 exit 0 | |
60 ;; | |
61 * ) | |
62 printf "Not testing libjsig.so on unrecognised system. PASSED.\n " | |
63 exit 0 | |
64 ;; | |
65 esac | |
66 | |
67 | |
68 JAVA=${TESTJAVA}${FS}bin${FS}java | |
69 | |
70 # LD_PRELOAD arch needs to match the binary we run, so run the java | |
71 # 64-bit binary directly if we are testing 64-bit (bin/ARCH/java). | |
72 | |
73 # However JPRT runs: .../solaris_x64_5.10-debug/bin/java | |
74 # ..which is 32-bit, when it has built the 64-bit version to test. | |
75 # | |
76 # How does this script know we are meant to run the 64-bit version? | |
77 # Can check for the path of the binary containing "x64" on Solaris. | |
78 | |
79 if [ ${OS} -eq "SunOS" ] | |
80 then | |
81 printf "SunOS test JAVA=${JAVA}" | |
82 printf ${JAVA} | grep x64 > /dev/null | |
83 if [ $? -eq 0 ] | |
84 then | |
85 printf "SunOS x64 test, forcing -d64\n" | |
86 BIT_FLAG=-d64 | |
87 fi | |
88 fi | |
89 | |
90 ARCH=`uname -p` | |
91 case $ARCH in | |
92 i386) | |
93 if [ X${BIT_FLAG} != "X" ] | |
94 then | |
95 ARCH=amd64 | |
96 JAVA=${TESTJAVA}${FS}bin${FS}${ARCH}${FS}java | |
97 fi | |
98 ;; | |
99 sparc) | |
100 if [ X${BIT_FLAG} != "X" ] | |
101 then | |
102 ARCH=sparcv9 | |
103 JAVA=${TESTJAVA}${FS}bin${FS}${ARCH}${FS}java | |
104 fi | |
105 ;; | |
106 * ) | |
107 printf "Not testing architecture $ARCH, skipping test.\n" | |
108 exit 0 | |
109 ;; | |
110 esac | |
111 | |
112 LIBJSIG=${TESTJAVA}${FS}jre${FS}lib${FS}${ARCH}${FS}libjsig.so | |
113 | |
114 # If libjsig and binary do not match, skip test. | |
115 | |
116 A=`file ${LIBJSIG} | awk '{ print $3 }'` | |
117 B=`file ${JAVA} | awk '{ print $3 }'` | |
118 | |
119 if [ $A -ne $B ] | |
120 then | |
121 printf "Mismatching binary and library to preload, skipping test.\n" | |
122 exit 0 | |
123 fi | |
124 | |
125 if [ ! -f ${LIBJSIG} ] | |
126 then | |
127 printf "Skipping test: libjsig missing for given architecture: ${LIBJSIG}\n" | |
128 exit 0 | |
129 fi | |
130 # Use java -version to test, java version info appeas on stderr, | |
131 # the libjsig message we are removing appears on stdout. | |
132 | |
133 # grep returns zero meaning found, non-zero means not found: | |
134 | |
135 LD_PRELOAD=${LIBJSIG} ${JAVA} ${BIT_FLAG} -Xcheck:jni -version 2>&1 | grep "libjsig is activated" | |
136 | |
137 if [ $? -eq 0 ]; then | |
138 printf "Failed: -Xcheck:jni prints message when libjsig.so is loaded.\n" | |
139 exit 1 | |
140 fi | |
141 | |
142 | |
143 LD_PRELOAD=${LIBJSIG} ${JAVA} ${BIT_FLAG} -Xcheck:jni -verbose:jni -version 2>&1 | grep "libjsig is activated" | |
144 if [ $? != 0 ]; then | |
145 printf "Failed: -Xcheck:jni does not print message when libjsig.so is loaded and -verbose:jni is set.\n" | |
146 exit 1 | |
147 fi | |
148 | |
149 printf "PASSED\n" | |
150 exit 0 | |
151 |