test/runtime/7051189/Xchecksig.sh

Thu, 15 Mar 2012 15:15:16 -0700

author
katleman
date
Thu, 15 Mar 2012 15:15:16 -0700
changeset 3617
02ba95965d78
parent 3152
3607aac85aa9
child 3777
037973617842
permissions
-rw-r--r--

Added tag jdk8-b30 for changeset d61761bf3050

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

mercurial