2792N/A#
3743N/A# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
2792N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2792N/A#
2792N/A# This code is free software; you can redistribute it and/or modify it
2792N/A# under the terms of the GNU General Public License version 2 only, as
2792N/A# published by the Free Software Foundation.
2792N/A#
2792N/A# This code is distributed in the hope that it will be useful, but WITHOUT
2792N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2792N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2792N/A# version 2 for more details (a copy is included in the LICENSE file that
2792N/A# accompanied this code).
2792N/A#
2792N/A# You should have received a copy of the GNU General Public License version
2792N/A# 2 along with this work; if not, write to the Free Software Foundation,
2792N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2792N/A#
2792N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2792N/A# or visit www.oracle.com if you need additional information or have any
2792N/A# questions.
2792N/A#
2792N/A
2792N/A
2792N/A# @test Xchecksig.sh
2792N/A# @bug 7051189
2792N/A# @summary Need to suppress info message if -xcheck:jni used with libjsig.so
2792N/A# @run shell Xchecksig.sh
2792N/A#
2792N/A
2792N/Aif [ "${TESTSRC}" = "" ]
4503N/Athen
4503N/A TESTSRC=${PWD}
4503N/A echo "TESTSRC not set. Using "${TESTSRC}" as default"
2792N/Afi
4503N/Aecho "TESTSRC=${TESTSRC}"
4503N/A## Adding common setup Variables for running shell tests.
4503N/A. ${TESTSRC}/../../test_env.sh
2792N/A
2792N/AOS=`uname -s`
2792N/Acase "$OS" in
3985N/A Windows_* | CYGWIN_* )
2792N/A printf "Not testing libjsig.so on Windows. PASSED.\n "
2792N/A exit 0
2792N/A ;;
2792N/Aesac
2792N/A
2792N/AJAVA=${TESTJAVA}${FS}bin${FS}java
2792N/A
2792N/A# LD_PRELOAD arch needs to match the binary we run, so run the java
2792N/A# 64-bit binary directly if we are testing 64-bit (bin/ARCH/java).
3743N/A# Check if TESTVMOPS contains -d64, but cannot use
3743N/A# java ${TESTVMOPS} to run "java -d64" with LD_PRELOAD.
2792N/A
2792N/Aif [ ${OS} -eq "SunOS" ]
2792N/Athen
3743N/A printf "SunOS test TESTVMOPTS = ${TESTVMOPTS}"
3743N/A printf ${TESTVMOPTS} | grep d64 > /dev/null
2792N/A if [ $? -eq 0 ]
2792N/A then
3743N/A printf "SunOS 64-bit test\n"
2792N/A BIT_FLAG=-d64
2792N/A fi
2792N/Afi
2792N/A
2792N/AARCH=`uname -p`
2792N/Acase $ARCH in
2792N/A i386)
2792N/A if [ X${BIT_FLAG} != "X" ]
2792N/A then
2792N/A ARCH=amd64
2792N/A JAVA=${TESTJAVA}${FS}bin${FS}${ARCH}${FS}java
2792N/A fi
2792N/A ;;
2792N/A sparc)
2792N/A if [ X${BIT_FLAG} != "X" ]
2792N/A then
2792N/A ARCH=sparcv9
2792N/A JAVA=${TESTJAVA}${FS}bin${FS}${ARCH}${FS}java
2792N/A fi
2792N/A ;;
2792N/A * )
2792N/A printf "Not testing architecture $ARCH, skipping test.\n"
2792N/A exit 0
2792N/A ;;
2792N/Aesac
2792N/A
4503N/ALIBJSIG=${COMPILEJAVA}${FS}jre${FS}lib${FS}${ARCH}${FS}libjsig.so
2792N/A
2792N/A# If libjsig and binary do not match, skip test.
2792N/A
2792N/AA=`file ${LIBJSIG} | awk '{ print $3 }'`
2792N/AB=`file ${JAVA} | awk '{ print $3 }'`
2792N/A
2792N/Aif [ $A -ne $B ]
2792N/Athen
2792N/A printf "Mismatching binary and library to preload, skipping test.\n"
2792N/A exit 0
2792N/Afi
2792N/A
2792N/Aif [ ! -f ${LIBJSIG} ]
2792N/Athen
2792N/A printf "Skipping test: libjsig missing for given architecture: ${LIBJSIG}\n"
2792N/A exit 0
2792N/Afi
3743N/A# Use java -version to test, java version info appears on stderr,
2792N/A# the libjsig message we are removing appears on stdout.
2792N/A
2792N/A# grep returns zero meaning found, non-zero means not found:
2792N/A
3743N/ALD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -version 2>&1 | grep "libjsig is activated"
2792N/Aif [ $? -eq 0 ]; then
2792N/A printf "Failed: -Xcheck:jni prints message when libjsig.so is loaded.\n"
2792N/A exit 1
2792N/Afi
2792N/A
2792N/A
3743N/ALD_PRELOAD=${LIBJSIG} ${JAVA} ${TESTVMOPTS} -Xcheck:jni -verbose:jni -version 2>&1 | grep "libjsig is activated"
2792N/Aif [ $? != 0 ]; then
2792N/A printf "Failed: -Xcheck:jni does not print message when libjsig.so is loaded and -verbose:jni is set.\n"
2792N/A exit 1
2792N/Afi
2792N/A
2792N/Aprintf "PASSED\n"
2792N/Aexit 0
2792N/A