Path: blob/master/test/jdk/sun/security/pkcs11/Provider/MultipleLogins.sh
51712 views
#1# Copyright (c) 2021, 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 777777725# @summary26# @library /test/lib/27# @build jdk.test.lib.util.ForceGC28# @run shell MultipleLogins.sh2930# set a few environment variables so that the shell-script can run stand-alone31# in the source directory3233# if running by hand on windows, change TESTSRC and TESTCLASSES to "."34if [ "${TESTSRC}" = "" ] ; then35TESTSRC=`pwd`36fi37if [ "${TESTCLASSES}" = "" ] ; then38TESTCLASSES=`pwd`39fi4041if [ "${TESTCLASSPATH}" = "" ] ; then42TESTCLASSPATH=`pwd`43fi4445if [ "${COMPILEJAVA}" = "" ]; then46COMPILEJAVA="${TESTJAVA}"47fi48echo TESTSRC=${TESTSRC}49echo TESTCLASSES=${TESTCLASSES}50echo TESTJAVA=${TESTJAVA}51echo COMPILEJAVA=${COMPILEJAVA}52echo ""5354# let java test exit if platform unsupported5556OS=`uname -s`57case "$OS" in58Linux )59FS="/"60PS=":"61CP="${FS}bin${FS}cp"62CHMOD="${FS}bin${FS}chmod"63;;64Darwin )65FS="/"66PS=":"67CP="${FS}bin${FS}cp"68CHMOD="${FS}bin${FS}chmod"69;;70AIX )71FS="/"72PS=":"73CP="${FS}bin${FS}cp"74CHMOD="${FS}bin${FS}chmod"75;;76Windows* )77FS="\\"78PS=";"79CP="cp"80CHMOD="chmod"81;;82CYGWIN* )83FS="/"84PS=";"85CP="cp"86CHMOD="chmod"87#88# javac does not like /cygdrive produced by `pwd`89#90TESTSRC=`cygpath -d ${TESTSRC}`91;;92* )93echo "Unrecognized system!"94exit 1;95;;96esac9798# first make cert/key DBs writable99100${CP} ${TESTSRC}${FS}..${FS}nss${FS}db${FS}cert8.db ${TESTCLASSES}101${CHMOD} +w ${TESTCLASSES}${FS}cert8.db102103${CP} ${TESTSRC}${FS}..${FS}nss${FS}db${FS}key3.db ${TESTCLASSES}104${CHMOD} +w ${TESTCLASSES}${FS}key3.db105106# compile test107${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \108-classpath ${TESTCLASSPATH} \109-d ${TESTCLASSES} \110--add-modules jdk.crypto.cryptoki \111--add-exports jdk.crypto.cryptoki/sun.security.pkcs11=ALL-UNNAMED \112${TESTSRC}${FS}..${FS}..${FS}..${FS}..${FS}..${FS}lib${FS}jdk${FS}test${FS}lib${FS}artifacts${FS}*.java \113${TESTSRC}${FS}MultipleLogins.java \114${TESTSRC}${FS}..${FS}PKCS11Test.java115116# run test117${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \118-classpath ${TESTCLASSPATH} \119--add-modules jdk.crypto.cryptoki \120--add-exports jdk.crypto.cryptoki/sun.security.pkcs11=ALL-UNNAMED \121-DCUSTOM_DB_DIR=${TESTCLASSES} \122-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}MultipleLogins-nss.txt \123-DNO_DEFAULT=true \124-DNO_DEIMOS=true \125-Dtest.src=${TESTSRC} \126-Dtest.classes=${TESTCLASSES} \127-Djava.security.debug=${DEBUG} \128MultipleLogins129130# save error status131status=$?132133# return134exit $status135136137