annotate test/sun/security/tools/keytool/autotest.sh @ 12494:599bc77c104f

8057810: New defaults for DSA keys in jarsigner and keytool Reviewed-by: coffeys, valeriep Contributed-by: prasadarao.koppula@oracle.com
author rpatil
date Tue, 15 Aug 2017 11:46:02 -0700
parents 402c7687ed6c
children
rev   line source
duke@0 1 #
rpatil@12494 2 # Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
duke@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 #
duke@0 5 # This code is free software; you can redistribute it and/or modify it
duke@0 6 # under the terms of the GNU General Public License version 2 only, as
duke@0 7 # published by the Free Software Foundation.
duke@0 8 #
duke@0 9 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 # accompanied this code).
duke@0 14 #
duke@0 15 # You should have received a copy of the GNU General Public License version
duke@0 16 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 #
ohair@2362 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@2362 20 # or visit www.oracle.com if you need additional information or have any
ohair@2362 21 # questions.
duke@0 22 #
duke@0 23
duke@0 24 # @test
duke@0 25 # @summary (almost) all keytool behaviors
duke@0 26 # @author Weijun Wang
duke@0 27 #
weijun@903 28 # This test is only executed on several platforms
weijun@903 29 #
duke@0 30 # set a few environment variables so that the shell-script can run stand-alone
duke@0 31 # in the source directory
duke@0 32 if [ "${TESTSRC}" = "" ] ; then
duke@0 33 TESTSRC="."
duke@0 34 fi
duke@0 35 if [ "${TESTCLASSES}" = "" ] ; then
duke@0 36 TESTCLASSES="."
duke@0 37 fi
duke@0 38 if [ "${TESTJAVA}" = "" ] ; then
duke@0 39 echo "TESTJAVA not set. Test cannot execute."
duke@0 40 echo "FAILED!!!"
duke@0 41 exit 1
duke@0 42 fi
alanb@6383 43 if [ "${COMPILEJAVA}" = "" ]; then
alanb@6383 44 COMPILEJAVA="${TESTJAVA}"
alanb@6383 45 fi
duke@0 46
weijun@5867 47 find_one() {
weijun@5867 48 for TARGET_FILE in $@; do
weijun@5867 49 if [ -e "$TARGET_FILE" ]; then
weijun@5867 50 echo $TARGET_FILE
weijun@5867 51 return
weijun@5867 52 fi
weijun@5867 53 done
weijun@5867 54 }
weijun@5867 55
weijun@8357 56 FS="/"
weijun@8357 57 ${TESTJAVA}${FS}bin${FS}java -XshowSettings:properties -version 2> allprop
weijun@8357 58 cat allprop | grep sun.arch.data.model | grep 32
weijun@8357 59 if [ "$?" != "0" ]; then
weijun@8357 60 B32=false
weijun@8357 61 else
weijun@8357 62 B32=true
weijun@8357 63 fi
weijun@8357 64
duke@0 65 # set platform-dependent variables
duke@0 66 OS=`uname -s`
duke@0 67 case "$OS" in
duke@0 68 SunOS )
duke@0 69 FS="/"
ksrini@8187 70 LIBNAME="/usr/lib/mps/`isainfo -n`/libsoftokn3.so"
duke@0 71 ;;
duke@0 72 Linux )
weijun@8357 73 if [ $B32 = true ]; then
weijun@5867 74 LIBNAME=`find_one \
vinnie@9680 75 "/usr/lib32/libsoftokn3.so" \
vinnie@9680 76 "/usr/lib32/nss/libsoftokn3.so" \
weijun@5867 77 "/usr/lib/libsoftokn3.so" \
weijun@8466 78 "/usr/lib/i386-linux-gnu/nss/libsoftokn3.so" \
weijun@8466 79 "/usr/lib/nss/libsoftokn3.so"`
weijun@5919 80 else
weijun@5867 81 LIBNAME=`find_one \
weijun@5867 82 "/usr/lib64/libsoftokn3.so" \
weijun@8466 83 "/usr/lib/x86_64-linux-gnu/nss/libsoftokn3.so" \
weijun@8466 84 "/usr/lib/nss/libsoftokn3.so"`
weijun@5919 85 fi
duke@0 86 ;;
duke@0 87 * )
duke@0 88 echo "Will not run test on: ${OS}"
duke@0 89 exit 0;
duke@0 90 ;;
duke@0 91 esac
duke@0 92
weijun@5867 93 if [ "$LIBNAME" = "" ]; then
sflores@5976 94 echo "Cannot find libsoftokn3.so"
weijun@8357 95 exit 0
weijun@5867 96 fi
weijun@5867 97
alanb@6383 98 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . -XDignore.symbol.file \
weijun@5867 99 ${TESTSRC}${FS}KeyToolTest.java || exit 10
duke@0 100
duke@0 101 NSS=${TESTSRC}${FS}..${FS}..${FS}pkcs11${FS}nss
duke@0 102
duke@0 103 cp ${TESTSRC}${FS}p11-nss.txt .
duke@0 104 cp ${NSS}${FS}db${FS}cert8.db .
duke@0 105 cp ${NSS}${FS}db${FS}key3.db .
duke@0 106 cp ${NSS}${FS}db${FS}secmod.db .
duke@0 107
duke@0 108 chmod u+w key3.db
duke@0 109 chmod u+w cert8.db
duke@0 110
weijun@903 111 echo | ${TESTJAVA}${FS}bin${FS}java -Dnss \
weijun@5867 112 -Dnss.lib=${LIBNAME} \
weijun@321 113 KeyToolTest
weijun@321 114 status=$?
duke@0 115
weijun@321 116 exit $status