test/runtime/7051189/Xchecksig.sh

Thu, 20 Sep 2012 13:44:28 -0700

author
katleman
date
Thu, 20 Sep 2012 13:44:28 -0700
changeset 4035
da0d652d0c2f
parent 4022
83b6305a5638
child 4831
04d6d4322c6a
permissions
-rw-r--r--

Added tag jdk8-b57 for changeset d70102c4cb73

kevinw@3152 1 #
kevinw@3777 2 # Copyright (c) 2011, 2012, 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 OS=`uname -s`
kevinw@3152 45 case "$OS" in
coleenp@3985 46 SunOS | Linux | Darwin )
kevinw@3152 47 FS="/"
kevinw@3152 48 ;;
coleenp@4022 49 Windows_* | CYGWIN_* )
kevinw@3152 50 printf "Not testing libjsig.so on Windows. PASSED.\n "
kevinw@3152 51 exit 0
kevinw@3152 52 ;;
kevinw@3152 53 * )
kevinw@3152 54 printf "Not testing libjsig.so on unrecognised system. PASSED.\n "
kevinw@3152 55 exit 0
kevinw@3152 56 ;;
kevinw@3152 57 esac
kevinw@3152 58
kevinw@3152 59
kevinw@3152 60 JAVA=${TESTJAVA}${FS}bin${FS}java
kevinw@3152 61
kevinw@3152 62 # LD_PRELOAD arch needs to match the binary we run, so run the java
kevinw@3152 63 # 64-bit binary directly if we are testing 64-bit (bin/ARCH/java).
kevinw@3777 64 # Check if TESTVMOPS contains -d64, but cannot use
kevinw@3777 65 # java ${TESTVMOPS} to run "java -d64" with LD_PRELOAD.
kevinw@3152 66
kevinw@3152 67 if [ ${OS} -eq "SunOS" ]
kevinw@3152 68 then
kevinw@3777 69 printf "SunOS test TESTVMOPTS = ${TESTVMOPTS}"
kevinw@3777 70 printf ${TESTVMOPTS} | grep d64 > /dev/null
kevinw@3152 71 if [ $? -eq 0 ]
kevinw@3152 72 then
kevinw@3777 73 printf "SunOS 64-bit test\n"
kevinw@3152 74 BIT_FLAG=-d64
kevinw@3152 75 fi
kevinw@3152 76 fi
kevinw@3152 77
kevinw@3152 78 ARCH=`uname -p`
kevinw@3152 79 case $ARCH in
kevinw@3152 80 i386)
kevinw@3152 81 if [ X${BIT_FLAG} != "X" ]
kevinw@3152 82 then
kevinw@3152 83 ARCH=amd64
kevinw@3152 84 JAVA=${TESTJAVA}${FS}bin${FS}${ARCH}${FS}java
kevinw@3152 85 fi
kevinw@3152 86 ;;
kevinw@3152 87 sparc)
kevinw@3152 88 if [ X${BIT_FLAG} != "X" ]
kevinw@3152 89 then
kevinw@3152 90 ARCH=sparcv9
kevinw@3152 91 JAVA=${TESTJAVA}${FS}bin${FS}${ARCH}${FS}java
kevinw@3152 92 fi
kevinw@3152 93 ;;
kevinw@3152 94 * )
kevinw@3152 95 printf "Not testing architecture $ARCH, skipping test.\n"
kevinw@3152 96 exit 0
kevinw@3152 97 ;;
kevinw@3152 98 esac
kevinw@3152 99
kevinw@3152 100 LIBJSIG=${TESTJAVA}${FS}jre${FS}lib${FS}${ARCH}${FS}libjsig.so
kevinw@3152 101
kevinw@3152 102 # If libjsig and binary do not match, skip test.
kevinw@3152 103
kevinw@3152 104 A=`file ${LIBJSIG} | awk '{ print $3 }'`
kevinw@3152 105 B=`file ${JAVA} | awk '{ print $3 }'`
kevinw@3152 106
kevinw@3152 107 if [ $A -ne $B ]
kevinw@3152 108 then
kevinw@3152 109 printf "Mismatching binary and library to preload, skipping test.\n"
kevinw@3152 110 exit 0
kevinw@3152 111 fi
kevinw@3152 112
kevinw@3152 113 if [ ! -f ${LIBJSIG} ]
kevinw@3152 114 then
kevinw@3152 115 printf "Skipping test: libjsig missing for given architecture: ${LIBJSIG}\n"
kevinw@3152 116 exit 0
kevinw@3152 117 fi
kevinw@3777 118 # Use java -version to test, java version info appears on stderr,
kevinw@3152 119 # the libjsig message we are removing appears on stdout.
kevinw@3152 120
kevinw@3152 121 # grep returns zero meaning found, non-zero means not found:
kevinw@3152 122
kevinw@3777 123 LD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -version 2>&1 | grep "libjsig is activated"
kevinw@3152 124 if [ $? -eq 0 ]; then
kevinw@3152 125 printf "Failed: -Xcheck:jni prints message when libjsig.so is loaded.\n"
kevinw@3152 126 exit 1
kevinw@3152 127 fi
kevinw@3152 128
kevinw@3152 129
kevinw@3777 130 LD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -verbose:jni -version 2>&1 | grep "libjsig is activated"
kevinw@3152 131 if [ $? != 0 ]; then
kevinw@3152 132 printf "Failed: -Xcheck:jni does not print message when libjsig.so is loaded and -verbose:jni is set.\n"
kevinw@3152 133 exit 1
kevinw@3152 134 fi
kevinw@3152 135
kevinw@3152 136 printf "PASSED\n"
kevinw@3152 137 exit 0
kevinw@3152 138

mercurial