J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | # |
| 2 | # Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | # |
| 5 | # This code is free software; you can redistribute it and/or modify it |
| 6 | # under the terms of the GNU General Public License version 2 only, as |
| 7 | # published by the Free Software Foundation. |
| 8 | # |
| 9 | # This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | # version 2 for more details (a copy is included in the LICENSE file that |
| 13 | # accompanied this code). |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License version |
| 16 | # 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | # |
| 19 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 20 | # CA 95054 USA or visit www.sun.com if you need additional information or |
| 21 | # have any questions. |
| 22 | # |
| 23 | |
| 24 | # @test |
| 25 | # @summary (almost) all keytool behaviors |
| 26 | # @author Weijun Wang |
| 27 | # |
| 28 | # set a few environment variables so that the shell-script can run stand-alone |
| 29 | # in the source directory |
| 30 | if [ "${TESTSRC}" = "" ] ; then |
| 31 | TESTSRC="." |
| 32 | fi |
| 33 | if [ "${TESTCLASSES}" = "" ] ; then |
| 34 | TESTCLASSES="." |
| 35 | fi |
| 36 | if [ "${TESTJAVA}" = "" ] ; then |
| 37 | echo "TESTJAVA not set. Test cannot execute." |
| 38 | echo "FAILED!!!" |
| 39 | exit 1 |
| 40 | fi |
| 41 | |
| 42 | # set platform-dependent variables |
| 43 | OS=`uname -s` |
| 44 | case "$OS" in |
| 45 | SunOS ) |
| 46 | FS="/" |
| 47 | LIBNAME=libsoftokn3.so |
| 48 | ARCH=`isainfo` |
| 49 | case "$ARCH" in |
| 50 | sparc* ) |
| 51 | PF="solaris-sparc" |
| 52 | ;; |
| 53 | * ) |
| 54 | echo "Will not run test on: Solaris ${ARCH}" |
| 55 | exit 0; |
| 56 | ;; |
| 57 | esac |
| 58 | ;; |
| 59 | Linux ) |
| 60 | LIBNAME=libsoftokn3.so |
| 61 | ARCH=`uname -m` |
| 62 | FS="/" |
| 63 | case "$ARCH" in |
| 64 | i[3-6]86 ) |
| 65 | PF="linux-i586" |
| 66 | ;; |
| 67 | * ) |
| 68 | echo "Will not run test on: Linux ${ARCH}" |
| 69 | exit 0; |
| 70 | ;; |
| 71 | esac |
| 72 | ;; |
| 73 | * ) |
| 74 | echo "Will not run test on: ${OS}" |
| 75 | exit 0; |
| 76 | ;; |
| 77 | esac |
| 78 | |
| 79 | ${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}KeyToolTest.java || exit 10 |
| 80 | |
| 81 | NSS=${TESTSRC}${FS}..${FS}..${FS}pkcs11${FS}nss |
| 82 | |
| 83 | cp ${TESTSRC}${FS}p11-nss.txt . |
| 84 | cp ${NSS}${FS}db${FS}cert8.db . |
| 85 | cp ${NSS}${FS}db${FS}key3.db . |
| 86 | cp ${NSS}${FS}db${FS}secmod.db . |
| 87 | |
| 88 | chmod u+w key3.db |
| 89 | chmod u+w cert8.db |
| 90 | |
| 91 | echo | ${TESTJAVA}${FS}bin${FS}java -Dfile -Dnss \ |
| 92 | -Dnss.lib=${NSS}${FS}lib${FS}${PF}${FS}${LIBNAME} \ |
| 93 | KeyToolTest || exit 12 |
| 94 | |
| 95 | rm -f p11-nss.txt |
| 96 | rm -f cert8.db |
| 97 | rm -f key3.db |
| 98 | rm -f secmod.db |
| 99 | |
| 100 | rm HumanInputStream*.class |
| 101 | rm KeyToolTest.class |
| 102 | rm TestException.class |
| 103 | |
| 104 | exit $? |