test/runtime/7051189/Xchecksig.sh

Thu, 18 Jul 2013 03:38:10 -0700

author
cl
date
Thu, 18 Jul 2013 03:38:10 -0700
changeset 5396
bb416ee2a79b
parent 4831
04d6d4322c6a
permissions
-rw-r--r--

Added tag jdk8-b99 for changeset 81b6cb70717c

     1 # 
     2 #  Copyright (c) 2011, 2012, 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 # 
    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 #
    31 if [ "${TESTSRC}" = "" ]
    32 then
    33   TESTSRC=${PWD}
    34   echo "TESTSRC not set.  Using "${TESTSRC}" as default"
    35 fi
    36 echo "TESTSRC=${TESTSRC}"
    37 ## Adding common setup Variables for running shell tests.
    38 . ${TESTSRC}/../../test_env.sh
    40 OS=`uname -s`
    41 case "$OS" in
    42   Windows_* | CYGWIN_* )
    43     printf "Not testing libjsig.so on Windows. PASSED.\n "
    44     exit 0
    45     ;;
    46 esac
    48 JAVA=${TESTJAVA}${FS}bin${FS}java
    50 # LD_PRELOAD arch needs to match the binary we run, so run the java
    51 # 64-bit binary directly if we are testing 64-bit (bin/ARCH/java).
    52 # Check if TESTVMOPS contains -d64, but cannot use 
    53 # java ${TESTVMOPS} to run "java -d64"  with LD_PRELOAD.
    55 if [ ${OS} -eq "SunOS" ]
    56 then
    57   printf  "SunOS test TESTVMOPTS = ${TESTVMOPTS}"
    58   printf ${TESTVMOPTS} | grep d64 > /dev/null
    59   if [ $? -eq 0 ]
    60   then
    61     printf "SunOS 64-bit test\n"
    62     BIT_FLAG=-d64
    63   fi
    64 fi
    66 ARCH=`uname -p`
    67 case $ARCH in
    68   i386)
    69     if [ X${BIT_FLAG} != "X" ]
    70     then
    71       ARCH=amd64
    72       JAVA=${TESTJAVA}${FS}bin${FS}${ARCH}${FS}java
    73     fi
    74     ;;
    75   sparc)
    76     if [ X${BIT_FLAG} != "X" ]
    77     then
    78       ARCH=sparcv9
    79       JAVA=${TESTJAVA}${FS}bin${FS}${ARCH}${FS}java
    80     fi
    81     ;;
    82   * )
    83     printf "Not testing architecture $ARCH, skipping test.\n"
    84     exit 0
    85   ;; 
    86 esac
    88 LIBJSIG=${COMPILEJAVA}${FS}jre${FS}lib${FS}${ARCH}${FS}libjsig.so
    90 # If libjsig and binary do not match, skip test.
    92 A=`file ${LIBJSIG} | awk '{ print $3 }'`
    93 B=`file ${JAVA}    | awk '{ print $3 }'`
    95 if [ $A -ne $B ]
    96 then
    97   printf "Mismatching binary and library to preload, skipping test.\n"
    98   exit 0
    99 fi
   101 if [ ! -f ${LIBJSIG} ]
   102 then
   103   printf "Skipping test: libjsig missing for given architecture: ${LIBJSIG}\n"
   104   exit 0
   105 fi
   106 # Use java -version to test, java version info appears on stderr,
   107 # the libjsig message we are removing appears on stdout.
   109 # grep returns zero meaning found, non-zero means not found:
   111 LD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -version 2>&1  | grep "libjsig is activated"
   112 if [ $? -eq 0 ]; then
   113   printf "Failed: -Xcheck:jni prints message when libjsig.so is loaded.\n"
   114   exit 1
   115 fi
   118 LD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -verbose:jni -version 2>&1 | grep "libjsig is activated"
   119 if [ $? != 0 ]; then
   120   printf "Failed: -Xcheck:jni does not print message when libjsig.so is loaded and -verbose:jni is set.\n"
   121   exit 1
   122 fi
   124 printf "PASSED\n"
   125 exit 0

mercurial