author | vinnie |
Mon, 02 Dec 2013 14:19:25 +0000 | |
changeset 21948 | e8a1289096cd |
parent 15254 | 3997a6f357cb |
child 37353 | e8e684b89c81 |
permissions | -rw-r--r-- |
2 | 1 |
# |
21948
e8a1289096cd
8029369: Shell tests in sun/security/pkcs11/ do not compile PKCS11Test
vinnie
parents:
15254
diff
changeset
|
2 |
# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
# |
|
5506 | 19 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
# or visit www.oracle.com if you need additional information or have any |
|
21 |
# questions. |
|
2 | 22 |
# |
23 |
||
24 |
# @test |
|
25 |
# @bug 5038659 |
|
26 |
# @summary Enable PKCS#11 KeyStore for SunPKCS11-Solaris |
|
27 |
# |
|
28 |
# @run shell Solaris.sh |
|
29 |
||
30 |
# To run by hand: |
|
31 |
# %sh Solaris.sh <recompile> [yes|no] |
|
32 |
# <command> [list|basic] |
|
33 |
# |
|
34 |
# %sh Solaris.sh no list |
|
35 |
# |
|
36 |
# Note: |
|
37 |
# . test only runs on solaris at the moment |
|
38 |
# . 'list' lists the token aliases |
|
39 |
# . 'basic' tests different things |
|
40 |
||
41 |
# set a few environment variables so that the shell-script can run stand-alone |
|
42 |
# in the source directory |
|
43 |
||
44 |
# if running by hand on windows, change TESTSRC and TESTCLASSES to "." |
|
45 |
if [ "${TESTSRC}" = "" ] ; then |
|
46 |
TESTSRC=`pwd` |
|
47 |
fi |
|
48 |
if [ "${TESTCLASSES}" = "" ] ; then |
|
49 |
TESTCLASSES=`pwd` |
|
50 |
fi |
|
51 |
||
52 |
# if running by hand on windows, change this to appropriate value |
|
53 |
if [ "${TESTJAVA}" = "" ] ; then |
|
54 |
TESTJAVA="/net/radiant/export1/charlie/mustang/build/solaris-sparc" |
|
55 |
fi |
|
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14786
diff
changeset
|
56 |
if [ "${COMPILEJAVA}" = "" ]; then |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14786
diff
changeset
|
57 |
COMPILEJAVA="${TESTJAVA}" |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14786
diff
changeset
|
58 |
fi |
2 | 59 |
echo TESTSRC=${TESTSRC} |
60 |
echo TESTCLASSES=${TESTCLASSES} |
|
61 |
echo TESTJAVA=${TESTJAVA} |
|
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14786
diff
changeset
|
62 |
echo COMPILEJAVA=${COMPILEJAVA} |
2 | 63 |
echo "" |
64 |
||
65 |
# get command from input args - |
|
66 |
# default to 'solaris basic' |
|
67 |
||
68 |
RECOMPILE="yes" |
|
69 |
if [ $# = '2' ] ; then |
|
70 |
RECOMPILE=$1 |
|
71 |
TEST=$2 |
|
72 |
elif [ $# = '1' ] ; then |
|
73 |
TEST=$1 |
|
74 |
else |
|
75 |
TEST="basic" |
|
76 |
fi |
|
77 |
||
78 |
DEBUG=sunpkcs11,pkcs11keystore |
|
79 |
||
80 |
echo RECOMPILE=${RECOMPILE} |
|
81 |
echo TEST=${TEST} |
|
82 |
echo DEBUG=${DEBUG} |
|
83 |
echo "" |
|
84 |
||
85 |
OS=`uname -s` |
|
86 |
case "$OS" in |
|
87 |
SunOS ) |
|
88 |
FS="/" |
|
89 |
PS=":" |
|
90 |
SCCS="${FS}usr${FS}ccs${FS}bin${FS}sccs" |
|
91 |
CP="${FS}bin${FS}cp -f" |
|
92 |
RM="${FS}bin${FS}rm -rf" |
|
93 |
MKDIR="${FS}bin${FS}mkdir -p" |
|
94 |
CHMOD="${FS}bin${FS}chmod" |
|
95 |
;; |
|
96 |
* ) |
|
97 |
echo "Unsupported System ${OS} - Test only runs on Solaris 10" |
|
98 |
exit 0; |
|
99 |
;; |
|
100 |
esac |
|
101 |
||
102 |
OS_VERSION=`uname -r` |
|
103 |
case "$OS_VERSION" in |
|
104 |
5.1* ) |
|
105 |
SOFTTOKEN_DIR=${TESTCLASSES} |
|
106 |
export SOFTTOKEN_DIR |
|
107 |
;; |
|
108 |
* ) |
|
109 |
echo "Unsupported Version ${OS_VERSION} - Test only runs on Solaris 10" |
|
110 |
exit 0; |
|
111 |
;; |
|
112 |
esac |
|
113 |
||
114 |
# copy keystore into write-able location |
|
115 |
||
116 |
echo "Removing old pkcs11_keystore, creating new pkcs11_keystore" |
|
117 |
||
118 |
echo ${RM} ${TESTCLASSES}${FS}pkcs11_softtoken |
|
119 |
${RM} ${TESTCLASSES}${FS}pkcs11_softtoken |
|
120 |
||
121 |
echo ${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}private |
|
122 |
${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}private |
|
123 |
||
124 |
echo ${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}public |
|
125 |
${MKDIR} ${TESTCLASSES}${FS}pkcs11_softtoken${FS}public |
|
126 |
||
127 |
echo ${CP} ${TESTSRC}${FS}BasicData${FS}pkcs11_softtoken${FS}objstore_info \ |
|
128 |
${TESTCLASSES}${FS}pkcs11_softtoken |
|
129 |
${CP} ${TESTSRC}${FS}BasicData${FS}pkcs11_softtoken${FS}objstore_info \ |
|
130 |
${TESTCLASSES}${FS}pkcs11_softtoken |
|
131 |
||
132 |
echo ${CHMOD} +w ${TESTCLASSES}${FS}pkcs11_softtoken${FS}objstore_info |
|
133 |
${CHMOD} 600 ${TESTCLASSES}${FS}pkcs11_softtoken${FS}objstore_info |
|
134 |
||
135 |
# compile test |
|
136 |
||
137 |
if [ "${RECOMPILE}" = "yes" ] ; then |
|
138 |
cd ${TESTCLASSES} |
|
139 |
${RM} *.class |
|
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14786
diff
changeset
|
140 |
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \ |
2 | 141 |
-classpath ${TESTSRC}${FS}..${PS}${TESTSRC}${FS}loader.jar \ |
142 |
-d ${TESTCLASSES} \ |
|
21948
e8a1289096cd
8029369: Shell tests in sun/security/pkcs11/ do not compile PKCS11Test
vinnie
parents:
15254
diff
changeset
|
143 |
${TESTSRC}${FS}Basic.java \ |
e8a1289096cd
8029369: Shell tests in sun/security/pkcs11/ do not compile PKCS11Test
vinnie
parents:
15254
diff
changeset
|
144 |
${TESTSRC}${FS}..${FS}PKCS11Test.java |
2 | 145 |
fi |
146 |
||
147 |
# run test |
|
148 |
||
149 |
cd ${TESTSRC} |
|
14786
a9f61e0cbe61
8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents:
5506
diff
changeset
|
150 |
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \ |
2 | 151 |
-classpath ${TESTCLASSES}${PS}${TESTSRC}${FS}loader.jar \ |
152 |
-DDIR=${TESTSRC}${FS}BasicData${FS} \ |
|
153 |
-DCUSTOM_P11_CONFIG=${TESTSRC}${FS}BasicData${FS}p11-solaris.txt \ |
|
154 |
-DNO_DEFAULT=true \ |
|
155 |
-DNO_DEIMOS=true \ |
|
156 |
-DTOKEN=solaris \ |
|
157 |
-DTEST=${TEST} \ |
|
158 |
-Djava.security.manager \ |
|
159 |
-Djava.security.policy=${TESTSRC}${FS}Basic.policy \ |
|
160 |
-Djava.security.debug=${DEBUG} \ |
|
161 |
Basic |
|
162 |
||
163 |
# clean up |
|
164 |
||
165 |
#${RM} ${TESTCLASSES}${FS}pkcs11_softtoken |
|
166 |
||
167 |
# return |
|
168 |
||
169 |
exit $? |