Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/pkcs11/KeyStore/Solaris.sh
38855 views
#1# Copyright (c) 2004, 2013, 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 503865925# @summary Enable PKCS#11 KeyStore for SunPKCS11-Solaris26#27# @run shell Solaris.sh2829# To run by hand:30# %sh Solaris.sh <recompile> [yes|no]31# <command> [list|basic]32#33# %sh Solaris.sh no list34#35# Note:36# . test only runs on solaris at the moment37# . 'list' lists the token aliases38# . 'basic' tests different things3940# set a few environment variables so that the shell-script can run stand-alone41# in the source directory4243# if running by hand on windows, change TESTSRC and TESTCLASSES to "."44if [ "${TESTSRC}" = "" ] ; then45TESTSRC=`pwd`46fi47if [ "${TESTCLASSES}" = "" ] ; then48TESTCLASSES=`pwd`49fi5051# if running by hand on windows, change this to appropriate value52if [ "${TESTJAVA}" = "" ] ; then53TESTJAVA="/net/radiant/export1/charlie/mustang/build/solaris-sparc"54fi55if [ "${COMPILEJAVA}" = "" ]; then56COMPILEJAVA="${TESTJAVA}"57fi58echo TESTSRC=${TESTSRC}59echo TESTCLASSES=${TESTCLASSES}60echo TESTJAVA=${TESTJAVA}61echo COMPILEJAVA=${COMPILEJAVA}62echo ""6364# get command from input args -65# default to 'solaris basic'6667RECOMPILE="yes"68if [ $# = '2' ] ; then69RECOMPILE=$170TEST=$271elif [ $# = '1' ] ; then72TEST=$173else74TEST="basic"75fi7677DEBUG=sunpkcs11,pkcs11keystore7879echo RECOMPILE=${RECOMPILE}80echo TEST=${TEST}81echo DEBUG=${DEBUG}82echo ""8384OS=`uname -s`85case "$OS" in86SunOS )87FS="/"88PS=":"89SCCS="${FS}usr${FS}ccs${FS}bin${FS}sccs"90CP="${FS}bin${FS}cp -f"91RM="${FS}bin${FS}rm -rf"92MKDIR="${FS}bin${FS}mkdir -p"93CHMOD="${FS}bin${FS}chmod"94;;95* )96echo "Unsupported System ${OS} - Test only runs on Solaris 10"97exit 0;98;;99esac100101OS_VERSION=`uname -r`102case "$OS_VERSION" in1035.1* )104SOFTTOKEN_DIR=${TESTCLASSES}105export SOFTTOKEN_DIR106;;107* )108echo "Unsupported Version ${OS_VERSION} - Test only runs on Solaris 10"109exit 0;110;;111esac112113# copy keystore into write-able location114115echo "Removing old pkcs11_keystore, creating new pkcs11_keystore"116117echo ${RM} ${TESTCLASSES}${FS}pkcs11_softtoken118${RM} ${TESTCLASSES}${FS}pkcs11_softtoken119120echo ${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}private121${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}private122123echo ${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}public124${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}public125126echo ${CP} ${TESTSRC}${FS}BasicData${FS}pkcs11_softtoken${FS}objstore_info \127${TESTCLASSES}${FS}pkcs11_softtoken128${CP} ${TESTSRC}${FS}BasicData${FS}pkcs11_softtoken${FS}objstore_info \129${TESTCLASSES}${FS}pkcs11_softtoken130131echo ${CHMOD} +w ${TESTCLASSES}${FS}pkcs11_softtoken${FS}objstore_info132${CHMOD} 600 ${TESTCLASSES}${FS}pkcs11_softtoken${FS}objstore_info133134# compile test135136if [ "${RECOMPILE}" = "yes" ] ; then137cd ${TESTCLASSES}138${RM} *.class139${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \140-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \141-d ${TESTCLASSES} \142${TESTSRC}${FS}Basic.java \143${TESTSRC}${FS}..${FS}PKCS11Test.java144fi145146# run test147148cd ${TESTSRC}149${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \150-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \151-DDIR=${TESTSRC}${FS}BasicData${FS} \152-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-solaris.txt \153-DNO_DEFAULT=true \154-DNO_DEIMOS=true \155-DTOKEN=solaris \156-DTEST=${TEST} \157-Djava.security.manager \158-Djava.security.policy=${TESTSRC}${FS}Basic.policy \159-Djava.security.debug=${DEBUG} \160Basic161162# clean up163164#${RM} ${TESTCLASSES}${FS}pkcs11_softtoken165166# return167168exit $?169170171