Path: blob/master/test/jdk/sun/security/krb5/runNameEquals.sh
41149 views
#1# Copyright (c) 2009, 2020, Oracle and/or its affiliates. All rights reserved.2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3#4# This code is free software; you can redistribute it and/or modify it5# under the terms of the GNU General Public License version 2 only, as6# published by the Free Software Foundation.7#8# This code is distributed in the hope that it will be useful, but WITHOUT9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11# version 2 for more details (a copy is included in the LICENSE file that12# accompanied this code).13#14# You should have received a copy of the GNU General Public License version15# 2 along with this work; if not, write to the Free Software Foundation,16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17#18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19# or visit www.oracle.com if you need additional information or have any20# questions.21#2223# @test24# @bug 6317711 6944847 802404625# @summary Ensure the GSSName has the correct impl which respects26# the contract for equals and hashCode across different configurations.2728# set a few environment variables so that the shell-script can run stand-alone29# in the source directory3031if [ "${TESTSRC}" = "" ] ; then32TESTSRC="."33fi3435if [ "${TESTCLASSES}" = "" ] ; then36TESTCLASSES="."37fi3839if [ "${TESTJAVA}" = "" ] ; then40echo "TESTJAVA not set. Test cannot execute."41echo "FAILED!!!"42exit 143fi4445if [ "${COMPILEJAVA}" = "" ]; then46COMPILEJAVA="${TESTJAVA}"47fi4849NATIVE=false5051# set platform-dependent variables52OS=`uname -s`53case "$OS" in54Linux | Darwin )55PATHSEP=":"56FILESEP="/"57NATIVE=true58# Not all *nix has native GSS libs installed59krb5-config --libs 2> /dev/null60if [ $? != 0 ]; then61# Fedora has a different path62/usr/kerberos/bin/krb5-config --libs 2> /dev/null63if [ $? != 0 ]; then64NATIVE=false65fi66fi67;;68AIX )69PATHSEP=":"70FILESEP="/"71;;72CYGWIN* )73PATHSEP=";"74FILESEP="/"75;;76Windows* )77PATHSEP=";"78FILESEP="\\"79;;80* )81echo "Unrecognized system!"82exit 1;83;;84esac8586TEST=Krb5NameEquals8788${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \89-d ${TESTCLASSES}${FILESEP} \90${TESTSRC}${FILESEP}${TEST}.java9192EXIT_STATUS=09394if [ "${NATIVE}" = "true" ] ; then95echo "Testing native provider"96${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \97-classpath ${TESTCLASSES} \98-Dsun.security.jgss.native=true \99${TEST}100if [ $? != 0 ] ; then101echo "Native provider fails"102EXIT_STATUS=1103if [ "$OS" = "Linux" -a `arch` = "x86_64" ]; then104${TESTJAVA}${FILESEP}bin${FILESEP}java -XshowSettings:properties -version 2> allprop105cat allprop | grep sun.arch.data.model | grep 32106if [ "$?" = "0" ]; then107echo "Running 32-bit JDK on 64-bit Linux. Maybe only 64-bit library is installed."108echo "Please manually check if this is the case. Treated as PASSED now."109EXIT_STATUS=0110fi111fi112fi113fi114115echo "Testing java provider"116${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \117-classpath ${TESTCLASSES} \118-Djava.security.krb5.realm=R \119-Djava.security.krb5.kdc=127.0.0.1 \120${TEST}121if [ $? != 0 ] ; then122echo "Java provider fails"123EXIT_STATUS=1124fi125126exit ${EXIT_STATUS}127128129