Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/tools/keytool/autotest.sh
38854 views
#1# Copyright (c) 2006, 2017, 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# @summary (almost) all keytool behaviors25# @author Weijun Wang26#27# This test is only executed on several platforms28#29# set a few environment variables so that the shell-script can run stand-alone30# in the source directory31if [ "${TESTSRC}" = "" ] ; then32TESTSRC="."33fi34if [ "${TESTCLASSES}" = "" ] ; then35TESTCLASSES="."36fi37if [ "${TESTJAVA}" = "" ] ; then38echo "TESTJAVA not set. Test cannot execute."39echo "FAILED!!!"40exit 141fi42if [ "${COMPILEJAVA}" = "" ]; then43COMPILEJAVA="${TESTJAVA}"44fi4546find_one() {47for TARGET_FILE in $@; do48if [ -e "$TARGET_FILE" ]; then49echo $TARGET_FILE50return51fi52done53}5455FS="/"56${TESTJAVA}${FS}bin${FS}java -XshowSettings:properties -version 2> allprop57cat allprop | grep sun.arch.data.model | grep 3258if [ "$?" != "0" ]; then59B32=false60else61B32=true62fi6364# set platform-dependent variables65OS=`uname -s`66case "$OS" in67SunOS )68FS="/"69LIBNAME="/usr/lib/mps/`isainfo -n`/libsoftokn3.so"70;;71Linux )72if [ $B32 = true ]; then73LIBNAME=`find_one \74"/usr/lib32/libsoftokn3.so" \75"/usr/lib32/nss/libsoftokn3.so" \76"/usr/lib/libsoftokn3.so" \77"/usr/lib/i386-linux-gnu/nss/libsoftokn3.so" \78"/usr/lib/nss/libsoftokn3.so"`79else80LIBNAME=`find_one \81"/usr/lib64/libsoftokn3.so" \82"/usr/lib/x86_64-linux-gnu/nss/libsoftokn3.so" \83"/usr/lib/nss/libsoftokn3.so"`84fi85;;86* )87echo "Will not run test on: ${OS}"88exit 0;89;;90esac9192if [ "$LIBNAME" = "" ]; then93echo "Cannot find libsoftokn3.so"94exit 095fi9697${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . -XDignore.symbol.file \98${TESTSRC}${FS}KeyToolTest.java || exit 1099100NSS=${TESTSRC}${FS}..${FS}..${FS}pkcs11${FS}nss101102cp ${TESTSRC}${FS}p11-nss.txt .103cp ${NSS}${FS}db${FS}cert8.db .104cp ${NSS}${FS}db${FS}key3.db .105cp ${NSS}${FS}db${FS}secmod.db .106107chmod u+w key3.db108chmod u+w cert8.db109110echo | ${TESTJAVA}${FS}bin${FS}java -Dnss \111-Dnss.lib=${LIBNAME} \112KeyToolTest113status=$?114115exit $status116117118