blob: 5376b257a4ed21e3bcb27a7f53c6f211b8ede352 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001#
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
30if [ "${TESTSRC}" = "" ] ; then
31 TESTSRC="."
32fi
33if [ "${TESTCLASSES}" = "" ] ; then
34 TESTCLASSES="."
35fi
36if [ "${TESTJAVA}" = "" ] ; then
37 echo "TESTJAVA not set. Test cannot execute."
38 echo "FAILED!!!"
39 exit 1
40fi
41
42# set platform-dependent variables
43OS=`uname -s`
44case "$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 ;;
77esac
78
79${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}KeyToolTest.java || exit 10
80
81NSS=${TESTSRC}${FS}..${FS}..${FS}pkcs11${FS}nss
82
83cp ${TESTSRC}${FS}p11-nss.txt .
84cp ${NSS}${FS}db${FS}cert8.db .
85cp ${NSS}${FS}db${FS}key3.db .
86cp ${NSS}${FS}db${FS}secmod.db .
87
88chmod u+w key3.db
89chmod u+w cert8.db
90
91echo | ${TESTJAVA}${FS}bin${FS}java -Dfile -Dnss \
92 -Dnss.lib=${NSS}${FS}lib${FS}${PF}${FS}${LIBNAME} \
93 KeyToolTest || exit 12
94
95rm -f p11-nss.txt
96rm -f cert8.db
97rm -f key3.db
98rm -f secmod.db
99
100rm HumanInputStream*.class
101rm KeyToolTest.class
102rm TestException.class
103
104exit $?